Operator BAYER5x5Linear

The operator BAYER5x5Linear 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. BAYER5x5Linear acquires an RGB image from a Bayer camera through a bilinear reconstruction. The input link must be a 5x5 kernel of a Bayer image.

The underlying algorithm is a patent free high quality linear implementation.

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 4 precision bits per component. For example, an 8 bit grayscale input image will be reconstructed into a 3 * (8 + 4) 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 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.

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, 16] (InputBitWidth + 4) * 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 must match the operator settings. See descriptions above.

Type static write parameter
Default AUTO
Range (AUTO, EmbeddedALU, LUT)

Parameter ImplementationType influences the implementation strategy of the operator, i.e., which logic elements are used for implementing the operator.

You can select one of the following values:

AUTO: When the operator is instantiated, the optimal implementation strategy is selected automatically based on the parametrization of the connected links.

EmbeddedALU: The operator uses embedded arithmetic logic elements of the FPGA that are not LUT based.

LUT: The operator uses the LUT logic of the FPGA.

[Note] Use AUTO in General

Normally, the parameter should be set to AUTO. In special cases, i.e., if one kind of FPGA ressource runs short in a design, you can manually influence the FPGA resource management using the values EmbeddedALU and/or LUT.

Examples of Use

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