SEARCH THE LAB

What are you looking for?

ScienceReview information not provided

Every Pixel Records Only One Color: Why Demosaicing Can Only Guess

Review information not provided · 3 min

Hold a phone up close to a finely striped shirt, or shoot a window screen or a distant tiled roof from a few meters away, and when you zoom in on playback yo…

Every Pixel Records Only One Color: Why Demosaicing Can Only Guess

Hold a phone up close to a finely striped shirt, or shoot a window screen or a distant tiled roof from a few meters away, and when you zoom in on playback you will often see red and green patches that should not be there, with jagged colored fringes along the edges. Most people first suspect a dirty lens or a poor algorithm, but the starting point is how the sensor records color.

Common color sensors do not measure red, green, and blue at every point at once. For cost and light throughput, they place only one color filter in front of each photosensitive site, making that site sensitive to just one color channel, and then arrange them alternately in a fixed pattern: green sites make up about half, red and blue about a quarter each. The raw data this yields is a color mosaic in which each position holds only one of the three channels and the other two are missing.

The interpolation the camera performs next is a guess at those gaps: using known neighboring points to infer the missing channels. A guess necessarily carries assumptions, and a typical one is that color changes gently within a small region while brightness is allowed to change sharply. That assumption holds in most natural scenes, because object colors usually occur in patches, while texture and edges show up mostly in luminance.

Breakdown happens when the spatial frequency of the pattern approaches the sampling density of the color filter array. Fine stripes, window-screen grids, and dense distant roof tiles all fall into this high-frequency category. Once color information is undersampled, high-frequency luminance detail aliases into the chroma channels, and interpolation then misreads light and dark stripes as color stripes, producing spurious red-green or blue-purple colors; at strong edges the inferred results of the different channels fail to line up, leaving colored jagged edges. This is a problem at the sampling level: a smarter algorithm only changes the way it goes wrong, because the two missing channels were never actually measured.

This also explains why devices differ so much: some use more elaborate priors, some add anti-aliasing filters in front of the sensor, and some rely on multiple frames with tiny shifts to supplement sampling. The trade-off is always there — smoothing chroma harder reduces false color, but it also washes out fine colored texture; keeping more high frequency keeps edges sharper, and false color surfaces more readily.

What makes this defect tolerable is that the human eye's ability to resolve color detail is inherently lower than its ability to resolve light and dark. Engineering therefore dares to deliberately lower chroma resolution, accepting blurry colored edges in exchange for smaller files. The standard of 'good enough' here comes from vision, not from physical truth.

One limitation must be stated: not all color anomalies come from this step. Lens chromatic aberration leaves purple fringing at high-contrast edges, chroma downsampling during compression blurs small red text, and the colored ripples seen when photographing a screen also overlay moiré from the display's pixel grid. A simple control is to change distance and angle and take several shots: if false color appears periodically only at a certain distance range and vanishes when you change the angle, it looks more like sampling aliasing; if a fixed color appears at the same spot at any distance, it is more likely a stain or a dead pixel.

So this kind of false color is not a case of 'the camera not being clever enough'; it is that the information in three channels is inherently insufficient to reconstruct the true spectrum of every point. An algorithm can only choose among priors; it cannot conjure data that was never measured.