← Mike Cogliandro

FFT Scratchpad

Every picture is secretly a stack of stripes. Erase a few, and a pattern disappears.

A Fourier transform you can touch. No camera needed; everything runs in your browser.

1 · Pick a picture

2 · Brush

7

3 · Or try a shortcut

Start over

The picture

Original

What you’d normally see: a grid of brightness values.

Its recipe

Paint here

The same picture as a recipe of stripe patterns. Drag to erase ingredients.

Rebuilt from your recipe

Result

Rebuilt from whatever is left in the recipe, updated as you paint.

Nothing erased yet
Try this: with the window screen picture loaded, look in the recipe for the bright stars sitting away from the center. Erase them, and the mesh disappears while the house behind it stays. Then check the counter: the whole pattern lived in well under 1% of the recipe.

What am I looking at?

In the 1800s, Joseph Fourier showed that any signal can be built by adding up simple waves. A picture is no exception: it can be rebuilt exactly from a stack of smooth stripe patterns of different sizes, angles and strengths. The middle panel shows that stack.

Reading the recipe

Each dot in the middle panel stands for one stripe pattern. Its brightness is how much of that pattern the picture contains.

Its distance from the center is how fine the stripes are. Broad shapes and overall brightness live near the center; sharp edges and fine detail live near the rim.

Its direction from the center is the angle of the stripes.

Why patterns become stars

A real scene needs thousands of ingredients spread across the recipe. A repeating pattern like a window screen is the opposite: it’s made of just one or two stripe patterns, so all its energy piles up in a few bright stars.

That’s why erasing a handful of dots removes the pattern and leaves the picture almost untouched. Every star appears twice, mirrored through the center, so the brush always erases both.

Where you’ve met this

Photos and video: JPEG uses a close cousin of this idea, keeping the ingredients your eye notices and discarding fine detail it won’t miss.

Medicine: an MRI scanner measures the recipe first, and a computer turns it into the image.

Sound: noise-cancelling headphones and audio equalizers work on the same principle, one dimension down.

Step 1

Picture to numbers

The image becomes a 256 × 256 grid of brightness values.

cvtColor
Step 2

Numbers to recipe

The Fourier transform finds how much of every stripe pattern is present.

dft
Step 3

Edit the recipe

Your brush turns ingredients down to zero, with soft edges to avoid ripples.

mask × spectrum
Step 4

Recipe to picture

The inverse transform adds the remaining stripes back together, live.

dft (inverse)