Every pixel in a typical camera photo shows a full color: some amount of red, some green, some blue. The sensor measured only one of those three at each spot. The other two were estimated from the neighbors, a process called demosaicing, and in a simple simulation of it, a pattern of fine black and white stripes came out as red, orange and yellow, with no gray anywhere. That guessing step is why a 24-megapixel camera doesn’t record 24 million full-color measurements, and why some fabrics shimmer with rainbow patterns in photos. The figures below come from Python simulations of a sensor’s color filter and its processing, alongside documentation from microscopy imaging specialists and the original 1976 patent.
Every pixel is colorblind
Photodiodes count light
Evident Scientific’s introduction to CMOS image sensors calls the photodiode, often referred to as a pixel, the key element of a digital image sensor. Each one converts the photons striking it into electrical charge, and a brighter spot produces more charge during the exposure.
The same page states the catch: CMOS and CCD integrated circuits are inherently monochromatic, black-and-white devices. A photodiode responds to how much light lands on it, not to what color that light is. A bare sensor takes black-and-white pictures.
Each pixel has its own amplifier
Most CMOS sensors use what the page calls active pixel sensor technology, with both the photodiode and a readout amplifier built into each pixel. That circuitry takes up room, and the light-sensitive part covers only some of each pixel’s area. The page puts this fill factor at 30 to 80 percent for CMOS sensors. Tiny lenses over each pixel, called microlenses, help focus and steer incoming light into the sensitive region so less of it lands on the wiring.

The Bayer filter
A 1976 Kodak patent
The usual answer to the color problem is a mosaic of colored filters, one over each pixel. US Patent 3,971,065, titled “Color imaging array,” was filed by Bryce E. Bayer of Eastman Kodak in 1975 and granted in 1976. Its abstract describes “luminance” elements occurring at every other position, and its description says green filters are preferred for those elements.
Half green, a quarter red, a quarter blue
The pattern repeats in 2-by-2 blocks: two green filters on one diagonal, one red and one blue on the other. Counting a simulated 64-by-64 Bayer mosaic confirmed the shares:
| Filter | Share of pixels |
|---|---|
| Green | 50% |
| Red | 25% |
| Blue | 25% |
Green gets double weight because most of the brightness detail people perceive, the luminance, sits in the green part of the spectrum, which is what Bayer’s patent assigns it to. Sharpness in a photo comes mostly from the green pixels.
What each pixel actually records
After the filter, every pixel records one number: how much red, or green, or blue light got through its own filter. A 24-megapixel sensor stores 12 million green measurements, 6 million red and 6 million blue. Every finished pixel needs all three.
Demosaicing: filling in the missing colors
Interpolating from neighbors
The survey “Mobile Computational Photography: A Tour”, by Delbracio, Kelly, Brown and Milanfar, describes this step: the camera demosaics the color filter array by interpolating red, green and blue values for each pixel from the surrounding colors. The simplest version averages the nearest pixels of each missing color. Real cameras use much smarter methods that follow edges, but the principle is the same: two of the three values at every pixel are estimates.
Where it works
The simulation fed a smooth gray gradient through a Bayer mosaic and a basic bilinear demosaic. The output had no color errors at all; the largest difference between red, green and blue in any output pixel was 0.000. Smooth areas, which make up most of most photographs, are easy to fill in because neighbors look alike.
Where it fails
The same simulation fed in the hardest possible pattern: alternating one-pixel black and white stripes, a pure grayscale image. Every blue-filtered pixel happened to sit on a black stripe, and every red-filtered pixel on a white one. The demosaiced result contained only three colors, all of them wrong:
| Output color | Red | Green | Blue |
|---|---|---|---|
| Red | 1.0 | 0.0 | 0.0 |
| Orange | 1.0 | 0.5 | 0.0 |
| Yellow | 1.0 | 1.0 | 0.0 |
No gray and no blue. Fine repeating patterns near the pixel spacing are exactly where the mosaic samples each color too coarsely, and the interpolation invents color that was never there. In real photos this shows up as rainbow moiré on finely woven fabrics, screen doors and distant brickwork. Many cameras add a slightly blurring optical filter in front of the sensor to soften such detail before it reaches the mosaic, trading a little sharpness for fewer false colors.

