Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

Fourier intuition, recalled

~12 min

Every technique so far in this chapter works in the spatial domain: one value per pixel position. digital-image-processing built a second way to look at the exact same image. It treats the image as a sum of repeating patterns, at various frequencies. This course reaches for that view twice directly: diagnosing repeating texture in Chapter 10's classical features, and recognizing frequency-domain artifacts in a few applied chapters. This section recalls exactly what a magnitude spectrum shows, and why.

Think of a photo as a grid of brightness values. Its magnitude spectrum is a second grid, the same size. But it answers a different question: "how strongly does the image repeat at this particular speed and direction?" It answers that for every possible speed and direction at once. The (0,0) entry always answers something simpler: "how bright is the image, on average?" That's really the total brightness, before you divide by the pixel count. There's no repeat-speed question there at all. That's why it's called the DC term, short for "direct current" — a name borrowed from electrical engineering for exactly this "no repeating wave" component.

Once you know what to look for, a magnitude spectrum reads like a diagnosis. A single hard edge — one clean line where dark meets light — smears energy across a whole range of frequencies. Building that sharp a jump takes many different repeating patterns working together. No single one does it alone. A repeating texture — a woven fabric, a tiled floor — shows up differently. It appears as a tight cluster of bright dots, sitting away from the center. That's because a texture literally is a repeating pattern, and repeating patterns are exactly what frequencies measure. A perfectly periodic ripple is the cleanest signature of the three — think of a hum baked into every scan line of an old photo. It shows up as one or two separate, needle-sharp dots, sitting by themselves. A perfectly repeating wave has nothing else mixed into it.

The 2D discrete Fourier transform (DFT) of an H\times W image f(x,y) is F(u,v) = \sum_{x=0}^{H-1}\sum_{y=0}^{W-1} f(x,y)\, e^{-j2\pi(ux/H+vy/W)}. This gives one complex number F(u,v) for every pair of a row-frequency u and a column-frequency v. It is a change of representation, not a loss of information: the inverse transform reconstructs f exactly. The term F(0,0), the DC term, always reduces to e^0=1 at every position. It therefore equals the plain sum of every pixel value. That is exactly the same reduction a 1D signal's own F[0] makes, applied here to two dimensions at once instead of one.

The magnitude spectrum |F(u,v)| carries three recognizable signatures. A sharp edge spreads energy across many frequencies, along the axis perpendicular to the step. Building an instant jump takes a wide mix of frequencies working together. A repeating texture concentrates energy at a specific, non-DC frequency, or a small cluster, matching its own repeat distance and direction. Truly periodic noise — a perfectly repeating, unwanted ripple — produces the sharpest signature of all: one or a few separate spikes, standing alone. A pure sinusoid puts its entire energy at a single frequency, by definition.

Quick review

Practice from earlier coursework, pulled in for this topic.

From Digital Image Processing

Because the 2D DFT is separable, computing it for an image can be done by...

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Separability doesn't collapse the transform to one diagonal pass -- it decomposes into a full row pass and a full column pass.

There's no corner-averaging step in the separable computation -- it's row-by-row and column-by-column, covering every pixel.

Every row gets its own genuine 1D DFT computed -- the first row's result isn't simply copied across the others.

Why

Separability means the 2D DFT decomposes exactly into a 1D DFT along each row composed with a 1D DFT along each column -- the reason numpy.fft.fft2 can be built entirely from 1D FFT calls.

From Digital Image Processing

The 2D DFT's DC term F(0,0), generalizing the 1D DFT's own F[0], equals...

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

The largest single pixel value isn't what F(0,0) computes -- every pixel contributes equally to the sum, not just the biggest one.

F(0,0) uses every pixel in the image, not just the four corners.

F(0,0) is never zero in general -- it equals the image's pixel sum, which is zero only for an all-black image.

Why

At u=v=0 every exponential term equals e^0=1, so the double sum degenerates to a plain sum over every pixel -- the direct 2D analogue of the 1D DC term.

Formula

The 2D Discrete Fourier Transform

also known as: 2D DFT

Recalled from Digital Image Processing · The 2D discrete Fourier transform — first taught there.

🔖

For an H\times W image f(x,y), the 2D discrete Fourier transform is F(u,v) = \sum_{x=0}^{H-1}\sum_{y=0}^{W-1} f(x,y)\, e^{-j2\pi\left(\frac{ux}{H}+\frac{vy}{W}\right)}, \qquad u=0,\dots,H-1,\ v=0,\dots,W-1. Each F(u,v) is one complex number; a full H\times W image produces a full H\times W grid of them, no information lost or gained. The inverse DFT recovers the image exactly: f(x,y) = \frac{1}{HW}\sum_{u=0}^{H-1}\sum_{v=0}^{W-1} F(u,v)\, e^{+j2\pi\left(\frac{ux}{H}+\frac{vy}{W}\right)}. Because the exponential kernel factors as a product of a purely-x term and a purely-y term, the 2D sum separates into a 1D DFT along rows composed with a 1D DFT along columns.

A hard edge's spectrum: spread, not a spike

