Skip to main content

How Digital Cameras Turn Light Into Photos

Your camera's sensor is colorblind — it only counts photons. Discover how the Bayer mosaic, demosaicing, and clever math turn raw light into full-color photos.

By FactSpire Editorial7 min read
Extreme macro of a camera sensor chip with light rays striking it

Key takeaways

  • Camera sensors are colorblind: each photosite only counts photons via the photoelectric effect, reporting a single brightness number at 12 to 14 bits of precision.
  • The Bayer mosaic covers the sensor in a repeating pattern of 50% green, 25% red, and 25% blue micro-filters, mirroring the human eye's peak sensitivity to green light.
  • Demosaicing reconstructs full color at every pixel by interpolating its neighbors — two-thirds of each pixel's final color is effectively invented by math.
  • Steven Sasson's first self-contained digital camera at Kodak in 1975 weighed 8 pounds, captured 0.01-megapixel black-and-white images, and took 23 seconds to save one frame to cassette tape.

Here is the secret no one tells you when you buy a camera: the sensor inside it cannot see color. Not a hint. Every photosite — every one of the millions of tiny light detectors under the lens — reports exactly one number: how much light fell on it. Brightness, and nothing else. Left alone, the most expensive camera on Earth would hand you nothing but a grayscale image. The color in your photos is not captured. It is computed. Understanding how light becomes a photo means following a chain of three inventions: silicon that counts photons, a checkerboard of micro-filters that cheats color into the picture, and mathematics that invents the rest.

Why is your camera's sensor colorblind?

A photosite is a small well of silicon. When photons strike it, they knock electrons loose through the photoelectric effect — the same phenomenon Einstein explained in 1905. The more light lands on the well during the exposure, the more electrons accumulate. The camera reads that charge out as a single value, usually across 12 or 14 bits: between about 4,000 and 16,000 steps from pure black to clipped white. But an electron is an electron. A red photon and a blue photon each land as charge with no label attached, so the raw signal carries no way to tell them apart. Silicon responds to a broad band of wavelengths — stretching well past visible light into the near infrared — and lumps all of it into one running total. Whether the chip is CMOS, as in essentially every current camera, or the older CCD, the principle is identical: one photosite, one number, one shade of gray. That reading happens astonishingly fast. In a CMOS sensor — the dominant design today — each pixel carries its own readout circuitry (a few transistors) so every photosite can be measured and reset right where it sits. A CCD instead works like a shift register, passing each pixel's charge down the row to a single amplifier at the edge. CMOS won because it is cheaper, faster, and sips power — the reason your phone can shoot 4K video without melting. Before any of that charge gets measured, though, a microscopic dome called a microlens sits over each pixel and funnels incoming light away from the pixel's dead circuitry and into its active area, dramatically improving sensitivity in dim scenes. For a look at how the chip talks to the rest of your device, see how the glass over the sensor's display cousin registers your finger.

How does a checkerboard of tiny filters fix the colorblindness?

Advertisement

Since the sensor cannot see color, the camera introduces color before the light ever reaches the silicon. The trick is the Bayer mosaic, invented at Kodak by engineer Bryce Bayer: a grid of microscopic red, green, and blue filters laid over the pixel array so that each photosite peers through exactly one color. The pattern repeats in 2×2 blocks containing one red, one blue, and two green filters. That doubled green is deliberate — human vision is most sensitive to green wavelengths, and green carries the bulk of the luminance detail that makes an image look sharp. So half of every image you take was recorded through green filters, and only a quarter each through red and blue. This is where the mathematics begins. After the exposure, each pixel holds only one color's brightness. To produce a full-color photograph, the camera's processor performs demosaicing: it looks at each pixel's neighbors and interpolates the two missing colors. A pixel that measured red guesses its green and blue from the surrounding green and blue sites, and vice versa. In other words, at every point in your photo, two-thirds of the color information was never measured at all — it was inferred from the neighborhood. The algorithms are sophisticated enough that you never notice, but the color you see is, strictly speaking, an educated guess confirmed by its surroundings.

How does light become a number the computer can store?

Follow a single photon's journey. It passes through the lens, the infrared-blocking filter, the microlens, and its assigned Bayer color filter before dislodging electrons in the photodiode below. The accumulated charge is then converted by an analog-to-digital converter (ADC) into a number — 0 for pure black, maximum value for clipped white, with thousands of steps between. Exposure controls are really just ways of tuning this counting. A longer shutter speed gives photons more time to pile up electrons; a wider aperture funnels more photons per instant onto each well; ISO gain amplifies the electrical signal after the fact, which is why high-ISO shots look grainy — you are amplifying the noise along with the signal. Every slider in your camera app is a negotiation with the physics of photon counting.

Advertisement

That grid of numbers is the RAW image: 12 to 14 bits of brightness data per photosite, exactly as measured. It looks dull and flat on screen because it has not been interpreted yet. The camera's image processor then runs its development pipeline — demosaicing, white balance, noise reduction, tone mapping, sharpening, and color enhancement — essentially developing your photo like film, but in a fraction of a second. (The math that separates signal from sensor noise is a distant cousin of the trick noise-cancelling headphones use to erase the world around you.) Smartphones go further with computational photography, firing off several frames and fusing them into one image to extend dynamic range beyond what any single exposure could record. The mathematics of reconstructing signals from incomplete data shares DNA with this trick: guess well, and nobody can tell the difference.

How did a camera the size of a toaster start all this?

The first self-contained digital camera was built at Kodak in 1975 by 24-year-old engineer Steven Sasson, who had been asked to explore a newfangled charge-coupled device. The prototype weighed 8 pounds (3.6 kilograms), cobbled together from a Super 8 camera lens, a Fairchild CCD sensor with just 100×100 pixels (0.01 megapixels), sixteen nickel-cadmium batteries, and a digital cassette recorder. Capturing one black-and-white frame and saving it to tape took 23 seconds, and viewing it required a separate custom box connected to a television. When Sasson demonstrated it inside the film giant, the reaction was famously chilly: in his words, management found it cute but asked him not to tell anyone about it. The prototype stayed confidential — it was not publicly disclosed until a Kodak presentation in May 2000 — though the company did patent its architecture (U.S. patent 4,131,919), an arrangement where the sensor reads out into a temporary buffer and then writes to slower storage, which modern cameras still use. Digital photography did not reach consumers in force until the early 1990s, but every megapixel since then descends from that clunky box. The poetry is hard to miss: a company that defined film built the machine that would end it, then hesitated. But Sasson's own 1977 technical report shows he understood exactly what he had made — a system that, with improvements in technology, could substantially change how pictures are taken. The next time you tap the shutter, remember what is actually happening in that split second: millions of silicon wells counting photons one electron at a time, a checkerboard of filters rationing color to each well, and mathematics weaving those lonely numbers into the sunset you thought you were photographing. The camera does not record the world. It measures the light, guesses the colors, and shows you something so convincing you never ask how it knew.

Advertisement

Frequently asked questions

Why do camera sensors use twice as many green filters?

The human eye is most sensitive to green light, and green carries most of the luminance (brightness and sharpness) detail in an image. The 2:1:1 green-red-blue ratio mirrors that biology.

What is the difference between CMOS and CCD sensors?

A CCD sensor shifts each pixel's charge off-chip through a serial readout, while a CMOS sensor reads and amplifies every pixel on the chip itself. Essentially all current cameras and phones use CMOS.

What is a RAW photo file, really?

A RAW file is the sensor's unprocessed brightness data — typically 12 to 14 bits per photosite — recorded before demosaicing and processing. It preserves far more tonal detail than a finished JPEG.