Bayer CFA sampling and demosaic
Under the microlenses sits a colour filter array. In the common Bayer mosaic, each photosite records one filtered band. Full RGB at every site is invented afterward by demosaic interpolation.
A silicon photodiode counts photons across a broad visible band. To get colour, a filter sits over each site: typically red, green, or blue in a repeating 2×2 pattern with two greens, one red, and one blue. The double green weighting follows the eye’s greater sensitivity to mid-spectrum light and helps luminance detail. At capture time, a “green” site has no simultaneous red or blue sample at that exact location.
Demosaic algorithms estimate the missing channels from neighbours. A simple bilinear average is easy to understand and softens fine detail. Edge-aware methods try to interpolate along contours rather than across them, preserving sharpness at the cost of complexity and occasional false colour or zipper artefacts when the guess is wrong. No demosaic recovers information that was never sampled; it invents plausible values consistent with local structure and the mosaic layout.
Sampling density is unequal by design. In an N×N pixel Bayer sensor there are about N²/2 green samples and N²/4 each of red and blue. Luminance-like detail, carried largely by green, is better sampled than pure chromatic detail. That is why coloured moiré and maze artefacts appear first on fine high-contrast colour structure, and why optical low-pass filters historically traded sharpness for safer sampling.
A worked count keeps the mosaic arithmetic plain. On a 24-megapixel Bayer sensor there are about 24×10⁶ photosites. Roughly 12×10⁶ are green-filtered, and about 6×10⁶ each are red- and blue-filtered. After demosaic, the file presents 24×10⁶ RGB triples — three times as many channel values as physical filtered samples — because two channels at each site were estimated. The megapixel marketing number counts photosites, not independent full-colour measurements.
Scope limits: this note does not rank vendor demosaic engines, does not cover Foveon or multispectral arrays in depth, and does not claim RAW is “unprocessed” in every sense. It states that each photosite records one CFA band and that demosaic is a necessary, lossy-in-information reconstruction with sharpness and artefact trade-offs.
A misreading
The misreading is that each photosite records full RGB. On a Bayer sensor, each site sees through one colour filter. The other two values at that coordinate are interpolated. A three-channel RAW or TIFF after demosaic is a reconstruction, not a literal per-site trichromatic measurement.
For practice, treat demosaic choice as part of the capture chain: aggressive sharpening on a weak demosaic can amplify false colour; gentle processing can hide mosaic limits until you crop hard. The mosaic is a clever compromise that put colour sensors in every pocket. It remains a compromise.
Terms
- CFA
- Colour filter array: a patterned filter layer over the photosites.
- Bayer mosaic
- The common 2×2 RGGB repeating CFA pattern.
- Demosaic
- The interpolation that estimates missing colour channels at each site.
- False colour / zipper
- Artefacts where demosaic guesses fail along edges or fine patterns.
Sources
- Bayer’s original mosaic patent and later demosaicing literature describe the RGGB layout and reconstruction problem.
- Camera sensor white papers state photosite counts and CFA patterns for specific devices.
- This frame is conceptual capture literacy, not a vendor algorithm review.
Sensor check. A human editor with capture literacy verifies the Bayer mosaic definitions and rejects invented citations before this frame is listed.