Convert NTSC values to RGB color space
This example shows how to convert an image from RGB to NTSC color space and back.
Read an RGB image into the workspace.
RGB = imread('board.tif');
Convert the image to YIQ color space.
YIQ = rgb2ntsc(RGB);
Display the NTSC luminance, represented by the first color channel in the YIQ image.
imshow(YIQ(:,:,1)) title('Luminance in YIQ Color Space')
Convert the YIQ image back to RGB color space.
RGB2 = ntsc2rgb(YIQ);
Display the image that was converted from YIQ to RGB color space.
figure imshow(RGB2) title('Image Converted from YIQ to RGB Color Space')
YIQ— YIQ color values
YIQ color values to convert, specified as a numeric array in one of these formats.
c-by-3 colormap. Each row specifies one YIQ color value.
Values should be in the range [0, 1] with data type
m-by-n-by-3 image. Values can be data
|Y||Luma, or brightness of the image. Values are in the range [0, 1], where 0 specifies black and 1 specifies white. Colors increase in brightness as Y increases.|
|I||In-phase, which is approximately the amount of blue or orange tones in the image. I in the range [-0.5959, 0.5959], where negative numbers indicate blue tones and positive numbers indicate orange tones. As the magnitude of I increases, the saturation of the color increases.|
|Q||Quadrature, which is approximately the amount of green or purple tones in the image. Q in the range [-0.5229, 0.5229], where negative numbers indicate green tones and positive numbers indicate purple tones. As the magnitude of Q increases, the saturation of the color increases.|
RGB— Converted RGB color values
Converted RGB color values, returned as a numeric array of the same size as the
input. Values are in the range [0, 1]. The output data type is
unless the input data type is
single, in which case the output data
type is also
ntsc2rgb computes the RGB values from the NTSC components using