COLOR_CONVERT
Syntax | Arguments | Keywords | Examples | Version History | See Also
The COLOR_CONVERT procedure converts colors to and from the RGB (Red Green Blue) and a number of other color spaces.
RGB values are bytes in the range 0 to 255. YCbCr values are bytes with the range indicated below. Other values are in floating point.
These color spaces and their ranges are:
The input parameters may be of one of the following forms:
A reference containing a discussion of the various color systems is: Foley and Van Dam, Fundamentals of Interactive Computer Graphics, Addison-Wesley Publishing Co., 1982.
Syntax
COLOR_CONVERT, I0, I1, I2, O0, O1, O2 [, /HLS_RGB | , /HSV_RGB | , /RGB_HLS | , /RGB_HSV | , /RGB_YCBCR | , /RGB_YIQ | , /RGB_YPBPR | , /RGB_YUV | , /YCBCR_RGB | , /YIQ_RGB | , /YPBPR_RGB | , /YUV_RGB ] [, INTERLEAVE=value]
or
COLOR_CONVERT, I0, O0 [, /HLS_RGB | , /HSV_RGB | , /RGB_HLS | , /RGB_HSV | , /RGB_YCBCR | , /RGB_YIQ | , /RGB_YPBPR | , /RGB_YUV | , /YCBCR_RGB | , /YIQ_RGB | , /YPBPR_RGB | , /YUV_RGB ] [, INTERLEAVE=value]
Arguments
I0, I1, I2
The input color triple(s). These arguments may be either scalars or arrays of same length.
O0, O1, O2
The variables to receive the result. Their structure is copied from the input parameters.
I0
An input image array of the form 3 x m x n, m x 3 x n, or m x n x 3.
O0
A variable to receive the result. Its structure is copied from the input parameter, I0.
Keywords
HLS_RGB
Set this keyword to convert from HLS to RGB.
HSV_RGB
Set this keyword to convert from HSV to RGB.
INTERLEAVE
This keyword is useful only when calling this procedure with two arguments. It is ignored when using six arguments. Set the keyword to the value that corresponds to the image array's interleave format. The second output argument uses the same interleave format when returning the result. The valid values for 2D arrays (3 x n or n x 3) are:
The valid values for 3D arrays (3xmxn, mx3xn, or mxnx3) are:
|
value
|
array type
|
|---|---|
|
|
Pixel Interleave (3 x m x n) (default) |
|
|
Row Interleave (m x 3 x n) |
|
|
Planar Interleave (m x n x 3) |
RGB_HLS
Set this keyword to convert from RGB to HLS.
RGB_HSV
Set this keyword to convert from RGB to HSV.
RGB_YCBCR
Set this keyword to convert from RGB to YCbCr.
RGB_YIQ
Set this keyword to convert from RGB to YIQ.
RGB_YPBPR
Set this keyword to convert from RGB to YPbPr.
RGB_YUV
Set this keyword to convert from RGB to YUV.
YCBCR_RGB
Set this keyword to convert from YCbCr to RGB.
YIQ_RGB
Set this keyword to convert from YIQ to RGB.
YPBPR_RGB
Set this keyword to convert from YPbPr to RGB.
YUV_RGB
Set this keyword to convert from YUV to RGB.
Examples
The command:
converts the RGB color triple (255, 255, 0), which is the color yellow at full intensity and saturation, to the HSV system. The resulting hue in the variable h is 60.0 degrees. The saturation and value in the variables s and v, are set to 1.0.
The command:
converts the RGB_IMAGE image array of the form [3,m,n] to YUV_IMAGE, an image array of the same form.
Version History