yuv422 转 gray image

2015年1月13日 由 Creater 留言 »

Could you describe in more detail what you want the grey image format to be?

If you just want a luminance/brightness value for each pixel than you can just strip the Y values out of the existing YCbCr buffer for processing which would give you an array of byte values, one for each pixel, where the value represents the brightness of the pixel. I am not sure I understand why you want to convert to a RGB888 format if all you require is a grey version of the image.

In the code example here on the wiki there is actually a function that will take a YCbCr buffer and make it appear greyscale by wiping out all the color data, you could do a similar operation to make a buffer greyscale data in the format you are trying to work with.

//make the image greyscale by setting all chrominance to 0x80
void process_imagebw( void* currentFrame,  int yRows, int xPixels)
{
   
 int xx = 0;
 
     for( xx = 0; xx < (yRows * xPixels)*2; xx+=2 )//just operating on the chroma
      {

            *( ( (unsigned char*)currentFrame ) + xx ) = 0x80; //set all chroma to midpoint 0x80
         }

 
} // End process_imagebw()

参考文献:
1.http://e2e.ti.com/search?q=YUV422
2.http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/99/p/6155/23101#23101
3.http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/100/p/8521/34684#34684
4.http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/99/t/121390
5.http://www.filtermeister.com/wiki/index.php?page=RGB+to+Grayscale+Conversion
6.http://processors.wiki.ti.com/index.php?title=Accessing_pixels_in_a_frame_on_DM643x

广告位

发表评论

你必须 登陆 方可发表评论.