Quiz: the 2D wavelet transform

Short questions to test your understanding. Try each on paper first, then open the answer. Subbands: LL (approximation), V (high-pass along x: vertical edges), H (high-pass along y: horizontal edges), D (diagonal).


Q1. How is the 2D wavelet transform computed from the 1D one?

As for the 2D DFT.

Separably: one level of the 1D filter bank on every row (low-pass half left, high-pass half right), then on every column of the result (low top, high bottom). This gives the four subbands; further levels repeat this on LL only.


Q2. An image shows a single vertical line. Which detail band at level 1 lights up?

Along which axis does the image change?

V: the image changes along x (across the line), so the band that is high-pass along x responds. Along y the line is constant, so H and D stay near 0 (except at the line’s ends).


Q3. Compute the Haar subbands of the block \begin{pmatrix} 4 & 4\\ 0 & 0\end{pmatrix}.

LL = \tfrac12(a+b+c+d), V = \tfrac12(a-b+c-d), H = \tfrac12(a+b-c-d), D = \tfrac12(a-b-c+d).

LL = 4, V = 0, H = 4, D = 0: a horizontal edge (bright top, dark bottom) lights only H.


Q4. A 512 \times 512 image is transformed with 5 levels. How big is the final LL, and how many coefficients are there in total?

Each level halves both sides of LL.

512/2^5 = 16: LL is 16 \times 16. Total: still 512^2 = 262\,144 coefficients, a change of basis.


Q5. Why are the detail coefficients of a photograph or micrograph mostly small, with a few very large ones?

What does a detail coefficient see in a flat region, and at an edge?

Most of an image is smooth or flat locally, where the high-pass filters give near-zero output. Large details appear only where the filter covers an edge or a small structure, which is a small part of the image. The histogram is sharply peaked at 0 with heavy tails: the image is sparse in the wavelet basis.


Q6. With 3 % of the coefficients, a Haar reconstruction looks blocky and a db4 reconstruction blurred. Why?

What do the basis functions look like?

A reconstruction is a sum of the kept basis functions. Haar basis functions are piecewise-constant squares, so missing details leave square steps; db4 basis functions are smooth bumps, so missing details leave a smooth blur (with slight ringing from their small side lobes).


Q7. Keeping 5 % of the coefficients is not a compression ratio of 20. Why not?

What else must be stored?

The decoder also needs the positions of the kept coefficients (16 bits each for a 256 \times 256 image), and the values need bits too. With 8 bits per value and 16 per position, 5 % gives a ratio of about 6.7. Real codecs quantise and entropy-code to do better (compression day).


Q8. (math) Show that the 2D Haar subbands of a 2 \times 2 block form an orthonormal change of basis, by writing the four “basis images”.

Each subband value is \langleblock, basis image\rangle.

The basis images are \tfrac12\begin{pmatrix}1 & 1\\1 & 1\end{pmatrix} (LL), \tfrac12\begin{pmatrix}1 & -1\\1 & -1\end{pmatrix} (V), \tfrac12\begin{pmatrix}1 & 1\\-1 & -1\end{pmatrix} (H), \tfrac12\begin{pmatrix}1 & -1\\-1 & 1\end{pmatrix} (D). Each has squared entries summing to 4 \cdot \tfrac14 = 1, and any two have an entrywise product summing to 0 (two + and two - products). So they are orthonormal in \mathbb R^4, and the block is the sum of the subband values times its basis images.