Operator BAYER3x3Linear

The operator BAYER3x3Linear reconstructs an RGB image from a Bayer input image. Technically, a Bayer raw image is a grayscale image which is composed from alternating red, green and blue pixels. BAYER3x3Linear acquires an RGB image from a Bayer camera through a bilinear reconstruction. The input link must be a 3x3 kernel of a Bayer image.

The operator input is a grayscale image while the output is a color image. Therefore, the output bit width is increased by a factor of three plus 2 precision bits per component. For example, an 8 bit grayscale input image will be reconstructed into a 3 * (8 + 2) bit color image. If the added precision bits are not required they can be discarded using operator RND or ShiftRight.

The Bayer array configuration of the camera must match the operator settings. The operator setting is changed using parameter BayerInit. Four different mappings of the Bayer array on the sensor are possible:

  • GreenFollowedByRed

  • RedFollowedByGreen

  • BlueFollowedByGreen

  • GreenFollowedByBlue

The figures show the top left corner of an image transferred to the frame grabber. In general, this is the top left corner of the camera's sensor but could change if you set a region of interest in the camera. The sensor pixel are overlaid with one of the four different Bayer patterns shown in the figures. Select the Bayer pattern corresponding to the image sensor of your camera.

The underlying algorithm is patent free.

I/O Properties

Property Value
Operator Type O
Input Link I, image data input
Output Link O, image data input

Supported Link Format

Link Parameter Input Link I Output Link O
Bit Width [1, 19] (InputBitWidth + 2) * 3
Arithmetic unsigned as I
Parallelism any as I
Kernel Columns 3 1
Kernel Rows 3 1
Img Protocol {VALT_IMAGE2D, VALT_LINE1D} as I
Color Flavor FL_NONE FL_RGB
Max. Img Width any as I
Max. Img Height any as I


Type dynamic/static read/write parameter
Default GreenFollowedByRed
Range {GreenFollowedByRed, GreenFollowedByBlue, RedFollowedByGreen, BlueFollowedByGreen}

The Bayer array configuration of the camera match the operator settings. See descriptions above.

Examples of Use

The use of operator BAYER3x3Linear is shown in the following examples: