💬Comments welcome. To leave a note, select any text and click the note / highlight button that pops up — or open the panel with the tab at the top-right (‹). Notes are visible only inside our private review group.
💡 In a hurry? Jump to this chapter’s 1 big lesson ↓

3.17 Downsampling and aliasing

A digital image is a sampling of a continuous scene — we record the value on a regular grid and throw away everything in between. Most of the time that is harmless. But when the scene carries detail finer than the grid can resolve, something strange happens, and it is one of the most counter-intuitive facts in imaging. The previous chapter built the Fourier machinery; sampling is the thing that machinery explains most cleanly, because a sampling grid is just a comb of evenly shifted spikes. (We treat the reconstruction / upsampling direction — putting values between samples — in the next chapter, Resampling; here the concern is what goes wrong when we throw samples away.)

3.17.1 Aliasing: a high frequency in disguise

Picture photographing a building's facade — rows of fine windows, or a striped shirt — and shrinking the result. Where the stripes are finer than the output pixels, they do not melt into a uniform gray; they reorganize into bold, wrong, low-frequency bands and swirls that are not in the scene at all: moiré. The same effect spins wagon wheels backward in old films and freezes a helicopter's rotor on video. Intuitively, when a pixel must summarize detail it cannot represent, it ought to return the local average — a neutral gray. Instead, the leftover high frequency gets misread as a low one.

The clean case is a single sine wave (Figure 3.17.1). Sample a high-frequency sine too coarsely — fewer than two samples per cycle — and the samples you collect fall into a pattern indistinguishable from a lower-frequency sine. The original travels in disguise as a different frequency; that impostor frequency is its alias. The damage is not blur (lost detail you could shrug off); it is corruption — energy that lands at the wrong frequency and masquerades as real structure. The same masquerade plays out in 2-D on a real photograph (Figure 3.17.2): a facade's regular window grid is a high spatial frequency, and sampling it too coarsely without a pre-filter folds that grid down into bold, slow moiré bands that are not in the building.

fig-aliasing
Figure 3.17.1. Sampling a sine too coarsely → aliasing. A high-frequency sinusoid (light) is sampled at too few points per cycle; the samples (dots) are consistent with a completely different, lower-frequency sinusoid (dark) — its alias. Below twice the signal's frequency (the Nyquist rate) the two are indistinguishable from the samples alone: the high frequency "folds" down and masquerades as a low one. This is the moiré / wagon-wheel effect.
fig-aliasing-photo
Figure 3.17.2. The same aliasing on a real photo. A building facade — a dense, near-periodic grid of windows, i.e. a high spatial frequency — sampled ×7 by simply dropping samples, with no pre-filter. The window frequency, above the coarse grid's Nyquist, folds back into bold, slow, curved moiré bands that are not in the building (center; zoom at the bottom). It is the one-dimensional sine of the previous figure acting in two dimensions on a real image — high frequency masquerading as low. The cure — pre-filter, then sample — is below.

3.17.2 Nyquist and the sampling theorem

The rule that prevents it is the Nyquist–Shannon sampling theorem: to represent a signal faithfully you must sample at more than twice its highest frequency. Equivalently, with a fixed sampling grid there is a top frequency — the Nyquist frequency, half the sampling rate — that the grid can represent; anything above it cannot be stored and, if present, folds (aliases) down onto a lower frequency and contaminates it. There is no recovering from aliasing after the fact: once a high frequency has folded onto a low one, the two are added together and can never be told apart.

3.17.3 Sampling in the frequency domain: spectral replicas

In the frequency domain the mechanism is vivid. Sampling on a grid is multiplying the signal by a comb of spikes, and multiplying by a comb in space replicates the spectrum — it pastes shifted copies of the signal's spectrum at every multiple of the sampling rate (Figure 3.17.3). If the original spectrum is narrow enough (band-limited below Nyquist), the copies sit side by side without touching and the original can be isolated. If it is too wide, the copies overlap, the tails fold back over the genuine low frequencies, and that overlap is aliasing. Seen this way the fix is obvious: band-limit the signal before you sample it. Run a low-pass filter — a blur — first, to delete the frequencies above Nyquist that would otherwise fold, then sample. This pre-filter (anti-aliasing) trades a little sharpness for the removal of false structure, and it is why a well-written image-shrinking routine blurs before it downsamples. The space-versus-frequency tradeoff returns: a perfectly sharp cutoff in frequency is a sinc spread out forever in space, so practical pre-filters compromise.

💡 Big lesson (L56) — sampling replicates the spectrum; aliasing is the replicas overlapping

Sampling on a grid is multiplication by a comb (a train of deltas), and a comb's Fourier transform is another comb — so sampling replicates the signal's spectrum at every multiple of the sampling rate. If the spectrum is band-limited below Nyquist the copies sit side by side and the original is recoverable; if it is not, the copies overlap, and the folded-over tails land on top of the genuine low frequencies as aliasing — energy appearing at completely wrong frequencies (moiré, the backward wagon-wheel). The cure is to band-limit before sampling: low-pass away everything above Nyquist first, then sample.

