What is a Bayer matrix? Understand the Bayer pattern, RGGB filter, and demosaicing process with visual examples. Learn how digital cameras capture color using this essential image sensor technology.
If you own a digital camera, smartphone, or any device that takes photos, you have the Bayer matrix to thank for those sharp, colorful images. Many people wonder how a camera sensor captures full color when each tiny pixel can only detect one color of light at a time. The answer is the Bayer matrix, also known as the Bayer filter or Bayer color filter array.
In this post, we break down exactly what a Bayer matrix is, how it works inside your camera, and why it remains the standard in digital photography. We include clear visual examples so you can see the pattern in action.
A Bayer matrix is a special arrangement of red, green, and blue color filters placed over the light-sensitive pixels on a digital image sensor. Each pixel on the sensor records only the brightness of one color.
The design mimics human vision. Our eyes are more sensitive to green light, so the pattern includes twice as many green filters as red or blue ones.
Think of the Bayer matrix as a mosaic of tiny colored glasses laid over millions of pixels. Without it, your camera would only capture black-and-white images.
Bryce Bayer, an engineer at Eastman Kodak, invented this pattern in 1976. His goal was to create a practical way for single-chip sensors to capture color images without needing three separate sensors.
Today, nearly every digital camera and smartphone still uses a variation of this design.
The standard Bayer matrix repeats a simple 2×2 block:

This pattern is called RGGB:
It tiles across the entire sensor.
Imagine zooming into your camera sensor. Each square represents one pixel covered by a color filter. Each pixel records only one color channel’s brightness (R, G, or B), not full color.
Human eyes detect detail best in green wavelengths. So:
When light hits the sensor:
The result is a raw mosaic image, not a full-color photo.
Software reconstructs the full image using a process called demosaicing.

Each pixel borrows missing color data from neighbors to create a complete RGB image.
In the image above, the left side represents the Bayer-mosaic data; the right side shows the reconstructed full-color image after demosaicing.
Light passes through:
To visualize the layers, here’s a clear public-domain/CC example:


Raw files show this grid before processing.
Some alternatives include:
But Bayer remains dominant.
Understanding the Bayer matrix helps you:
The Bayer matrix is one of the most important innovations in digital photography. It quietly powers every image you take.
Next time you click a photo, remember the invisible pattern working behind the scenes.
If you're experimenting with patterns and textures, tools like Bitgrain can help you visualize grain and dithering effects directly in the browser.