Previous: , Up: Image Processing   [Contents][Index]


32.5 Color Conversion

Octave supports conversion from the RGB color system to NTSC and HSV and vice versa.

Function File: hsv_map = rgb2hsv (rgb)
Function File: hsv_map = rgb2hsv (rgb)

Transform a colormap or image from red-green-blue (RGB) space to hue-saturation-value (HSV) space.

A color in the RGB space consists of red, green, and blue intensities.

A color in HSV space is represented by hue, saturation, and value (brightness) levels. Value gives the amount of light in the color. Hue describes the dominant wavelength. Saturation is the amount of hue mixed into the color.

See also: hsv2rgb, rgb2ind, rgb2ntsc.

Function File: rgb_map = hsv2rgb (hsv_map)
Function File: rgb_img = hsv2rgb (hsv_img)

Transform a colormap or image from hue-saturation-value (HSV) space to red-green-blue (RGB) space.

A color in HSV space is represented by hue, saturation and value (brightness) levels. Value gives the amount of light in the color. Hue describes the dominant wavelength. Saturation is the amount of hue mixed into the color.

A color in the RGB space consists of red, green, and blue intensities.

See also: rgb2hsv, ind2rgb, ntsc2rgb.

Function File: yiq_map = rgb2ntsc (rgb_map)
Function File: yiq_img = rgb2ntsc (rgb_img)

Transform a colormap or image from red-green-blue (RGB) color space to luminance-chrominance (NTSC) space. The input may be of class uint8, uint16, single, or double. The output is of class double.

Implementation Note: The reference matrix for the transformation is

/Y\     0.299  0.587  0.114  /R\ 
|I|  =  0.596 -0.274 -0.322  |G| 
\Q/     0.211 -0.523  0.312  \B/ 

as documented in http://en.wikipedia.org/wiki/YIQ and truncated to 3 significant figures. Note: The FCC version of NTSC uses only 2 significant digits and is slightly different.

See also: ntsc2rgb, rgb2hsv, rgb2ind.

Function File: rgb_map = ntsc2rgb (yiq_map)
Function File: rgb_img = ntsc2rgb (yiq_img)

Transform a colormap or image from luminance-chrominance (NTSC) space to red-green-blue (RGB) color space.

Implementation Note: The conversion matrix is chosen to be the inverse of the matrix used for rgb2ntsc such that

x == ntsc2rgb (rgb2ntsc (x))

MATLAB uses a slightly different matrix where rounding means the equality above does not hold.

See also: rgb2ntsc, hsv2rgb, ind2rgb.


Previous: , Up: Image Processing   [Contents][Index]