Paint on an image spectrum, and rebuild a picture wave by wave
A photo is a signal too, just spread across two directions. Break it into striped wave patterns and you get the tool behind JPEG files and MRI scans.
The middle panel is the image's 2D spectrum. Start with the stripes and turn the angle slider: the two bright dots swing round the centre with them. Then paint on the spectrum to erase frequencies and watch the rebuilt image change. Try erasing one dot of the stripes, the low-pass and high-pass buttons on the scene, or draw your own picture or upload a photo.
256×256 pixels, so 65,536 complex frequencies, shown with the zero frequency in the middle and on a log scale (otherwise only the centre would be visible). The rebuilt image is one inverse 2D FFT of the masked spectrum, recomputed as you paint.
The Fourier transform extends naturally to images. Every image is a sum of 2D sinusoidal stripe patterns at different frequencies and orientations, and the 2D FFT finds how much of each one is present. It is computed by running a 1D FFT along every row, then along every column of the result:
For the lab's 256×256 image that is 512 FFTs of length 256, done again in reverse every time you paint.
Every spectrum is symmetric through the centre, because a real image needs each frequency paired with its mirror image. That is why your brush paints two blobs.
Keeping only the centre is a low-pass filter: the image blurs, and around sharp edges you can see ripples, the 2D Gibbs effect of a hard-edged mask. Keeping only the outside is a high-pass filter: flat areas go grey and only the edges survive, which is the idea behind edge detection.
Multiplying the spectrum by a mask is the same as convolving the image with a kernel, so this is also how large blurs are done quickly:
A regular pattern, like a screen-door texture or the halftone dots of a scanned magazine, shows up as isolated bright spots. Erase the spots and the pattern disappears while the picture stays. Hidden watermarks work in the opposite direction, tucking a faint signal into chosen frequencies.
Press build. The image is rebuilt from its own spectrum, adding the strongest wave first, then the next strongest, and so on. The first panel shows each new wave as it arrives. A few dozen waves already give the layout; the remaining thousands only add detail.
Each wave is a frequency of the 128×128 spectrum together with its mirror image, which together make one real stripe pattern A·cos(2π(fₓx + fy y)/128 + φ). The wave panel shows its shape at full contrast; its true size is the amplitude above. The running sum is exactly the inverse FFT of the spectrum with only these waves switched on.
Natural images put most of their energy in a small number of low frequencies. Parseval's theorem says the energy of the image equals the energy of its spectrum, so the "energy captured" readout measures how close the sum is to the original. It typically passes 95% within the first hundred or so waves, out of more than eight thousand.
That imbalance is what compression exploits. Keep the large coefficients, drop or coarsely round the small ones, and the picture barely changes. Progressive JPEGs load in a similar order, coarse structure first, although JPEG works on small 8×8 blocks with the cosine transform rather than on the whole image: see the compressor in the Applications lesson.
The checkerboard is the exception. Its hard edges spread energy across many frequencies, so it needs far more waves before its corners turn sharp.
Spot a mistake or have an idea?