Specifications
Color Space Conversion
9-21
9
ApplyColorTwist
Applies a color-twist
matrix to an image.
void iplApplyColorTwist(IplImage*
srcImage
,
IplImage*
dstImage
, IplColorTwist*
cTwist
, int
offset
);
srcImage
Thesourceimage.
dstImage
The resultant image.
cTwist
The color-twist matrix data structure that was
prepared by a call to the function
iplSetColorTwist().
offset
An offset value that will be added to each pixel
channel after multiplication by the color-twist
matrix.
Discussion
The function iplApplyColorTwist() applies the color-twist matrix to
each of the first three color channels in the input image to obtain the
resulting data for the three channels.
For example, the matrix below can be used to convert normalized
PhotoYCC to normalized PhotoRGB (both with an opacity channel) when
the channels are in the order YCC and RGB, respectively:
2
31
02
31
0
2
31
XY0
2
31
2
31
00
0002
31
where X = -416611827 (that is, -0.194·2
31
)and
Y=
-1093069176 (that is, -0.509·2
31
).
Color-twist matrices may also be used to perform many other color
conversions as well as the following operations: