Skip to main content
Open In Colab This section was written by Kaushik Kachireddy (pull request #80), with help from an AI coding agent (Claude Code) on the code. It reproduces the ideas of Chapter 28 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. A texture is an image made of many similar elements: what matters is the statistics of the elements, not their individual identity. This section builds the book’s tools: generating an “infinite” texture by cropping, Heeger-Bergen synthesis by matching histograms of a multiscale decomposition, and Efros-Leung synthesis by copying pixels from matching neighborhoods. The book demonstrates these on its own photographs of plums, a zebra, pebbles, and a stone wall. Here the same methods run on scikit-image test images (a stained-tissue image with blob-like cells, bricks, and gravel) and on a generated pattern of circles, and each figure links to the book’s version.
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.

An ‘infinite’ texture by cropping

Because a texture is stationary, meaning its statistics are the same everywhere, you can generate endless new samples of it simply by cropping different windows from one large reference. Each crop looks like a different image of the same stuff. The book shows this on a photograph of plums. Output from cell 4

Texture = statistics: the Heeger-Bergen method

Heeger & Bergen model a texture by the histograms of a multi-scale, multi-orientation decomposition (a steerable pyramid) plus the pixel histogram. To synthesize, start from white noise and repeatedly force those histograms to match the reference. The code uses an isotropic Laplacian pyramid in place of the steerable pyramid, the same histogram-matching idea, and decorrelate color with PCA (as the book does), so the synthesis keeps the reference’s colors instead of turning to rainbow noise.
Output from cell 6

Watching the synthesis converge

Starting from white noise, each round of histogram matching pushes the sample closer to the reference’s statistics. After a handful of iterations the noise has become a convincing texture.
Output from cell 9

Histogram matching a single subband

The core operation: a band-pass subband of a texture is heavy-tailed (Laplacian-like), while a subband of white noise is Gaussian. Histogram matching is a pointwise monotonic map that turns the Gaussian subband into the texture’s heavy-tailed one.
Output from cell 11

Efros-Leung: the context window controls everything

Efros & Leung grow a texture one pixel at a time: for each new pixel, search the sample for neighborhoods (an w×ww\times w window) similar to the already-synthesized context, and copy a matching center pixel. A small window reproduces local detail but loses the layout; a large window preserves the regular arrangement.
Output from cell 14

Efros-Leung on a natural texture

On a natural texture, a large enough context grows a larger image that preserves the pebble structure: coherent elements, not just matched statistics (contrast the Heeger-Bergen output above, which scrambles the arrangement).
Output from cell 16

Concluding remarks

Texture is captured by statistics of local elements. Parametric (Heeger-Bergen) and nonparametric (Efros-Leung) synthesis trade speed against structural fidelity: the same tension that later reappears in learned (GAN / diffusion) texture and image models.