Convert YCbCr color values to RGB color space



RGB = ycbcr2rgb(YCBCR) converts the luminance (Y) and chrominance (Cb and Cr) values of a YCbCr image to red, green, and blue values of an RGB image.


collapse all

This example shows how to convert an image from RGB to YCbCr color space and back.

Read an RGB image into the workspace.

RGB = imread('board.tif');

Convert the image to YCbCr color space.

YCBCR = rgb2ycbcr(RGB);

Convert the YCbCr image back to RGB color space.

RGB2 = ycbcr2rgb(YCBCR);

Display the luminance channel of the image in YCbCr color space alongside the image that was converted from YCbCr to RGB color space.

title('Original Luminance (Y)');
title('Image Converted to RGB');

Input Arguments

collapse all

YCbCr color values to convert, specified as a numeric array in one of these formats.

  • c-by-3 colormap. Each row specifies one YCbCr color value.

  • m-by-n-by-3 image.

Data Types: single | double | uint8 | uint16

Output Arguments

collapse all

Converted RGB color values, returned as a numeric array of the same size as the input. The output data type is the same as the input data type.


[1] Poynton, C. A.A Technical Introduction to Digital Video, John Wiley & Sons, Inc., 1996, p. 175.

[2] Rec. ITU-R BT.601-5, Studio Encoding Parameters of Digital Television for Standard 4:3 and Wide-screen 16:9 Aspect Ratios, (1982-1986-1990-1992-1994-1995), Section 3.5.

Extended Capabilities

GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

Introduced before R2006a