Setup

Load Images

# Load an image that comes with the package
filename <- system.file("sample_img/SampleVideo_1080x720_5mb.png",
                        package = "videoplayR")
img1 <- readImg(filename)
# add path to local image of interest
Fencing_png <- "/Users/irJERAD/Documents/Data-Apps/Tutorials/ComputerVision/images/IMG_0267.png"
Fencing_jpg <- "/Users/irJERAD/Documents/Data-Apps/Tutorials/ComputerVision/images/IMG_0267.jpg"
FencingP <- readImg(Fencing_png)
FencingJ <- readImg(Fencing_jpg)

vpImage Object

A vpImage object attributes can be used to impart the type of image contained.
Supported image types include:

  • Binary
  • Grayscale
  • RGB
    • PNG
    • JPEG
  • Numeric
img1$type
[1] "rgb"
img1$dim
[1]  720 1280    3
FencingP$type
[1] "rgb"
FencingJ$type
[1] "rgb"

Viewing vpImage

# view image
imshow(img1)