Magnitude vs phase

The Fourier transform splits an image into the magnitude and the phase of its sinusoids. Combine the magnitude of one image with the phase of another and see which of the two you recognize.

Image A ∣A∣ ei∠A|A| \, e^{i \angle A}
Image B ∣B∣ ei∠B|B| \, e^{i \angle B}
F−1{∣A∣ ei∠B}\mathcal{F}^{-1}\{|A| \, e^{i \angle B}\} magnitude of A, phase of B
F−1{∣B∣ ei∠A}\mathcal{F}^{-1}\{|B| \, e^{i \angle A}\} magnitude of B, phase of A
Only one part of image A
phase of A, radial average of ∣A∣|A|
phase of A, ∣F∣=1|F| = 1 (contrast stretched)
∣A∣|A|, random phase
∣A∣|A|, zero phase (origin in the center, stretched)

Two halves of the spectrum

The 2D Fourier transform describes an image as a sum of sinusoids. Each coefficient is a complex number, which can be written by its length and angle:

F(u,v)=∣F(u,v)∣ eiφ(u,v)F(u, v) = |F(u, v)| \, e^{i \varphi(u, v)}

The magnitude ∣F∣|F| says how strong the sinusoid of frequency (u,v)(u, v) is, the phase φ\varphi where its crests lie. Both are needed to get the image back. The experiment here keeps one of them and replaces the other: the result F−1{∣A∣ ei∠B}\mathcal{F}^{-1}\{|A| \, e^{i \angle B}\} has exactly the frequency content of A, but the wave positions of B.

Phase carries the structure

The result looks like the image that donated the phase. An edge is a place where many sinusoids of different frequencies have their crests at the same spot, so that they add up to a step. The phase decides where the waves line up, and therefore where the edges, lines and corners are. The magnitude only decides how strongly each frequency takes part.

The shift theorem makes this concrete: moving an image by (x0,y0)(x_0, y_0) multiplies its spectrum by e−i2π(ux0+vy0)/Ne^{-i 2\pi (u x_0 + v y_0) / N}. The magnitude does not change at all; the position of everything in the image is stored in the phase.

Magnitude spectra look alike

Natural images have similar magnitude spectra: strong at low frequencies and falling off roughly like 1/u2+v21 / \sqrt{u^2 + v^2}, with some extra energy perpendicular to dominant edge directions. Replacing ∣A∣|A| by its average over rings of equal frequency, which removes all directional information, still leaves a clearly recognizable image. Setting ∣F∣=1|F| = 1 instead makes all frequencies equally strong; this whitening boosts the fine detail, so only the edges remain, but they are all in the right place.

The other way round, the magnitude alone says little. With random phases, the waves no longer line up anywhere and the image turns into texture-like noise with the same frequency content. With zero phase, every wave has a crest at the origin: all energy piles up there, and the image becomes symmetric about the origin.

Try this