Specifications
Color Space Conversion
9-11
9
This call converts the RGB image
rgbImage
to the CMY image
cmyImage
by setting each channel in the CMY image as follows:
C=255-R
M=255-G
Y=255-B
The conversion from CMY to RGB is similar: just switch the RGB and
CMY images.
Data ranges in the HLS and HSV Color Models
The ranges of color components in the hue-lightness-saturation (HLS) and
hue-saturation-value (HSV) color models are defined as follows:
hue H is in the range 0 to 360
lightness L is in the range 0 to 1
saturation S is in the range 0 to 1
value V is in the range 0 to 1.
In the Image Processing Library, these color components are represented
by the following integer values of hue H
’
, lightness L
’
, saturation S
’
,and
value V
’
:
H
’
= H/2 for 8-bit unsigned color channels, H
’
= H otherwise,
L
’
= L
*MAX_VAL
S
’
= S*MAX_VAL
V
’
= V*MAX_VAL.
Here
MAX_VAL = 255 for 8-bit unsigned color channels,
MAX_VAL = 65,535 for 16-bit unsigned color channels,
MAX_VAL = 2,147,483,647 for 32-bit signed color channels.