Bayer Pattern

NI Vision Acquisition Express VI

Bayer Pattern

Bayer Pattern, sometimes referred to as demosaicing, replaces colors in Bayer images. A decoding algorithm determines a value for the RGB components for each pixel in the array by averaging the color values of selected neighboring pixels and producing an estimate of color and intensity. After the interpolation process is complete, the white balancing process further enhances the image by adjusting the red and blue signals to match the green signal in white areas of the image.

Example

Several decoding algorithms perform color decoding, including nearest neighbor, linear, cubic, and cubic spline interpolations. The following example provides a simple explanation of the interpolation process.

To determine the value of the pixel in the center of the following group:

RGR

GBG

RGR

When the pixels have the following values:

200 50 220
60 100 62
196 58 198

Neighboring pixels will be used to determine the RGB values for the center pixel. The blue component will be taken directly from the pixel value, and the green and red components are the average of the surrounding green and red pixels, respectively.

R = (200 + 220 + 196 + 198)/4 = 203.5 ~ 204

G = (50 + 60 + 62 + 58)/4 = 57.5 ~ 58

B = 100

The final RGB value for the pixel is (204,58,100). This process will be repeated for each pixel in the image.