You are here : matlabImage Processingrgb2ycbcr

rgb2ycbcr() - Image Processing

ycbcrmap = rgb2ycbcr(map) converts the RGB values in map to the YCbCr color space. map must be an M-by-3 array. ycbcrmap is an M-by-3 matrix that contains the YCbCr luminance (Y) and chrominance (Cb and Cr) color values as columns.

Each row in ycbcfmap represents the equivalent color to the corresponding row in the RGB colormap, map.

YCBCR = rgb2ycbcr(RGB) converts the truecolor image RGB to the equivalent image in the YCbCr color space. RGB must be a M-by-N-by-3 array.

gpuarrayB = rgb2ycbcr(gpuarrayA) performs the conversion on a GPU. The input image, gpuarrayA, can be an RGB gpuArray colormap or an RGB gpuArray image. The output is an YCbCr gpuArray colormap or an YCbCr gpuArray image, depending on the input type.

This syntax requires the Parallel Computing Toolboxâ„¢. If the input is uint8, YCBCR is uint8, where Y is in the range [16 235], and Cb and Cr are in the range [16 240]. If the input is a double, Y is in the range [16/255 235/255] and Cb and Cr are in the range [16/255 240/255]. If the input is uint16, Y is in the range [4112 60395] and Cb and Cr are in the range [4112 61680].

Code Generation support: Yes. MATLAB Function Block support: Yes.


ycbcrmap = rgb2ycbcr(map)
YCBCR = rgb2ycbcr(RGB)
gpuarrayB = rgb2ycbcr(gpuarrayA)


RGB = imread('board.tif');
YCBCR = rgb2ycbcr(RGB);

Output / Return Value


Alternatives / See Also