Code
Code
Images replaced for licensing. The book is published under a CC BY-NC-ND license, which covers only the book as a whole and not its individual images, so this page does not republish the book’s photographs. License-free images stand in for them:
- The coffee photograph with added noise (scikit-image) stands in for a noisy photograph of a stop sign (Figure 17.1).
- The cameraman photograph blurred to sigma=2 (scikit-image) stands in for a photograph of a zebra blurred to sigma=2 (Figure 17.4).
- A block portrait built from the astronaut photograph (scikit-image) stands in for Harmon and Julesz’s block portrait of Lincoln (Figure 17.5).
- The coffee photograph (scikit-image) stands in for a photograph of a boat (Figure 17.8).
Code
Code
Noise removal versus detail loss
A blur filter replaces each pixel with a weighted average of its neighbors. Averaging suppresses zero-mean noise, because the fluctuations cancel, but it also smears genuine high-frequency detail. That is the central tradeoff of the whole chapter. Figure 17.1 makes it visible: additive noise is largely gone after a average, at the cost of sharpness. The book uses a noisy photograph of a stop sign; here noise is added to a color test photograph.Code
Code
Code
Code
The box filter
The 2D box (moving-average) kernel keeps a constant weight inside a rectangular window and zero outside: To keep average brightness unchanged the kernel must have DC gain 1, i.e. its coefficients sum to 1, so you divide by . The box is separable: , a full-window rectangle equals a horizontal bar convolved with a vertical bar. Choosing or blurs along a single axis, as the middle and right panels of Figure 17.2 show.Code
Code
Code
Code
The box filter’s frequency response is not monotonic
The discrete-time Fourier transform of a length- box is a Dirichlet (aliased-sinc) kernel. Because a sinc oscillates, the box’s frequency response has side lobes: some high frequencies are passed with more gain than lower ones, and the sign flips lobe-to-lobe. A good low-pass filter should instead fall off monotonically. That is the motivation for the Gaussian and binomial filters below.Code
Code
The Gaussian filter
The Gaussian is the canonical isotropic blur. Continuous form: You discretize the Gaussian by sampling on the integer grid and renormalizing to unit sum. Samples beyond are negligible, so a radius of suffices. The Gaussian is the only circularly symmetric kernel that is also separable: . Filtering with two 1D passes costs per pixel instead of .Code
Code
Code
Code
Properties of the Gaussian
- Its Fourier transform is another Gaussian, , which is monotonically decreasing, with no side lobes (contrast Figure 17.3b). A wider Gaussian in space is a narrower one in frequency.
- Composition adds variances: with . Blurring twice is blurring once by a larger .
Code
Code
Code
Code
Blur as a perceptual low-pass: the block portrait
Harmon and Julesz’s famous demonstration: a face quantized into coarse blocks is hard to read, because the block edges inject high-frequency energy that the visual system latches onto. Low-pass filtering (a Gaussian blur, or simply squinting) removes those spurious high frequencies and the face re-emerges. The book shows the original block portrait of Lincoln. Below you build a block portrait from a photograph by averaging it over blocks, then blur it.Code
Code
Binomial filters
A binomial filter is what you get by convolving the elementary two-tap averager with itself times. The coefficients are the -th row of Pascal’s triangle: Key facts (discrete analogues of the Gaussian’s):- DC gain , so normalize by .
- Variance .
- Composition: and .
- The Fourier magnitude is zero-phase and monotonic: a discrete filter with no side lobes.
Code
Code
2D binomial filters and perfect cancellation of the checkerboard
By separability the 2D binomial is the outer product , i.e. The highest representable frequency is the alternating wave . Convolving it with gives , so the binomial annihilates the checkerboard exactly. The box leaves a residual . Figure 17.8 shows this on an image corrupted by a checkerboard pattern. The book uses a photograph of a boat.Code
Code
Code
Code
Binomials converge to the Gaussian
Repeatedly convolving is repeated averaging, so by the central limit theorem the normalized binomial approaches a Gaussian of variance as grows. This is why small binomials (e.g. , ) are the standard cheap, integer-arithmetic Gaussian approximations used in image pyramids.Code
Code
Concluding remarks
Three blur filters, one theme, a low-pass average:
The box is fast but its ripples pass spurious high frequencies. The Gaussian is the ideal isotropic low-pass and composes cleanly under addition. The binomial is the practical, integer-arithmetic bridge, a discrete filter that keeps the Gaussian’s good behavior and, by the central limit theorem, becomes a Gaussian in the limit. These are the building blocks for downsampling, upsampling, and image pyramids in the chapters that follow.
Found an error on this page? Report an issue.

