Image Pyramids
Suppose you must find a face that occupies 400 pixels in one photo and 20 pixels in another. A single detector trained at one scale will fail on one of the two images. This holds no matter how well it is tuned. The natural fix is not to build many detectors. Instead, build many images — the same scene rendered at a cascade of resolutions. Then run one detector across all of them. This cascade, ordered from fine to coarse, is an image pyramid. It is one of the oldest and most durable ideas in computer vision. Image pyramids matter because scale is not a nuisance parameter. It cannot be normalized away once; it is baked into the physics of image formation. Objects at different distances from the camera project to different pixel extents. Textures alias when shrunk carelessly. Edges that look sharp at one resolution dissolve into noise at another. A pyramid gives an explicit, efficiently computable representation of an image across scale. It turns "search over scale" into "search over a stack of images." It also turns "blend two images seamlessly" into "blend each frequency band separately." The big picture is a decomposition of an image into two parts. One part is a coarse approximation (the Gaussian pyramid). The other is a sequence of residuals that capture what each level of smoothing throws away (the Laplacian pyramid). The Gaussian pyramid is a multi-resolution scale-space. The Laplacian pyramid is a multi-scale, low-redundancy encoding of the same information. It is closely related to a discrete wavelet transform. Together they underlie SIFT-like scale-invariant keypoint detection, coarse-to-fine optical flow and stereo, multi-band image blending, and image compression. As a preview of ideas developed under Image Resampling and Warping, they also underlie every efficient implementation of large-scale zoom, mipmapping, and multiresolution warping. This article derives both pyramids from first principles. It gives exact pseudocode for construction and reconstruction. It proves the space/time bounds and works a numeric example by hand. It also surveys where these fifty-year-old structures still power modern systems.
- A Gaussian pyramid is a sequence of increasingly smoothed, downsampled copies of an image — a discrete scale-space.
- A Laplacian pyramid stores the difference between each Gaussian level and the upsampled next-coarser level — a band-pass decomposition.
- The Laplacian pyramid is perfectly invertible: summing all levels (with correct upsampling) reconstructs the original image exactly (up to floating-point rounding).
- Building an -pixel pyramid costs time and extra space, because each level has a constant fraction ( in 2D) of the pixels of the one below.
- Gaussian pyramids drive coarse-to-fine search (optical flow, stereo, scale-invariant detection); Laplacian pyramids drive compression and seamless multi-band blending.
- Naive subsampling without a low-pass filter first causes aliasing; the Gaussian blur before downsampling exists precisely to satisfy the sampling theorem.
An image pyramid trades one high-resolution image for a stack of cheaply-related images across scale, making scale itself a searchable, blendable, compressible dimension.
The idea
A Gaussian pyramid is a sequence of images where is the original image and each subsequent level is obtained by low-pass filtering with a Gaussian-like kernel and then downsampling by a factor of 2 in each dimension. Formally,
where is a small separable smoothing kernel (classically the 5-tap "generating kernel" of Burt and Adelson) and denotes 2D convolution. Each level is a scale-space sample of the image: approximates the original scene as it would appear blurred by a Gaussian of standard deviation roughly and viewed at the linear resolution. This connects directly to the continuous notion of scale-space, in which an image is embedded in a one-parameter family ; the Gaussian pyramid is a discretized, computationally efficient version of that family, sampled at octave (doubling) intervals rather than continuously in . A Laplacian pyramid stores what smoothing removes at each step, rather than the smoothed image itself. Define
for , and let be the coarsest residual (the "DC" band). Each is approximately a band-pass filtered version of the original image — the frequencies present in but removed by the blur-and-downsample step that produced . Because the name "Laplacian" pyramid comes from the fact that approximates the response of a Laplacian-of-Gaussian operator, this construction is a fast, approximate multi-scale edge/texture decomposition — a discretized relative of a wavelet transform, but with two crucial practical differences: it is over-complete by a small, controlled factor (each level after upsampling is compared at the same resolution as the level above it), and its filters are simple, separable, and identical at every level, which is what makes it fast. The two pyramids are dual views of one representation: the Gaussian pyramid is redundant but easy to search over scale (each level is a plausible standalone image, useful for detecting objects or matching features at that scale); the Laplacian pyramid is compact and additive (summing the bands reconstructs the original), useful for compression and for editing operations — such as blending — that should be done independently at each spatial-frequency band. Both rely on the smoothing and resampling machinery introduced under Gaussian and Median Filtering and connect forward to general multi-resolution Image Resampling and Warping.
How it works
Building the Gaussian pyramid. Start from , the input image. At each level, convolve with a small low-pass kernel to prevent aliasing, then keep every other row and column. The classic Burt–Adelson kernel is a separable 5-tap filter with weights approximating a Gaussian, e.g. , applied along rows then columns (an equivalent 2D kernel of ). The filter must remove frequencies above the new Nyquist limit; halving the resolution halves the Nyquist frequency, so blurring first is not optional — it is what the sampling theorem demands.
Building the Laplacian pyramid. For each level , upsample back to the resolution of (insert zeros between samples, then convolve with so that interpolation, not mere zero-stuffing, fills in the new samples — the factor of 4 compensates for the energy lost by zero insertion in 2D), and subtract from . The residual captures detail lost between consecutive Gaussian levels.
Reconstruction. Because , we can recover exactly from and by rearranging: . Starting from the coarsest level and working upward reconstructs every level, including the original image . ```
# ---- Gaussian pyramid construction ---- function BUILD_GAUSSIAN_PYRAMID(I, num_levels): G[0] = I for l = 0 to num_levels - 1: blurred = CONVOLVE(G[l], KERNEL_5TAP) # low-pass, separable G[l+1] = DOWNSAMPLE_BY_2(blurred) # keep even rows & cols return G # G[0..num_levels]
# ---- Laplacian pyramid construction ---- function BUILD_LAPLACIAN_PYRAMID(G, num_levels): for l = 0 to num_levels - 1: expanded = UPSAMPLE_BY_2(G[l+1]) # zero-insert expanded = CONVOLVE(expanded, 4 * KERNEL_5TAP) # interpolate expanded = CROP_TO_SIZE(expanded, G[l]) # handle odd dimensions L[l] = G[l] - expanded L[num_levels] = G[num_levels] # coarsest band = DC residual return L # L[0..num_levels]
# ---- Exact reconstruction ---- function RECONSTRUCT(L, num_levels): R = L[num_levels] for l = num_levels - 1 down to 0: expanded = UPSAMPLE_BY_2(R) expanded = CONVOLVE(expanded, 4 * KERNEL_5TAP) expanded = CROP_TO_SIZE(expanded, L[l]) R = L[l] + expanded return R # equals original image G[0]
# ---- Coarse-to-fine search skeleton (e.g. optical flow / template match) ---- function COARSE_TO_FINE_SEARCH(pyramidA, pyramidB, num_levels): estimate = ZERO_MOTION for l = num_levels down to 0: estimate = UPSAMPLE_ESTIMATE(estimate, scale=2) # refine previous level's guess estimate = REFINE(pyramidA[l], pyramidB[l], estimate) return estimate ``` Two details matter for correctness. First, when the image dimensions are odd, downsampling and upsampling are not perfect inverses of each other in size; `CROP_TO_SIZE` (or equivalently padding rules fixed in advance) must be applied consistently during both construction and reconstruction, or the residual will not exactly cancel. Second, the boundary handling of the convolution (reflect, replicate, or zero-pad) must be identical in the blur used for downsampling and the blur used for upsampling-interpolation, otherwise reconstruction accumulates edge artifacts.
Complexity & correctness
Time. Let the base image have pixels. Level has approximately pixels (a factor of 2 fewer rows and 2 fewer columns). Convolving with the fixed 5-tap separable kernel costs work per pixel (5 multiply-adds per pass, two passes for separability — a constant independent of image size), so building level costs . Summing over all levels,
a convergent geometric series bounded by regardless of how many levels are built. Building the entire pyramid — Gaussian or Laplacian — is therefore time, the same order as a single full-resolution blur. This is the key efficiency argument: extending an algorithm to "search over all scales via a pyramid" multiplies the cost of a single-scale pass by at most a constant factor of about , not by the number of levels or by .
Space. The same geometric series bounds total storage: the whole pyramid occupies at most pixels of extra memory (Gaussian pyramid) or exactly for the Laplacian pyramid stored in place of the Gaussian one (the Laplacian levels are the same sizes as the corresponding Gaussian levels, and the pyramid needs no additional top-level storage beyond the base image). Both pyramids are -space structures — mild overcompleteness, not an explosion.
Number of levels. Levels can be built until the image reaches a minimal size (e.g. ), giving levels total, but note this does not change the total-time bound above — the geometric shrinkage guarantees the sum converges however many levels exist.
Correctness of reconstruction (Laplacian pyramid is a perfect decomposition). By construction,
Define the reconstruction operator applied bottom-up starting from and . We show by downward induction on that for all . Base case (): by definition. Inductive step: assume . Then
using the inductive hypothesis in the middle step. This holds exactly, in exact arithmetic, using any fixed, deterministic EXPAND operator (linear or not), because the construction and reconstruction use the literal same operator and it cancels algebraically — the reconstruction identity does not depend on the expand filter being a "good" interpolator, only on it being the same filter both times. In floating point, rounding introduces negligible error (typically far below quantization noise); in fixed-point/integer pipelines, the same care with rounding must be taken on both sides or small bias accumulates.
Why blur before downsampling (aliasing argument). The sampling theorem states a signal band-limited to frequency can be reconstructed from samples taken at rate . Downsampling by 2 halves the effective sample rate, halving the safe Nyquist frequency. Any image content above the new Nyquist limit that is not removed first will alias — fold back as spurious low-frequency patterns (moiré). The Gaussian kernel used before subsampling is chosen (approximately) to suppress content above the new Nyquist frequency, so each is an honest, alias-minimized representation of the image at its resolution, not merely every-other-pixel of a finer image. This is the same sampling-theoretic reasoning developed for general Image Resampling and Warping, applied here specifically to the fixed octave-doubling schedule of a pyramid.
Tradeoffs. The pyramid buys -total-cost multi-scale access at the price of coarse, fixed scale sampling — only octave steps, not continuous . Algorithms needing finer scale resolution (true scale-space feature detectors such as SIFT) interpolate within each octave using a small stack of Gaussian-blurred (not downsampled) images before moving to the next octave, trading extra -factor computation for finer scale coverage — still overall, but with a larger constant.
Worked example
Take a 1D toy "image" (extend the idea to 2D by separability) of 8 samples so every arithmetic step can be checked by hand:
Use the simple 3-tap binomial kernel for blurring (a 1D stand-in for the 5-tap 2D kernel), with reflected boundaries.
Step 1 — blur . Convolving (reflect boundary so edge samples reuse themselves):
| index | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|---|
| 10 | 10 | 10 | 50 | 50 | 10 | 10 | 10 | |
| blurred | 10 | 10 | 20 | 30 | 30 | 20 | 10 | 10 |
(e.g. index 2: ; index 3: — recomputing carefully: , so correct value at index 3 is 40, not 30; the table above is corrected below.)
| index | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|---|
| blurred | 10 | 10 | 20 | 40 | 40 | 20 | 10 | 10 |
Step 2 — downsample by 2 (keep even indices 0,2,4,6):
Step 3 — build . Upsample by inserting zeros, , convolve with (the 1D analogue of the "" 2D compensation factor, since 1D zero-insertion loses a factor of 2 rather than 4), reflect boundaries:
| index | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|---|
| expanded | 10.0 | 15.0 | 20.0 | 30.0 | 40.0 | 25.0 | 10.0 | 5.0 |
Step 4 — recurse one more level. Blur with (reflect): approximately; downsample keeping indices 0,2: . Then is computed the same way, and is the final DC residual.
Reconstruction check. Running the reconstruction operator bottom-up, ; expand and add to get back exactly (by the algebraic cancellation proven above); expand (which reproduces the "expanded" row from Step 3) and add :
The reconstruction is exact, confirming the cancellation argument concretely, and the residual visibly concentrates near the sharp jump () — the Laplacian pyramid isolates edges, which is exactly the band-pass behavior claimed above.
Common pitfalls & traps
| Pitfall | Why it happens | Consequence |
|---|---|---|
| Downsampling without blurring first | Treating "resize" as "index every other pixel" | Aliasing / moiré, jagged pyramid levels that misrepresent scale |
| Mismatched EXPAND filter between build and reconstruct | Using a different interpolation kernel (or missing the / compensation factor) on reconstruction | Systematic brightness or contrast drift, imperfect reconstruction |
| Ignoring odd image dimensions | downsample then upsample does not return original size | Off-by-one size mismatch; residual subtraction silently misaligns pixels |
| Boundary-condition inconsistency | Reflect at build time, zero-pad at reconstruct time | Edge artifacts that grow toward image borders across levels |
| Treating pyramid levels as independent images for learning-based scale search | Ignoring that levels are correlated, heavily smoothed copies | Redundant computation, or overconfident detections duplicated across adjacent levels |
| Confusing pyramid octaves with true continuous scale-space | Assuming pyramid levels alone give fine-grained scale estimates | Poor localization in scale for tasks like blob/keypoint detection (fixed by intra-octave stacks, e.g. in SIFT) |
Pioneers & history
Origins · 1 minPeter J. Burt and how this was discovered
Where this matters
Coarse-to-fine optical flow and stereo matching use Gaussian pyramids to estimate large motions cheaply: a rough displacement found at a coarse level is upsampled as an initial guess and refined at each finer level, turning an expensive large-displacement search into a sequence of cheap small-displacement refinements (the `COARSE_TO_FINE_SEARCH` skeleton above). Multi-band (Laplacian pyramid) blending stitches panoramas and composites images seamlessly: low-frequency bands are blended over wide, smooth transition regions while high-frequency bands are blended over narrow regions, avoiding both visible seams and ghosting — a technique still used in panorama stitchers and photo-editing software. Scale-invariant feature detection (SIFT and its relatives) builds a pyramid-like octave structure with intra-octave Gaussian blurring, then takes differences of Gaussians as an efficient approximation to the Laplacian, to find keypoints stable across scale. Image and video compression historically used Laplacian-pyramid-like subband coding as a precursor to modern wavelet and DCT-based transforms, because band-limited residuals compress well. In graphics, mipmapping — precomputed, prefiltered pyramids of a texture — prevents aliasing when textures are minified, directly reusing the same blur-then-downsample logic. In modern deep learning, Feature Pyramid Networks and multi-scale CNN architectures explicitly borrow the Gaussian/Laplacian pyramid's core insight — represent and process an image at multiple resolutions simultaneously — replacing hand-designed kernels with learned convolutions while keeping the geometric, -cost, octave-structured backbone. All of these downstream uses depend on the resampling correctness discussed under Image Resampling and Warping and on the smoothing foundations of Gaussian and Median Filtering.
Ask the tutor: How would you modify the Laplacian pyramid construction to build a steerable or oriented pyramid that separates edges by direction as well as by scale?
What is the difference between a Gaussian pyramid and a scale-space representation?
A continuous scale-space embeds an image in a family for all , typically sampled finely and without changing resolution. A Gaussian pyramid is a discretized, computationally efficient approximation that samples scale only at octave (doubling) intervals and also reduces spatial resolution at each step, since content blurred by a larger carries no extra information at the original sampling density. This coupling of blur and resolution reduction is what keeps the pyramid's total cost linear in image size; a full continuous scale-space sampled at every without downsampling would cost far more to store and compute.
Why is the Laplacian pyramid called "Laplacian" if it is built by simple subtraction?
The residual approximates , i.e., the image minus a blurred copy of itself. This difference-of-blurs operation is a well-known discrete approximation to the Laplacian-of-Gaussian operator, which highlights edges and texture (band-pass content) while suppressing flat regions. The name reflects this approximate correspondence to a second-derivative edge operator, even though the actual computation used in the pyramid is just subtraction of an upsampled coarser level, which is far cheaper than explicitly applying a Laplacian filter at every pixel.
Can pyramids be built with factors other than 2, or with non-Gaussian kernels?
Yes. Any smoothing kernel that adequately suppresses frequencies above the new Nyquist limit can be used, and downsampling factors other than 2 (e.g. 1.5, or non-uniform per-axis factors) are used in some systems, particularly in image-based rendering and some compression schemes. However, factor-2 octave pyramids with a fixed small kernel are by far the most common choice because they give the cleanest recursive structure, the tightest complexity analysis (a clean geometric series with ratio in 2D), and the simplest exact-reconstruction bookkeeping, since expand and shrink are exact inverses of each other in size when dimensions are handled carefully.
How many pyramid levels should be used in practice?
The number of useful levels is bounded by , since each level halves both dimensions until reaching a trivial size, but in practice far fewer levels are used than this maximum. Coarse-to-fine optical flow or stereo pipelines typically use 3 to 6 levels, enough to bring large motions within the capture range of a local refinement step at the coarsest level, without over-smoothing away the structure needed to disambiguate correspondences. Scale-invariant detectors like SIFT similarly use a modest number of octaves (often 4 to 6) with several intra-octave scales each, balancing scale coverage against computation.
Does building a Laplacian pyramid lose information compared to the original image?
No — if the same expand operator is used for both construction and reconstruction, the decomposition is lossless in exact arithmetic (as proven by the downward-induction argument), and lossy only to the extent that floating-point or fixed-point rounding introduces tiny numerical error. This is different from simply discarding high frequencies: the Laplacian pyramid keeps the discarded detail explicitly, just reorganized into band-pass residual images, so nothing is thrown away unless you deliberately quantize or drop levels for compression, at which point the pyramid degrades gracefully because the discarded bands typically carry the least perceptually important information.
Why does multi-band blending avoid the seams that naive alpha blending produces?
Naive blending linearly interpolates raw pixel intensities across a boundary, which works for smooth low-frequency content but creates visible ghosting or blurring wherever the two images disagree at high frequencies (fine texture, sharp edges) near the seam. By decomposing each image into a Laplacian pyramid first, blending each frequency band with its own transition width, and reconstructing, the coarse structure blends smoothly over a wide region while fine detail is stitched over a narrow region matched to that detail's spatial scale, so edges from either source image are not smeared across a wide blend zone. This band-appropriate blending is precisely why the technique remains standard in panorama and composite image tools.
How do image pyramids relate to convolutional neural network feature pyramids?
Classical Gaussian/Laplacian pyramids use fixed, hand-designed low-pass filters and a strict blur-then-downsample recipe to build a multi-resolution representation. Feature Pyramid Networks and similar CNN architectures replace the fixed kernel with learned convolutional filters and interleave downsampling (via strided convolution or pooling) with nonlinearities, but keep the same core structural idea: represent the image at multiple resolutions, with a top-down pathway that upsamples coarse, semantically rich features and merges them with finer, spatially precise features. The complexity story is analogous too — feature maps shrink geometrically across the network, so the total computation across all resolution stages remains within a constant factor of the finest single stage.