rgb2ntsc

Convert RGB color values to NTSC color space

Description

example

YIQ = rgb2ntsc(RGB) converts the red, green, and blue values of an RGB image to luminance (Y) and chrominance (I and Q) values of an NTSC image.

yiqmap = rgb2ntsc(rgbmap) converts an RGB colormap to an HSV colormap.

Examples

collapse all

This example shows how to convert an image from RGB to NTSC color space.

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 value, represented by the first color channel in the YIQ image.

imshow(YIQ(:,:,1));
title('Luminance in YIQ Color Space');

Input Arguments

collapse all

RGB image to convert, specified as an m-by-n-by-3 numeric array with values in the range [0, 1]. The third dimension of RGB defines the red, green, and blue intensity of each pixel, respectively.

Data Types: double

RGB colormap, specified as a c-by-3 numeric matrix with values in the range [0, 1]. Each row of rgbmap is a three-element RGB triplet that specifies the red, green, and blue components of a single color of the colormap.

Data Types: double

Output Arguments

collapse all

NTSC image, returned as an m-by-n-by-3 numeric array with values in the range [0, 1]. The third dimension of YIQ defines the luminance (Y) and chrominance (I and Q) for each pixel, respectively

Data Types: double

NTSC colormap corresponding to the c colors in rgbmap, returned as a c-by-3 numeric matrix with values in the range [0, 1]. Each row of yiqmap is a three-element YIQ triplet that specifies the luminance (Y) and chrominance (I and Q) components of a single color of the colormap.

Data Types: double

Algorithms

In the NTSC color space, the luminance is the grayscale signal used to display pictures on monochrome (black and white) televisions. The other components carry the hue and saturation information. The value 0 corresponds to the absence of the component, while the value 1 corresponds to full saturation of the component.

rgb2ntsc defines the NTSC components using

[YIQ]=[0.2990.5870.1140.5960.2740.3220.2110.5230.312][RGB]

Introduced before R2006a