ntsc2rgb
Convert NTSC values to RGB color space
Syntax
Description
Examples
Convert Image from YIQ to RGB
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
YIQ
— YIQ color values
numeric array
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
, orint16
.
Attribute | Description |
---|---|
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. |
Data Types: single
| double
| uint8
| uint16
| int16
Output Arguments
RGB
— Converted RGB color values
numeric array
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
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)