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

Description Usage Arguments Value See Also Examples

Description

This function converts a 2D matrix or a 3D array to a vpImage object to that can be manipulated using the videoplayR image and video manipulation toolbox. Binary matrices will be converted to binary vpImage objects. Integer matrices with values in [0, 255] will be converted to grayscale vpImage objects. Numeric matrics will be converted to 2D numeric vpImage objects. 3D integer arrays with values in [0, 255] will be converted to RGB vpImage objects. 3D numeri arrays will be converted to 3D numeric vpImage objects.

Usage

1

Arguments

array

The matrix or array to convert.

numeric

A logical value indicating if the matrix or array should be treated as a numeric object. If FALSE (default), the matrix or array will be casted to an integer matrix or array. If TRUE, the matrix or array will be converted to a numeric vpImage object.

Value

This function returns a vpImage object.

See Also

img2r, vpImage

Examples

1
2
3
4
5
gradient <- function(x1, x2) { x1 + x2 }
x <- 0:127
mat <- gradient(outer(rep(1, length(x)), x), x)
img <- r2img(mat)
imshow(img)

swarm-lab/videoplayR documentation built on May 30, 2019, 9:36 p.m.