Learn R Programming

videoplayR (version 0.3.1)

img2r: Convert a vpImage object to a matrix or an array

Description

This function converts a vpImage object to a 2D matrix or a 3D array that can be used in R. Binary, grayscale, and 2D numeric vpImage objects will be converted to 2D matrices. RGB and 3D numeric vpImage objects will be converted to 3D arrays.

Usage

img2r(image)

Arguments

image
The vpImage object to convert.

Value

This function returns either a 2D matrix or a 3D arrays depending on the input vpImage object.

See Also

r2img, vpImage

Examples

Run this code
filename <- system.file("sample_img/SampleVideo_1080x720_5mb.png", package = "videoplayR")
img <- readImg(filename)
imgMat <- img2r(img)
imgMat

Run the code above in your browser using DataLab