Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

bayer rg 8-bit - how many bits per pixel am I looking at?

I'm streaming video with IMAQdx from a GigE Vision camera that does Bayer 8-bit RG, among other formats. I appear to be receiveing 24 bpp from the video stream, though. Does LabView do any conversions on this data that would ramp the size up without me knowing? Or is my camera doing it?
0 Kudos
Message 1 of 14
(20,287 Views)

When you set the camera to do the debayering for you, it interpolates the single 8 bit RAW value into a 3-tuple:  8 bits for Red, 8 bits for Blue, and 8 bits for Green.

 

So indeed it's the camera doing it.

 

If the bandwidth consumption (and related lower framerate) are more than you want, disable on-camera debayering and do it on the PC instead.

0 Kudos
Message 2 of 14
(20,286 Views)
0 Kudos
Message 3 of 14
(20,258 Views)

IMAQdx will generally do some conversion on the various pixel formats sent by the camera to get them into a proper format for a Vision image datatype. For some pixel formats, this may mean swapping endianness, unpacking bits, or shifting the data around.

 

For a BayerRG8 format, the camera is sending a 8-bit mono image and the driver is going to (by default) automatically do the Bayer conversion to a color image. Other cameras might expose a pixel format directly of an RGB or YUV format, in which case it is the camera itself doing the bayer conversion before sending it to IMAQdx.

 

In this case, you could disable IMAQdx's Bayer decoding (turn the bayer decoding attribute to "Off" rather than "Auto") and get the raw 8-bit mono image if you want. Usually the monochrome image is fairly useless since it has the bayer pattern applied. Some cameras might have a monochrome mode available where they will internally debayer the image, then convert it back to monochrome so that the bayer filter is effectively removed.

 

What is your objective you are trying to do here? 

 

Eric 

 

 

Message 4 of 14
(20,248 Views)
I'm trying to take control of the demosaicing algorithm in LabView and use it only on some frames instead of all of them, to save computation time and allow me to save off the raw image data as 8-bit to save disk space. IMAQdx allows me to grab the raw image data, so that part works, then I use a reshape array function to restore image dimensions and the IMAQ (IMAQdx doesn't have one) Bayer filter to reconstruct color data where I need it. The IMAQ function, however, messes up the color information somewhat (the green gain affects the left half of the reconstructed image differently than the right half). The image looks ok except for the color information being wrong.
0 Kudos
Message 5 of 14
(20,226 Views)

Hi, Eric,

I am trying to capture raw Bayer output but keep getting RGB data instead.

Which VI do you use and where do you "disable IMAQdx's Bayer decoding"?

Thanks.

Tim

 

0 Kudos
Message 6 of 14
(19,001 Views)

Hi Tim,

 

It is an attribute that can be changed like any other IMAQdx or camera setting. The easiest option is to just go to the camera in MAX, go to the Bayer tab, and set the decoding to "none". You can then click the Save button at the top to save these as the default settings. Then when you use it in LabVIEW it will start with those settings.

 

The programatic way in LabVIEW would be to use the property nodes and set the BayerPattern attribute to the string 'None'. There are lots of examples in this forum that should show how to access the attributes in LabVIEW.

 

Eric

0 Kudos
Message 7 of 14
(18,996 Views)

Hi, Eric,

I looked in MAX (ver 5.1.0f0) and the Bayer pane is grayed out.

I found an example "Grab and Bayer Decoding.vi" which uses Bayer attibutes.

But I still see color image even when the pattern is set to NONE.

Tim

 

0 Kudos
Message 8 of 14
(18,989 Views)

Hi, Nasgul,

Are you using LV?  If so, which IMAQdx VI are you using?

I keep getting color images with the low level Grab Raw Data.VI, even though the camera only outputs Bayer image.

Tim

 

0 Kudos
Message 9 of 14
(18,988 Views)

Can you show a screenshot in MAX showing the Acquisition tab on the camera?


Eric

0 Kudos
Message 10 of 14
(18,984 Views)