48 Chapter 4: Matrox RadientPro CL hardware reference
Color space converter and pixel formatter
The color space converter and pixel formatter can convert data being transferred
off-board as follows:
•
Resizing.
Image data can be cropped (ROI capture) and/or subsampled. This can
be useful to implement custom software-based motion detection because at a
reduced scale, image comparison is faster. The color space converter and pixel
formatter can subsample in the horizontal direction by integer factors of 1 to 16;
whereas, there is no restriction in the vertical direction; subsampling occurs using
nearest-neighbor interpolation.
•
Flipping.
Image data can be flipped vertically. The color space converter and pixel
formatter is not used to flip an image grabbed into a Host buffer.
•
Color space conversion.
Image data can be converted as follows:
The equations for the YUV16 conversion are described in the following table. The
value of
depth
is either 8 or 16 when converting BGR24 or BGR48 data,
respectively. Note that when performing BGR48-to-YUV color space conversion,
the operations are carried out on 16-bit data; then, each resulting YUV component
is bit-shifted right by 8 bits ( >> (
depth
- 8) where the value of
depth
is 16).
In
Out
8-bit
monochrome
16-bit
monochrome
24-bit
packed
BGR
32-bit
packed
BGRa
48-bit
packed
BGR
16-bit
YUV
(YUYV)
24-bit
RGB
planar
48-bit
RGB
planar
8-bit monochrome
yes
yes
yes
yes
yes
16-bit monochrome
yes
yes
yes
yes
yes
yes
yes
yes
24-bit packed BGR
yes
yes
yes
yes
yes
48-bit packed BGR
yes
yes
yes
yes
yes
yes
yes
yes
Color space conversion
Equations
BGR-to-YUV
• Y = (0.114B + 0.587G +0.299R) >>(depth - 8)
• U = (0.500B - 0.331G - 0.169R + 2
(depth-1)
) >>(depth - 8)
• V = (-0.081B - 0.419G + 0.500R + 2
(depth-1)
) >>(depth - 8)