# changing binning_x,binning_y

Hi,

When I change the binning_x and binning_y of prosilica_driver from reconfigure_gui, the color of image_raw turns to black and white. Are there are any ways to keep image_raw colored when I change binnings?

edit retag close merge delete

Sort by » oldest newest most voted

No. Color cameras generally work by imposing a Bayer pattern on the image sensor, where each pixel is covered by a filter so that it detects only one color channel (red, green or blue). For example, an RGGB Bayer camera gives you raw images laid out like this:

RG  RG  RG  RG  ...
GB  GB  GB  GB  ...

RG  RG  RG  RG  ...
GB  GB  GB  GB  ...


This is a one-channel image, where each pixel only has information about a single color. Transforming the raw Bayer image into a normal, 3-channel color image is called debayering. There are numerous debayering algorithms of varying sophistication, but the idea is always to interpolate the missing color data from nearby pixels. In ROS, debayering is performed by image_proc.

Binning changes how the camera accumulates the charge at each pixel. With 2x2 binning, 2x2 blocks of pixels are combined into super-pixels using the summed charges of the 4 actual pixels. In this case, every 2x2 Bayer pattern block gets averaged into a monochrome super-pixel:

M M M M ...
M M M M ...

M M M M ...
M M M M ...


You no longer have distinct samples for each color in the raw image.

There are some cameras with a "color binning" feature, which use more complicated circuitry to accumulate each color separately and thus preserve the Bayer pattern in the binned image. As far as I know there aren't any Prosilica cameras with this feature.

more