Learn R Programming

videoplayR (version 0.3.1)

d2ddd: Expand a 1-channel image to 3 channels

Description

This function converts a 1-channel image (binary, grayscale or numeric) to a 3-channels image (rgb or numeric) by triplicating the current channel. For instance, this function can be used to convert a 1-channel binary mask to a 3-channels mask.

Usage

d2ddd(image)

Arguments

image
A 1-channel vpImage object to convert to 3 channels.

Value

This function returns a vpImage object.

Details

The vpImage object created by the d2ddd function is not a persistent object, but a pointer to a C++ object that cannot be saved for reuse in a different session.

See Also

ddd2d, vpImage

Examples

Run this code
filename <- system.file("sample_img/SampleVideo_1080x720_5mb.png", package = "videoplayR")
img <- readImg(filename)
imshow(img)
mat <- matrix(0, nrow = img$dim[1], ncol = img$dim[2])
mat[80:640, 250:650] <- 1
mask <- d2ddd(r2img(mat))
imshow(blend(img, mask, "*"))

Run the code above in your browser using DataLab