About Bayer Cameras
Refer to the following sections for information about various aspects of Bayer cameras.
Bayer encoding is a method you can use to produce color images with a single imaging sensor, as opposed to three individual sensors for the red, green, and blue components of light. This technology greatly reduces the cost of cameras.
The Bayer color filter array (CFA) is a primary color, mosaic pattern of 50% green, 25% red, and 25% blue pixels. Green pixels comprise half of the total pixels because the human eye gets most of its sharpness information from green light.
The following illustration describes how the Bayer CFA is used in the image acquisition process.
Light travels through the camera lens onto an image sensor that provides one value for each sensor cell. The sensor is an array of tiny, light-sensitive diodes called photosites. The sensor converts light into electrical charges. The sensor is covered by the Bayer CFA so that only one color value reaches any given pixel. The raw output is a mosaic of red, green, and blue pixels of different intensity.
When the image is captured, the accumulated charge for each cell is read, and analog values are converted to digital pixel values using an analog-to-digital (A/D) converter.
Color interpolation, sometimes referred to as demosaicing, fills in the missing colors. 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.
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:
Determine the value of the pixel in the center of the following group:
These pixels have the following values:
200 050 220
060 100 062
196 058 198
Neighboring pixels are used to determine the RGB values for the center pixel. The blue component is 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 is repeated for each pixel in the image.
White balance is a method you can use to adjust for different lighting conditions and optical properties of the filter. While the human eye compensates for light with a color bias based on its memory of white, a camera captures the real state of light. Optical properties of the Bayer filter may result in mismatched intensities between the red, green, and blue components of the image.
To adjust image colors more closely to the human perception of light, white balancing assumes that if a white area can be made to look white, the remaining colors will be accurate as well. White balancing involves identifying the portion of an image that is closest to white, adjusting this area to white, and correcting the balance of colors in the remainder of the image based on the white area.
You should perform a white balance every time lighting conditions change. Setting the white balance incorrectly may cause color inconsistencies in the image.
The white level defines the brightness of an image after white balancing. The values for the red, green, and blue gains are determined by dividing the white level by the mean value of each component color. The maximum white level is 255.
If the white level is too high or too low, the image will appear too light or too dark. You can adjust the white level to fine-tune the image brightness.
When using the White Balancing Utility, start with the default white level value of 220. Select a region of interest and click Auto Calculate Gains. If the image appears incorrect, increase or decrease the white level, select a region of interest, and click Auto Calculate Gains. Repeat this procedure until the image appears correct.