BAYER: two questions

General discussion about topics related to OpenMV.
User avatar
kwiley
Posts: 130
Joined: Fri Dec 21, 2018 5:22 pm

BAYER: two questions

Postby kwiley » Fri May 22, 2020 8:30 pm

I have two questions about the BAYER format. First, assuming I set the frame size to full res so there is no downsampling, VGA in my case (this is on an H7), it seems to me that the IDE's preview should be a grayscale image showing a quincunx of illumination pixels for green and two quarter patterns for red and blue, but the IDE's preview is in color, not grayscale, and does not show the classic quincunx "griddy" sampling overlay that you would expect of a BAYER image. How can a BAYER image have any color in it? By definition a BAYER pattern is a grayscale, single channel image.

Second question, if we set the pixformat to BAYER but don't use the full res, VGA, then what exactly are we getting as the output? That is totally perplexing. Is it subsampling 2x2 quartets of pixels or something like that? Just curious.

Thanks a bunch!
User avatar
kwagyeman
Posts: 4014
Joined: Sun May 24, 2015 2:10 pm

Re: BAYER: two questions

Postby kwagyeman » Sat May 23, 2020 12:34 am

The preview in the IDE is a JPG image. So, the software onboard debayers the image, then converts it to YUV (this is done in one step) and then jpg compresses it to send it to the IDE. The raw data matrix is in bayer however. So, none of our CV functions can read the image.

The camera sensor outputs processed bayer. It's not the raw pixel array. The OV7725 has an ISP (image signal processor onboard). So, while the output it bayer it's not direct from the camera image plane.
Nyamekye,
User avatar
kwiley
Posts: 130
Joined: Fri Dec 21, 2018 5:22 pm

Re: BAYER: two questions

Postby kwiley » Sat May 23, 2020 2:05 am

Okay, that explains why the IDE shows a deBayered preview. Thanks. I'm not going to say I really understood the rest of the reply quite yet, but I don't want to be a burden about it. I'm not sure what "processed bayer" is. The only processing I can imagine one would do to Bayer data is demosaicing to a three channel image. You mentioned the ISP, but that's just for noise reduction and "defect correction" (whatever they mean by that -- hot pixel removal perhaps?). Then you say the "output is bayer", but "not direct from the camera". Was it...I mean...are you implying you *reBayered* the RGB image?

Ah me. Don't worry about it. We all have other things to worry about. I was just curious what the BAYER pixformat option actually does, but I think I'm being a nuisance.

BTW, I love the trick of processing each 8x8 pixel block all the way down to JPEG before moving on to the next block so save space. That's really nifty.
User avatar
kwagyeman
Posts: 4014
Joined: Sun May 24, 2015 2:10 pm

Re: BAYER: two questions

Postby kwagyeman » Sat May 23, 2020 2:29 am

Was it...I mean...are you implying you *reBayered* the RGB image?
The ISPs on the camera sensors do a lot of color map processing and etc. Processed bayer is literally a re-bayered image. It's there for software compatibility since OnmiVision makes sensors for cellphone cameras. The RAW bayer image is not usable by our software as the you need to apply special color gains to get a usable image. For example, with the processed bayer image normal debayering code works on our system. However, the RAW bayer image has very little contrast so the image will appear gray. To work with a RAW bayer image you need a lot more processing per pixel to fix all the image quality issues.
Nyamekye,
User avatar
kwiley
Posts: 130
Joined: Fri Dec 21, 2018 5:22 pm

Re: BAYER: two questions

Postby kwiley » Sat May 23, 2020 2:44 am

Whoa, so I actually did understand you correctly. I just couldn't believe it. All right. Thanks a bunch!

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 2 guests