Light is noisy: shot noise and pixel size
Photons arrive randomly
Even a perfectly steady light delivers photons at random, so two exposures of the same gray wall don’t collect exactly the same count. For photon counting, the random variation equals the square root of the count. The resulting best-case signal-to-noise ratios:
| Photons collected | Signal-to-noise ratio | In decibels |
|---|---|---|
| 100 | 10 | 20 dB |
| 1,000 | 32 | 30 dB |
| 6,000 | 77 | 38 dB |
| 30,000 | 173 | 45 dB |
The filter throws light away
The Bayer mosaic costs light as well as resolution. A red filter passes red and blocks most green and blue, so each pixel discards roughly two-thirds of the visible light that reaches it. That is one reason monochrome sensors, with no filter, collect noticeably more light per pixel, and why astronomers and microscopists often prefer them and shoot separate exposures through color filters when they need color.
Why bigger pixels look cleaner
A larger pixel catches more photons from the same scene in the same exposure, so it sits further down that table. That is the physical reason small phone sensors struggle in dim light and why phones lean so heavily on combining several frames, the burst photography the computational photography survey describes. No amount of electronics removes noise that is built into the light itself; only collecting more light does.
Where the electrons go
Each pixel can hold only so much charge before it fills up, the point where highlights clip to pure white. The ratio between that full capacity and the noise floor sets the sensor’s dynamic range, the span from deepest usable shadow to brightest highlight in one exposure.
Rolling shutter: one row at a time
How CMOS sensors read out
Evident’s page describes the common CMOS approach: a rolling shutter exposes sequential rows of the array at different time intervals, and the readout cycle repeats until every row has been read. The top of the image and the bottom are captured at slightly different moments.
How much it bends things
A calculation for a sensor with 4,000 rows read out over 1/30 of a second gives about 8 microseconds per row. A car crossing the frame at 20 meters per second, where each pixel covers 2 centimeters of the scene, moves about 33 pixels sideways between the moment the top row is captured and the moment the bottom row is. Vertical edges lean. Propellers and guitar strings bend into impossible shapes, and a camera flash that fires partway through the readout can light only part of the frame.
Global shutters
Sensors that capture every row at the same instant, called global shutters, avoid the skew. They need extra storage inside each pixel, which costs area, light-gathering and money, so most consumer cameras use rolling readout and simply read it out faster.

What this means for photos
Megapixels are measurements, not full colors
A camera’s megapixel count is the number of photodiodes. With a Bayer filter, each records one color, and the full-color image is reconstructed. That reconstruction is excellent on most scenes and fallible on fine repeating detail.
Alternatives exist
Some sensors arrange the filters differently, and some stack light-sensitive layers to capture all three colors at every location, avoiding demosaicing altogether. Monochrome cameras with no filter at all are used in astronomy and microscopy, where every photon counts and each pixel can record full detail.
The RAW file is the mosaic
A camera’s RAW file stores the sensor’s measurements before demosaicing: one value per pixel, behind its colored filter. Photo editing software performs the interpolation when the file is opened, which is why two programs can render the same RAW file with slightly different detail and color. The JPEG a phone saves has already been through that guess, along with noise reduction and sharpening. The photo looks like a direct record of the scene, and it is built mostly from estimates about what was between the measurements.
Sources
- Introduction to CMOS Image Sensors, Evident Scientific (Microscope Resource Center): https://evidentscientific.com/en/microscope-resource/knowledge-hub/digitalimaging/cmosimagesensors
- US Patent 3,971,065, “Color imaging array,” Bryce E. Bayer, Eastman Kodak (granted July 20, 1976), Google Patents: https://patents.google.com/patent/US3971065A/en
- Delbracio, Kelly, Brown and Milanfar, “Mobile Computational Photography: A Tour” (2021), arXiv: https://arxiv.org/abs/2102.09000
