Skip to main content
Open In Colab This section was written by Kaushik Kachireddy (pull request #79), with help from an AI coding agent (Claude Code) on the code. It reproduces the ideas of Chapter 27 of Foundations of Computer Vision by Antonio Torralba, Phillip Isola, and William T. Freeman. The book’s own figures are not reproduced here, because the book’s license covers only the work in full; links point to them instead. Natural images are a vanishingly small, highly structured corner of the space of all pixel arrays. This section measures that structure and builds generative priors from it: the 1/f power law, sampling clouds from it, why an independent-pixel model fails, the decay of pixel correlations, the heavy-tailed (generalized-Laplacian) statistics of derivatives, and how those priors drive denoising: Wiener filtering, wavelet coring, and non-local means. The book measures these statistics on its own photographs. Here the measurements run on scikit-image test photographs (an astronaut, a rocket, a coffee cup, the cameraman, a cat, a clock, grass, and a Hubble deep field) and on generated images, and each figure links to the book’s version. The statistics are properties of natural images in general, so they come out the same.
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:If you use the book for non-commercial purposes, you can swap the originals back in: each line that loads a stand-in carries the original’s link in a comment.

The 1/f power law

The single most robust statistic of natural images: the Fourier magnitude falls off as a power law in radial frequency, ∥L(u,v)∥  ≃  1wα,w=u2+v2,  α≈1 to 1.5.\lVert\mathscr L(u,v)\rVert \;\simeq\; \frac{1}{w^{\alpha}},\qquad w=\sqrt{u^2+v^2},\ \ \alpha\approx 1\text{ to }1.5. Three real photos concentrate their energy (the book’s version is Figure 27.10) at low frequency and their angular-averaged spectra hug the 1/w1.51/w^{1.5} curve; white noise is flat: no power law at all.
Output from cell 6

Sampling from the power spectrum

A Gaussian image prior with a 1/(1+wα)1/(1+w^{\alpha}) power spectrum is easy to sample: take that magnitude, attach random phase, and inverse-transform. The result has the right spectral falloff but no real structure: it always looks like clouds, in grayscale or (sampling each channel) in color.
Output from cell 8

The independent-pixel model

The simplest model treats every pixel as an independent draw from one histogram. Sampling from it keeps the image’s color and intensity distribution exactly but destroys all spatial arrangement: the sample is just noise with the right histogram. It only ever looks right for images that are essentially unstructured, like a star field. The book’s version is Figure 27.6.
Output from cell 10

Pixel correlations decay with distance

Neighboring pixels are highly correlated; the correlation falls as they move apart. Scatter plots of ℓ[n]\ell[n] vs ℓ[n+d]\ell[n+d] tighten around the diagonal for small dd and spread out for large dd (the book’s version is Figure 27.8).
Output from cell 12

Derivatives are heavy-tailed, not Gaussian

The histogram of raw intensities is broad and near-uniform, but the histogram of image derivatives is sharply peaked at zero with heavy tails: most of an image is smooth (derivative ≈0\approx 0) with rare large jumps at edges. On a log scale the derivative histogram is a cusp, nothing like a parabola (Gaussian).
Output from cell 14

The generalized Laplacian

Derivative statistics are fit by the generalized Laplacian p(x)∝exp⁡ ⁣(−∣x/s∣ r),p(x)\propto \exp\!\big(-|x/s|^{\,r}\big), with r ⁣= ⁣2r\!=\!2 Gaussian, r ⁣= ⁣1r\!=\!1 Laplacian, and r∈[0.4,0.8]r\in[0.4,0.8] for natural images: sharper peak, heavier tails than a Gaussian.
Output from cell 17

[1,-1] statistics: noise stays Gaussian, images do not

Following the book (Figure 27.16), three ‘visual worlds’, Gaussian noise, a photograph of a clock, and a grass texture, are each shown with the image, its intensity histogram, its [1,−1][1,-1] derivative, and the derivative histogram (red) with the best Gaussian fit (black). The derivative of noise stays Gaussian; both photographs give the same sharply peaked, heavy-tailed shape that the Gaussian fit misses.
Output from cell 19

Denoising with the Gaussian (1/f) prior: the Wiener filter

Under a Gaussian prior with power spectrum S(w)=A/w2αS(w)=A/w^{2\alpha} and white noise of variance σ2\sigma^2, the MAP estimate is the Wiener filter L(w)=S(w)S(w)+σ2 Lg(w),\mathscr L(w)=\frac{S(w)}{S(w)+\sigma^2}\,\mathscr L_g(w), which keeps low frequencies (where the image dominates) and suppresses high frequencies (where noise dominates). The book’s version is Figure 27.14.
Output from cell 21

Wavelet denoising as coring

With a Laplacian prior on a band-pass coefficient and Gaussian noise, the MAP estimate shrinks small coefficients toward zero and leaves large ones almost untouched: a coring curve. Small (probably-noise) responses are cored out; strong (probably-signal) responses survive.
Output from cell 24

Non-local means

Rather than a parametric prior, non-local means denoises each pixel by averaging other pixels whose surrounding patch looks similar: a nonparametric image model. It exploits the self-similarity (repeated structure) of natural images. The book’s version is Figure 27.23.
Output from cell 26

More representations from the chapter

The figures above cover the chapter’s core arc. Below are several more of the book’s representations that are worth reproducing: the space of visual worlds (27.2), the dead-leaves generative model (27.9), the role of Fourier phase (27.12), a Gaussian texture model (27.13), and how the prior shapes reconstruction (27.19) and wavelet coefficient estimation (27.20).

Eight visual worlds

Different sources of images (noise, an oriented Gabor, a Mondrian, a star field, clouds, lines, rendered graphics, a photograph) occupy very different regions of image space, each with its own statistics. A single model cannot fit them all. The book’s version is Figure 27.2; here the eight are generated or taken from test images.
Output from cell 29

The dead-leaves model

A simple generative model of natural images: repeatedly drop opaque colored shapes (disks and squares) of random size, each occluding what is beneath. Like the book (Figure 27.9), the figure shows a disk version and a square version. Occlusion alone reproduces hallmarks of natural-image statistics: scale-invariant structure and a heavy-tailed derivative histogram.
Output from cell 31

Matched Fourier magnitude: phase carries the structure

The 1/f power spectrum (27.10) fixes the Fourier magnitude. But the magnitude alone does not make an image look like anything: keep each image’s magnitude and replace its phase with random phase, and the recognizable content dissolves into 1/f texture. It is the phase that encodes edges and objects. The book’s version is Figure 27.12.
Output from cell 33

A Gaussian texture model

The fully second-order (Gaussian) model of a texture keeps only the mean and the power spectrum, and draws a sample with random phase. The book shows this on hair; here it runs on grass, another oriented texture. The model captures the dominant orientation and scale, but having thrown away the phase, it cannot reproduce the individual blades; the sample looks like a phase-scrambled version.
Output from cell 35

The prior decides how a reconstruction looks

Reconstructing a 1-D signal from noisy samples: a Gaussian (L2) smoothness prior penalizes all differences quadratically and rounds off the edges; a heavy-tailed (total-variation) prior tolerates a few large jumps, so it keeps edges sharp while flattening the noise: the 1-D analogue of edge-preserving image denoising.
Output from cell 37

Prior × likelihood = posterior for a wavelet coefficient

Estimating a single band-pass (wavelet) coefficient from a noisy measurement: the heavy-tailed prior (peaked at 0) multiplied by the Gaussian likelihood (centered on the noisy observation) gives a posterior whose peak is pulled back toward zero. Small coefficients are shrunk to (near) zero and large ones are kept: exactly the coring nonlinearity of 27.21.
Output from cell 39

Concluding remarks

Natural images occupy a tiny, structured sliver of image space. Measuring that structure, a power law here, heavy-tailed derivatives there, gives priors that turn ill-posed problems (denoising, inpainting, super-resolution) into tractable Bayesian estimates, and sets the stage for the learned generative models later in the book.