Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert color image(24 bit) YUV 4:2:2 to gray scale 8 bit image

I am using sony DFW-X700 color camera for one of vision applications.Does NI Compact Vision System(CVS) support YUV 4:2:2 format(8 bit each).I want to do gray scale processing, so i need to convert the YUV color into gray scale (8-bit) in the software(like Labview). Please suggest us how to do this conversion for better gray scale image clarity from color.
0 Kudos
Message 1 of 2
(11,318 Views)
In YUV color space, Y represents the gray scale; in RGB color space, R=G=B represents gray scale. You can simply set R=G=B=Y, to convert YUV to RGB. If the original color depth is 24 bit, then the result is 24 bit too.

You can create gray scale color table like this:
array size = 256;
[0] = 0x000000;
[1] = 0x010101;
[2] = 0x020202;
...
[255] = 0xFFFFFF;

To convert 24 bit gray scale to 8 bit, check every pixel in 24 bit image to find the array index according to the color table, and replace the pixel with array index.

George Zou
http://gtoolbox.yeah.net
George Zou
Message 2 of 2
(11,318 Views)