Quiz: filter banks and Daubechies wavelets
Before this unit: Localised basis functions and the Haar transform (previous unit); Day 1: Images, filters and frequencies.
See also: Day 3: Bit depth and noise.
Short questions to test your understanding. Try each on paper first, then open the answer. Analysis: filter with a low-pass h and a high-pass g, keep every second sample; synthesis: upsample, filter, add.
Q1. In one level of the filter bank, a signal of N samples gives how many numbers? And after the full cascade?
Each branch keeps every second sample; only the low branch is split again.
One level: N/2 approximations + N/2 details = N. Full cascade: N/2 + N/4 + \dots + 1 details plus 1 approximation = N (periodic border). A change of basis keeps the count.
Q2. Keeping every second sample of a signal normally causes aliasing. Why does the reconstructed signal of a wavelet filter bank have none?
What happens to the folded part in the two branches?
Each branch alone is aliased, but for a matched (quadrature mirror) pair the folded-down part appears in the low and high branch with opposite signs, and they cancel when the branches are added on synthesis. Drop one branch, or use the wrong synthesis filters, and the aliasing stays.
Q3. Why does the DWT cost only \mathcal O(N) operations, while the FFT costs \mathcal O(N\log N)?
How much data does each level of the cascade process?
Each level filters only the low branch of the previous one: N + N/2 + N/4 + \dots < 2N samples, each with a fixed number L of multiplications. Total < 2LN. The FFT does \log_2 N passes over all N samples.
Q4. What does it mean that db3 has 3 vanishing moments? Give a signal whose db3 details are all zero (away from the borders).
Polynomials.
\sum_n n^m g_n = 0 for m = 0, 1, 2: the high-pass filter is blind to constants, ramps and parabolas. Any polynomial of degree at most 2, e.g. x_n = 3 - n + 0.5 n^2, gives zero details.
Q5. More vanishing moments make smooth regions sparser. Why is db8 not always better than db4?
How long is the filter?
db8 has 16 taps, db4 has 8. A jump (an edge) touches every coefficient whose filter covers it, so with a longer filter each edge creates more large coefficients. For signals with many jumps the shorter filter can win; for very smooth signals the longer one.
Q6. A signal is analysed with a periodic border. Its last few detail coefficients are large although the signal is smooth. What is going on, and what helps?
What does the filter see after the last sample?
The periodic border continues the signal with its own beginning: if the first and last samples differ, the filter sees a jump (a false edge) and produces large details there. A symmetric (mirror) border avoids the jump; it costs a few extra coefficients.
Q7. How are the Gaussian pyramid, the Laplacian pyramid and the DWT related?
Count the numbers stored.
All three go coarse to fine by smoothing and keeping every second sample. The Gaussian pyramid stores only the smoothed versions; the Laplacian pyramid stores the differences between levels, about 4/3 times as many numbers as pixels in 2D, and is not an orthogonal basis. The DWT stores exactly as many numbers as pixels and is an orthogonal change of basis.
Q8. (math) Show that db2’s high-pass g = (h_3, -h_2, h_1, -h_0) sums to zero, using h \propto (1+\sqrt3,\ 3+\sqrt3,\ 3-\sqrt3,\ 1-\sqrt3).
Add the four terms with their signs.
(1 - \sqrt3) - (3 - \sqrt3) + (3 + \sqrt3) - (1 + \sqrt3) = 1 - 3 + 3 - 1 + (-\sqrt3 + \sqrt3 + \sqrt3 - \sqrt3) = 0. A high-pass filter must give 0 on a constant signal: one vanishing moment.