This 4x4 image has a hard vertical edge -- left two columns read 160, right two read 40. Step through and watch the magnitude spectrum: energy shows up across MULTIPLE column-frequency bins in row u=0, not concentrated at a single spike the way a pure periodic pattern would be.

Loading interactive…

Worked example

The DC term is still just a sum

  1. 1

    For the 2\times2 image \begin{bmatrix}160&40\\160&40\end{bmatrix}, compute F(0,0). Set u=v=0: every exponential term becomes e^0=1.

  2. 2
    F(0,0) = 160+40+160+40 = 400

    Exactly the plain sum of every pixel. The DC term never depends on how the pixels are arranged — only on their total.

Loading interactive…

Worked example

A row-frequency term of the same edge

  1. 1

    Same 2\times2 image, now compute F(0,1): here u=0 and v=1. The row index x never enters the exponent, so this reduces to F(0,1)=\sum_{x,y} f(x,y)\,e^{-j\pi y}, with e^{-j\pi\cdot0}=1 and e^{-j\pi\cdot1}=-1.

  2. 2
    F(0,1) = (160\cdot1+40\cdot(-1)) + (160\cdot1+40\cdot(-1)) = 120+120=240

    Nonzero energy at a genuine column-frequency term, since this image varies left-to-right. That matches exactly the rule this section states for an edge: energy lands on the axis matching the direction the pattern varies.

Loading interactive…

Where this goes next

Texture-based classical features

Chapter 10 builds feature vectors by hand, for a shallow classifier. One of its texture descriptors is a texture's own frequency signature: where its energy sits in the magnitude spectrum. That signature can tell a repeating pattern (a tight cluster of energy) apart from a random-looking one (energy spread everywhere). A single pixel value could never make that call on its own.

Check your understanding (counts toward your progress)

Explain why the 2D DFT is described as "a change of representation, not a loss of information."

A repeating texture (like woven fabric) shows up in the magnitude spectrum as...

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

The DC term only measures overall average brightness -- a genuine repeat pattern shows up AWAY from the DC term, not at it.

Evenly spread energy is closer to random noise's signature, not a genuinely repeating texture's.

A texture's repeat distance and direction produce a real, locatable cluster in the spectrum -- it is not invisible.

Why

A texture is itself a repeating pattern, and repeating patterns are exactly what concentrate into a specific frequency (or small cluster) away from the DC term.

A perfectly periodic ripple (like scanner noise) produces which signature in the magnitude spectrum?

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Spreading evenly across every frequency is closer to what pure random noise would look like -- a genuinely PERIODIC signal concentrates instead.

An edge spreads its energy across many frequencies along one axis; periodic noise does the opposite -- it concentrates into just one or two isolated points.

A perfectly repeating pattern is exactly the kind of structure the frequency domain is built to expose clearly.

Why

A pure sinusoid's entire energy sits at a single frequency by definition -- the sharpest, most concentrated signature of the three.

A 2\times2 image has values 180, 60, 180, 60 (reading left to right, top to bottom). Compute F(0,0).

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Why

F(0,0) is just the plain sum of every pixel -- 180+60+180+60=480.

Correct answer

Also accepted:

Why

Why does a sharp edge spread energy across many frequencies rather than concentrating it?

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Physical size in the image has nothing to do with how many frequencies are needed to represent a shape.

The DFT formula is the same formula for every pixel value -- there's no special-cased "edge" rule inside it.

An edge can occur anywhere inside an image, not only along its outer border.

Why

No single repeating wave can build an instantaneous jump on its own -- many frequencies, in combination, are needed to approximate that sharp a transition.

The 2D DFT's DC term, F(0,0), always equals...

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

The brightest single pixel says nothing about the OVERALL total -- F(0,0) depends on every pixel, not just the extreme value.

F(0,0) is zero only for an image whose pixels happen to sum to zero -- it is not zero in general.

Every pixel contributes to F(0,0) equally, not just the four corners.

Why

Setting u=v=0 turns every exponential term into e^0=1, so the formula collapses to the plain sum of every pixel.

Practice: Reading a magnitude spectrum (4 problems · doesn’t affect your progress)

What does the DC term, F(0,0), of a 2D DFT actually represent, in plain terms?

A 2\times2 image has values 100, 50, 100, 50. Compute F(0,0).

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Why

F(0,0) is the plain pixel sum -- 100+50+100+50=300.

Correct answer

Also accepted:

Why

300

Which produces the most concentrated (sharpest, most isolated) spectral signature?

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Why

A pure sinusoid's entire energy sits at one frequency by definition -- the sharpest possible concentration of the options listed.

a perfectly periodic ripple

A restoration technician wants to remove a scanner's periodic electrical ripple without damaging the page's text edges. Why does this work?

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Why

An edge's energy spreads broadly across many frequencies, while a periodic ripple concentrates into one or two isolated spikes -- removing just the isolated spike leaves the broadly-spread edge energy almost entirely intact.

the ripple's isolated spike sits far from the broadly spread edge energy in the spectrum

Feeling good about this section?

Take the section quiz

Every answer gets a full explanation at the end.

Graph settings

Calculator

Sign in to save highlights

Insert an equation

  • No matches.