fig-sampling-comb
Figure 3.17.3. Sampling as multiplication by a comb → spectral replicas. Top: sampling in space = multiplying by a comb of evenly spaced spikes, which in frequency pastes shifted copies of the signal's spectrum at every multiple of the sampling rate. Middle: if the spectrum is band-limited below Nyquist, the copies do not touch and the original is recoverable. Bottom: if it is not, the copies overlap and high frequencies fold onto low ones (aliasing) — fixed by low-pass pre-filtering before downsampling.

3.17.4 Seeing it: sampling and pre-filtering, hands on

The cleanest way to feel all of this is to drive it. The first demo is the one-dimensional story — a single signal, your hand on the sampling rate — and the second is the two-dimensional one, the same physics on a real photograph where aliasing shows up as moiré.

[figure fig-sampling-1d-demo not built]
Figure 3.17.4. Interactive (1-D): sampling, aliasing, and the pre-filter. A continuous signal (a sine, or a sum of sines / a chirp) is shown with its samples; drag the sampling rate and watch the reconstructed signal alias to a lower frequency the moment you drop below Nyquist (two samples per cycle), with both the signal and its spectrum (the replicated spectral copies) drawn side by side. Toggle the anti-aliasing pre-filter (a low-pass blur applied before sampling) and watch the offending high frequencies removed before they can fold — the alias disappears, at the cost of a little blur. Tick marks mark the sample locations.
[figure fig-sampling-2d-demo not built]
Figure 3.17.5. Interactive (2-D): downsampling, aliasing, and the pre-filter. A high-frequency zone-plate test pattern — concentric rings that get finer toward the edge, the controllable synthetic cousin of the Prudential-facade window grid in the figure above — is downsampled by an adjustable factor, shown three ways side by side. Original: the true rings. No pre-filter: point-sampling the coarse grid folds the fine outer rings into bold, spurious moiré rosettes that are nowhere in the pattern — 2-D aliasing. With pre-filter: area-averaging each cell before decimating removes the moiré entirely, fading the unrepresentable detail to smooth grey instead. Raise the factor and the moiré grows.
Sidebar — aliasing without Fourier

You do not strictly need Fourier to feel why sampling fails. A pixel records the signal at a single point, not the average over its little footprint, so two scenes that happen to agree at every sample point produce identical images even if they differ wildly in between — a fast wiggle and a slow one can thread the same dots. The honest "what should a pixel be?" answer is the average over the pixel's area (the integral of the scene under the pixel's footprint), and computing that average is the pre-filtering blur described above, dressed in primal-domain clothes. Fourier merely turns this geometric coincidence into a precise statement about which frequencies survive.

Sidebar — aliasing on purpose

Everything so far has treated aliasing as a nuisance to be suppressed. But the same effect can be engineered to carry information. Print a fine micro-pattern, photograph it with a camera, and the camera's own pixel grid samples that pattern too coarsely — producing a moiré that is no longer in the print at all but emerges from the beat between the print's spatial frequency and the sensor's sampling grid. Because that beat pattern is exquisitely sensitive to the exact sampling geometry, it shifts dramatically with the slightest change in viewpoint — so the moiré effectively encodes the relative camera pose or motion, reading out information that the bare pixels never recorded. MIT's KinéCam dynamic prints exploit exactly this: a static printed micro-pattern that animates and reports camera motion entirely through engineered moiré (hcie.csail.mit.edu/research/kinecam). It is the same physics as the wagon wheel and the striped shirt, turned from a bug into a channel — and it rhymes with the structured / coded patterns that recur elsewhere in the book.

3.17.5 The ideal reconstruction filter: sinc, and why it is unreachable

The deepest reconstruction filter, the one Nyquist's theorem secretly invokes, is the sinc: in the frequency domain it is a perfect box — keep everything below Nyquist, kill everything above, with a vertical wall in between. The sinc reconstructs a band-limited signal exactly. But that vertical frequency wall costs a kernel that ripples on forever in space (the space–frequency tradeoff again), and infinitely wide kernels are neither practical nor well-behaved — they ring. So real systems use approximations to the sinc with finite support (Figure 3.17.6), each striking its own bargain between losing a little mid-frequency contrast and letting a little high-frequency aliasing through. We will meet the practical menagerie — bilinear, bicubic, Lanczos — in the resampling chapter; here the point is only that the ideal exists, that it is unreachable, and that every real filter is a compromise away from it.

fig-sinc-vs-practical
Figure 3.17.6. Ideal sinc vs a practical filter, in both domains. Top row (space): the ideal sinc reconstruction kernel ripples on forever, while a practical filter has finite support. Bottom row (frequency): the sinc is a perfect box — flat passband, vertical cutoff at Nyquist, zero beyond — whereas the practical filter rolls off gradually, slightly softening mid-frequencies and leaking a little past Nyquist. The vertical wall in frequency is exactly what forces the infinite ripple in space.

Recap: big lessons of this chapter optional

(L56) — sampling replicates the spectrum; aliasing is the replicas overlapping

Sampling on a grid is multiplication by a comb (a train of deltas), and a comb's Fourier transform is another comb — so sampling replicates the signal's spectrum at every multiple of the sampling rate. If the spectrum is band-limited below Nyquist the copies sit side by side and the original is recoverable; if it is not, the copies overlap, and the folded-over tails land on top of the genuine low frequencies as aliasing — energy appearing at completely wrong frequencies (moiré, the backward wagon-wheel). The cure is to band-limit before sampling: low-pass away everything above Nyquist first, then sample.