Bayer Pattern

A common technique to give color sensitivity to a black & white image sensor is the application of a color mosaic filter on top of the sensor. In most cases a three-color red-green-blue (RGB) pattern is used. The In-Sight color sensors use a Bayer pattern as their RGB color mosaic filter pattern. With the Bayer pattern, each pixel is covered by a specific color filter, in a specific pattern. Half of the total number of pixels are green (G), while a quarter of the total number is assigned to both red (R) and blue (B), as follows:

Each color pixel is composed of three separate color components: red, green and blue. The missing colors, for each pixel, are interpolated using the surrounding pixels at each location. For example, if a pixel is filtered for green, the value for the green component is known, but the values of the red and the blue components must be calculated from the average value of surrounding red-filtered and blue-filtered pixels. Through software interpolation, each pixel is assigned a value from 0 to 255 for the two unknown color components. Following are examples of how the values for all three color components are calculated for a single pixel.

The values for each color component of pixel G1 are:

  • Red component value =
  • Green component value = the value of G1 = 218
  • Blue component value =

In this example, the values of the RGB components for pixel G1 are (80,218,45).

If output values were given to each pixel, then the values for each color component of pixel B2 are:

  • Red component value =
  • Green component value =
  • Blue component value = the value of B2 = 60

In this example, the values of the RGB components for pixel B2 are (240,220,60).