Learn R Programming

videoplayR (version 0.3.1)

ddd2d: Flatten a 3-channels image to 1 channel

Description

This function converts a 3-channels image (rgb or numeric) to a 1-channel image (binary, grayscale or numeric) by computing the average of the 3 channel values for each pixel. For instance, this function can be used to convert an rgb image to grayscale.

Usage

ddd2d(image)

Arguments

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

Value

This function returns a vpImage object.

Details

The vpImage object created by the ddd2d 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

d2ddd, vpImage

Examples

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

Run the code above in your browser using DataLab