The YCbCr color space is widely used for digital video. In this format, luminance information is stored as a single component (Y), and chrominance information is stored as two color-difference components (Cb and Cr). Cb represents the difference between the blue component and a reference value. Cr represents the difference between the red component and a reference value. (YUV, another color space widely used for digital video, is very similar to YCbCr but not identical.)
YCbCr data can be double precision, but the color space is particularly well suited to
uint8 data. For
uint8 images, the data range for Y
is [16, 235], and the range for Cb and Cr is [16, 240]. YCbCr leaves room at the top and
bottom of the full
uint8 range so that additional (non-image)
information can be included in a video stream.
For example, these commands convert an RGB image to YCbCr format.
RGB = imread('peppers.png'); YCBCR = rgb2ycbcr(RGB);