Like HowStuffWorks on Facebook!

How Digital Cameras Work

Demosaicing Algorithms: Color Filtering

A more economical and practical way to record the primary colors is to permanently place a filter called a color filter array over each individual photosite. By breaking up the sensor into a variety of red, blue and green pixels, it is possible to get enough information in the general vicinity of each sensor to make very accurate guesses about the true color at that location. This process of looking at the other pixels in the neighborhood of a sensor and making an educated guess is called interpolation.

The most common pattern of filters is the Bayer filter pattern. This pattern alternates a row of red and green filters with a row of blue and green filters. The pixels are not evenly divided -- there are as many green pixels as there are blue and red combined. This is because the human eye is not equally sensitive to all three colors. It's necessary to include more information from the green pixels in order to create an image that the eye will perceive as a "true color."

The advantages of this method are that only one sensor is required, and all the color information (red, green and blue) is recorded at the same moment. That means the camera can be smaller, cheaper, and useful in a wider variety of situations. The raw output from a sensor with a Bayer filter is a mosaic of red, green and blue pixels of different intensity.

Digital cameras use specialized demosaicing algorithms to convert this mosaic into an equally sized mosaic of true colors. The key is that each colored pixel can be used more than once. The true color of a single pixel can be determined by averaging the values from the closest surrounding pixels.

This content is not compatible on this device.

Some single-sensor cameras use alternatives to the Bayer filter pattern. X3 technology, for example, embeds red, green and blue photodetectors in silicon. Some of the more advanced cameras subtract values using the typesetting colors cyan, yellow, green and magenta instead of blending red, green and blue. There is even a method that uses two sensors. However, most consumer cameras on the market today use a single sensor with alternating rows of green/red and green/blue filters.

More to Explore