A Bayer filter is a mosaic of tiny red, green and blue filters laid over the light-sensitive photosites of a camera sensor. Photosites can only count how much light reaches them, not what colour it is. By putting a coloured filter over each one, the sensor records a single colour value at every position, and the camera later works out the full colour of each pixel.
The pattern
The mosaic repeats in blocks of four: two green, one red and one blue. So half of all photosites are green, a quarter red and a quarter blue. Green gets the extra share because human vision is most sensitive in that part of the spectrum, and because our impression of fine detail depends mostly on brightness, which green contributes to the most. The layout is named after Bryce Bayer, who devised it at Kodak in the 1970s.
Turning one colour per pixel into full colour
A pixel under a red filter knows its red level but nothing about its green or blue. The camera, or your raw converter, fills those in by looking at neighbours: the green and blue values around a red pixel suggest what green and blue it should have. This estimate is called demosaicing. Simple methods average nearby values. Better ones follow edges and gradients so lines do not smear. Raw files store the unprocessed mosaic, which is why different software can give slightly different results from the same file.
Side effects
- Moire. Fine regular patterns, such as fabric weave or distant brickwork, can clash with the regular grid and produce wavy bands. See moire.
- False colour. At sharp edges the estimate can guess wrong, leaving odd colour fringes on very fine detail.
- Slight softness. Many cameras carry an optical low-pass filter that blurs the image a hair to hide these effects. Others leave it out for crisper detail and accept more risk of moire.
- Light loss. Each filter blocks the other two colours, so a Bayer sensor gathers less light than a bare one would.
Alternatives
Fujifilm’s X-Trans uses a less regular six-by-six arrangement, which lowers moire without a low-pass filter. Foveon sensors stack three layers that each respond to a different colour, so every position records all three and nothing has to be estimated. Some cameras also use a quad or similar grouping where neighbouring pixels share one colour, which can be combined for low light. Bayer remains the dominant design, because years of processing work have refined it.
Want to see how the sensor as a whole captures a picture, from photosite to file? How image sensors work covers the whole chain.