how many Bits per Pixel accept the Bayer-Conversion functions from the Image Processing Toolbox as Input?
In the documention I only find the output Format RGB888. My CMOS Sensor has 12-bits per Pixel.
Bayer-Conversion functions from the Image Processing Toolbox accept 8 bits per pixel as input.
thank you for the answer. When my CMOS Sensors outputs 12 bits per Pixel I assume that I must
convert the 12-bit Pixel into an 8-bit Pixel. Can I do that by simply shifting the 12-bit value by 4?
No. It’s not a good idea to shift 12-bit data from sensor to get 8-bit data. You will lose a lot of information.
What you can do is, keep 12-bit data from sensor, and convert it to RGB (16 bit).
Then if you require 8 bit data, convert 16-bit RGB to 8-bit RGB
I can help you with some changes that you can do to Image Processing Toolbox to get 16-bit Bayer conversion done.
There is a C-reference file - bayer_ref.c in c_ref folder.
If you see those codes, input (pInBuff), output (pOutBuff) and intermediate values(r, g, b) are all 8-bit.
Just increase the data type of these variables to 16-bit and use it to get the job done.
Hope this helps.
thank you very much for your help. I made the changes you suggested in bayer_ref.c and also in adi_image_toolbox.h. I assume that the result of the conversion is RGB with 16-bit per color-channel (48-bit per Pixel). What can I do to view the image with the VisualDSP image-viewer tool, which has no option for RGB 48-bit ? I don't understand what you mean by converting 12-bit CMOS data to 16-bit RGB and then 16-bit RGB to 8-bit RGB ?
When I said 16-bit RGB, I meant 16-bit per color. So you are right, you will get 48-bit per pixel RGB output.
You can view this file using IrfanView. Just add a ppm header to view it.
Refer Image_Tool_Box_UsersGuide_Relx.y.z.pdf, section 3.3.
it works with Irfan View and the PPM-File. Now i want to convert RGB to YUV420 needed as Input Format for MPEG-2 Encoder.
In the Image Toolbox library is a color conversion function which has as output YUV444, which has to be modified for 16-bit per component.
For the conversion from YUV444 to YUV420 i use my own function. How can i do the reduction from 16-bit per component (YUV444) to 8-bit
per component (YUV420). For the chroma subsampling i calculate the average value of the chroma componnts of a 2x2 subblock.
For the 16bit to 8bit reduction, take only the upper 8bits of the input 16bit value. The lower 8bits may be discarded here.
Chroma subsampling is again done by taking the average of teh 2x2 subblock. The scale reduction from 16bit to 8bit can be performed in the same manner as luma.
Retrieving data ...