2D Fourier Transform
Every image is a sum of 2D sinusoidal gratings. The 2D FFT finds the amplitude and phase of each one. Pick a pattern (or paint your own), watch its spectrum form, then mask the spectrum and inverse-transform to see filtering in action — blur, sharpen, and stripe removal are all just multiplications in the frequency domain.
Source
8 cyc
0°
20 cyc
90°
Frequency-domain filter
A soft cutoff avoids the ringing artifacts a sharp (brick-wall) filter creates.
2.0
Pipeline
Input
spatial domain
f(x, y)
Spectrum
log magnitude · DC centered
|F(u, v)|
Reconstruction
inverse FFT of masked spectrum
f'(x, y)
256 × 256 · radix-2 FFT
forward + inverse FFT in — ms
What you're looking at
- The spectrum shows how much of each 2D sine wave is present. Distance from the center = spatial frequency (cycles across the image); direction from the center = the grating's orientation. The bright center pixel is DC — the image's average brightness.
- A single sinusoidal grating produces exactly two bright dots, symmetric about the center. Slide its frequency up and the dots move outward; rotate it and the dots rotate with it.
- Sharp features — edges, corners, the square-wave stripes — spread energy into high frequencies. The square wave shows a row of harmonics; a step edge smears a streak perpendicular to it.
- Low-pass keeps the center (blur). High-pass removes it (edge detection — only the outlines survive). Band-pass keeps a ring of frequencies. Filtering is just multiplying the spectrum by a mask, then transforming back.
- Try a sharp low-pass and watch ringing (Gibbs) appear around edges in the reconstruction; switch on the soft edge to suppress it.