Ask Your Question

Can´t convert raw grayscale 12 bit picture to color

asked 2017-06-19 14:46:07 -0500

i have to convert a raw image to color. My informations about the Image are:
- the color-depth is 12 bit
- i have to use Bayer-Patern to convert it
- one (color) Pixel has 1 value for red in the raw-image and 3 gray values (i have really no idea, how this should work)
You can see a part of the raw-image here: But if i try to debayer it, i get only a 1-color picture like that:
Note: I have this examples already converted to 8Bit. A 12Bit example can you see here:
I use c++ and opencv. My source-code:

Mat iSource(height, width, CVMatType, (char*)pData);
Mat z, zz;
iSource.convertTo(z, CV_MAKETYPE(CV_8U, 1), 0.0625);
cvtColor(z, zz, CV_BayerGB2RGB);

I have also tried to look at values of that parts of the image, where i know which color there should be (traffic-signs).
Where Blue should be, are this values in the raw image: 00 05
05 05

08 08
08 08

0D 56
56 56

11 5F
50 5E

That seems not to be a bayer pattern. Has anybody an idea? Thanks! (sorry for my english!)

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2017-06-19 19:56:41 -0500

Tetragramm gravatar image

It's definitely kinda bayer. The colors seem off though. It's an RG or a BG, not a GR or GB, definitely.

You just post the 8-bit link twice, so I don't know if you're doing that wrong.

Anyway, it looks either oddly blue or oddly red. You should try to find more detail about either the camera or the format it's giving you. Perhaps there's a very strong filter on it? Or maybe it's not really Bayer.

edit flag offensive delete link more


sorry, the link was a copy&paste error. The real link is: This is a project from my university and i´ve tried to get more information, but i get always the same answer. The only usefull things i know are:
- the black points in the picture are the red channel
- the camera is an aptina camera
- the color of the car in the middle is black
They told me, that the picture is bayer, but after i use any kind of bayer and non-bayer conversion and never get an true color picture, i think, that i have to use some spooky algorithm to converse this picture.
Maybe helps the 12Bit picture to get an answer =)

JoeMagnus gravatar imageJoeMagnus ( 2017-06-20 12:45:13 -0500 )edit

Question Tools

1 follower


Asked: 2017-06-19 14:46:07 -0500

Seen: 1,102 times

Last updated: Jun 19 '17