Main Content

# ntsc2rgb

Convert NTSC values to RGB color space

## Syntax

``RGB = ntsc2rgb(YIQ)``

## Description

example

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

## Examples

collapse all

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')```

## Input Arguments

collapse all

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 `double`.

• m-by-n-by-3 image. Values can be data type `single`, `double`, `uint8`, `uint16`, or `int16`.

AttributeDescription
YLuma, 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.
IIn-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.
QQuadrature, 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.

Data Types: `single` | `double` | `uint8` | `uint16` | `int16`

## Output Arguments

collapse all

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 `double` unless the input data type is `single`, in which case the output data type is also `single`.

Data Types: `double` | `single`

## Algorithms

`ntsc2rgb` computes the RGB values from the NTSC components using

## Version History

Introduced before R2006a