Transform Theory & the 2-D DFT

Orthogonal kernels, the general transform/inverse-transform pair, and the discrete Fourier transform of an image.

Why transform an image at all

A pixel grid is a perfectly good way to store an image, but a bad way to reason about it. 2-D transforms rewrite an image in a different basis — one where enhancement, restoration, coding, and compression all become much simpler operations. This unit covers four of the classic ones: the Fourier, discrete cosine, Walsh–Hadamard, and Haar transforms. (A fifth, the data-dependent Karhunen–Loève transform, is worth knowing exists but is out of scope here.)

Orthogonal & unitary kernels

Every transform in this unit is built from a unitary matrix: one where . If is real, that condition simplifies to — an orthogonal matrix. A rotation matrix is the textbook example:

Its rows and are unit length and perpendicular for every and . That's orthonormality, and it's the property every transform kernel in this unit is built to have.

Interactive · Orthogonal Basis

v₁ and v₂ are the rows of the rotation matrix Rz. Spin θ all the way around — the two arrows stay perpendicular and unit-length at every angle, which is exactly what makes Rz orthogonal.

The general transform pair

Every 2-D transform this course covers has the same shape. Given a forward kernel , the transform and its inverse are:

where when the kernel is orthogonal. When the kernel is also real and symmetric — true for the DCT, Hadamard, and Haar kernels used later in this unit — the forward and inverse kernels collapse to the same matrix , and the whole family reduces to one clean pattern:

Keep that formula in mind — it's exactly what powers every basis-image widget for the rest of this unit, just with a different plugged in each time.

The discrete Fourier transform of an image

The Fourier transform is the special case where the kernel is a complex exponential:

Because , the kernel is separable: a full 2-D DFT can be computed as a 1-D DFT of every row, followed by a 1-D DFT of every column of the result. That's what makes 2-D transforms tractable at all — nobody computes the double sum directly.

Interactive · 2-D DFT

f(x, y)

|F(u, v)|, log-scaled

Why the spectrum gets centered and log-scaled

Multiplying by before transforming shifts the origin of to the middle of the display instead of the corners — purely a display convenience, and exactly what the checkbox above toggles.

Separately, real spectra decay so fast with frequency that the high-frequency detail is invisible next to the huge DC term. Displaying instead of directly compresses that huge dynamic range so both ends stay visible — the same trick the widget above uses to render its spectrum panel.

Properties worth carrying forward

A fact the continuous Fourier transform doesn't get

The continuous Fourier transform only exists for functions satisfying certain convergence conditions. The discrete Fourier transform has no such worry: because the exponential kernel is orthogonal over a finite sum, exists for every finite discrete image, no exceptions. One less thing to check before you use it.

Check your understanding

Multiplying f(x, y) by (−1)^(x+y) before taking the DFT is done in order to: