Tech Behind ThingsHow the ordinary machinery actually works

Devices

Why A Camera Sensor Sees Colour Through A Grid Of Filters

Image sensors are colourblind, so each pixel is covered by a single colour filter and the missing two thirds of the picture is reconstructed by calculation.

A classroom setting featuring laptops and desks, capturing a modern educational environment.
Photograph by Adam Sondel via Pexels
Editorial note. Independent reporting and analysis. Nothing here is sponsored or paid for. How we work.

A digital photograph records colour at every point, but the sensor that captured it measured only one colour per position. The rest is inferred.

Silicon counts photons without seeing colour

A photosite converts arriving light into charge. It responds to a broad range of wavelengths and reports only how much energy landed, not what colour it was.

Left alone, such a sensor produces a monochrome image. It is genuinely more sensitive than a colour one, because nothing is being filtered out.

To record colour, each photosite must be restricted to part of the spectrum. That is done with a microscopic coloured filter laid directly over it.

The filters are arranged in a repeating pattern

The standard layout uses red, green and blue filters in a fixed tiling, with green appearing twice as often as either of the others.

Green dominates because human vision is most sensitive to those wavelengths, and most of our perception of fine detail and brightness comes from that part of the spectrum.

The consequence is that at any given position the sensor knows one colour value and is missing the other two entirely.

Demosaicing invents the missing values

Software estimates each absent value from the neighbouring photosites that did record it. A pixel that measured red borrows its green and blue from adjacent sites.

Good algorithms do not simply average. They detect edges first and interpolate along them rather than across them, since averaging across an edge smears it.

This is why a photograph resolves less true detail than its pixel count implies. Roughly two thirds of the colour information in the final image was calculated rather than measured.

The filters explain several familiar artefacts

Fine repeating patterns, such as fabric weave, can beat against the filter grid and produce false colour fringes that were never present in the scene.

Sensors historically included a slight blurring filter specifically to prevent this, deliberately sacrificing sharpness. Higher pixel densities reduced the problem enough that many designs dropped it.

Very low light causes a related issue. With few photons per site, the colour estimates become unreliable and the noise takes on visible coloured blotches rather than neutral grain.

Alternatives exist and stayed rare

Sensors have been built that stack light-sensitive layers so every position measures all three colours, using the fact that different wavelengths penetrate silicon to different depths.

They avoid interpolation entirely but have struggled with noise and readout speed, and the manufacturing base for the filtered approach is enormous.

Some designs instead replace one filter with a clear site to gather more light. Colour accuracy suffers slightly, and low-light performance improves, which for phones is usually the better trade.

Questions readers ask

Why does brightness jump when I unlock the phone?

The sensor is often only sampled while the screen is on, so the first reading after unlocking replaces a stale value from earlier.

Does automatic brightness save battery?

Usually yes, because most people set a fixed level high enough for the worst case and then leave it there in dim rooms.

Devicesdisplayssensorsperceptionpower
Grigor Petrov
Hardware writer, Tech Behind Things

Grigor writes about silicon, thermals and the physical limits designers keep bumping into.

Also by Grigor Petrov