C13 · Coordinates, frequencies, scales
Frequencies, phase and Fourier
An image can be assembled from stripes at different frequencies, directions and phases. Frequency describes repetition; phase describes alignment.
Background if needed
Theory
Spatial frequency is not light wavelength
Three cycles across 16 pixels is a spatial frequency of 3/16 cycles per pixel. A 2D frequency has two components defining variation direction. The constant mean is DC, the zero frequency. It does not mean no light.
The DFT computes coefficients of a finite periodic array. They are complex: magnitude gives amplitude and argument gives phase. FFT is a faster algorithm for the same DFT. Here a small direct DFT lets us check the calculation without a separate library.
Assemble an image from three layers
Start with the constant mean. Add stripes along x, then along y. Select the result: the center shows the three contributions at that point. Change phase and stripe count without changing their amplitude.
Exact values are in the point inspector
Grayscale 0…1: black to white.
- Mean + x variation + y variation
Exact values are in the point inspector
Grayscale 0…1: black to white.
Inspect the selected point
What the plot shows
The image line marks this same row. Select a higher or lower point to move the cross-section; compare values at the same column.
- Mean
- x stripe
- Sum
- Selected column: 8
A stripe contribution can be positive or negative: it brightens or darkens the base. The selected row profile shows the same sum. The DFT stores weights of these patterns; the inverse DFT adds them.
Parameters and details
Assembly: mean + horizontal stripe + vertical stripe. A contribution's sign determines whether brightness is added or subtracted. Phase shifts stripes without changing amplitude. Empty phase cells have zero coefficients, whose phase is undefined.
Select an image point. Arrows move it; Home and End reach row edges. Viewing does not change the calculation.
Changing the example requires JavaScript and Canvas. Computed images remain available above.
Magnitude is how much; phase is where
Keep all three layers now. Horizontal stripes retain their amplitude and repetition count while phase shifts their starting position. Compare the magnitude spectra at 0° and 90°: bright points have the same frequency coordinates and brightness. That does not imply identical images.
Select the phase map: only nonzero coefficients have defined phases. Zeroing phase preserves magnitudes while moving stripe maxima. A positive/negative frequency pair describes one real cosine, not two separate photographed objects.
Same magnitude, different phase
Shift the stripe phase. Then remove phase in the inverse transform.
Exact values are in the point inspector
Blue − · white 0 · red +; scale -0.3…0.3
- Mean + x variation + y variation
Exact values are in the point inspector
Grayscale 0…1: black to white.
Inspect the selected point
What the plot shows
The image line marks this same row. Select a higher or lower point to move the cross-section; compare values at the same column.
- Mean
- x stripe
- Sum
- Selected column: 8
Shifting stripes barely changes their spectral magnitudes. Phase sets their position; zeroing phase changes the image while retaining magnitudes.
Parameters and details
Assembly: mean + horizontal stripe + vertical stripe. A contribution's sign determines whether brightness is added or subtracted. Phase shifts stripes without changing amplitude. Empty phase cells have zero coefficients, whose phase is undefined.
Select an image point. Arrows move it; Home and End reach row edges. Viewing does not change the calculation.
Changing the example requires JavaScript and Canvas. Computed images remain available above.
Removing a frequency pair affects the whole image
A real image pairs positive frequency with a conjugate negative frequency. Remove both notches to preserve a real output. The central bright point in the displayed spectrum is DC; removing it to suppress stripes is usually wrong.
Spatial convolution corresponds to multiplying spectra when boundaries and normalization agree. DFT assumes periodic continuation; linear convolution needs sufficient padding. Sharp spectral cutoffs ring, while Gaussian and Butterworth transitions are smoother. Band and notch filters select frequencies without understanding objects.
Remove a stripe frequency
The stripes have already been added and stay fixed. Choose the rejected frequency independently of the interference frequency; spectrum outlines mark the conjugate pair.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Inspect the selected point
What the plot shows
The stripes weaken, but useful scene content at the same frequencies is lost too. The DFT has no separate knowledge of what is noise.
Parameters and details
Direct 16×16 DFT: unscaled forward transform, inverse /256. The centered spectrum uses a logarithmic display and frequency coordinates. A notch removes a conjugate pair, including any useful signal at those frequencies.
Select an image point. Arrows move it; Home and End reach row edges. Viewing does not change the calculation.
Changing the example requires JavaScript and Canvas. Computed images remain available above.
How to read a spectrum without overclaiming
Reference and further methods
Spectrum brightness is log(1+|F|) on a fixed common scale. This reveals weak coefficients without changing the inverse calculation. A spectrum coordinate is a frequency, not a corresponding photograph pixel.
With this normalization, input squared energy equals DFT squared-magnitude energy divided by pixel count: the finite Parseval identity. Phase often matters for contour location, but amplitude is not universally unimportant; textures and other scenes can behave differently. DCT later uses a different, real cosine basis.
Practice
Test the idea under another condition. Follow the task above the images; point inspection helps explain the result. This exploration is not scored.
Find the pair that removes the stripes
This interference frequency differs from the worked example. Keep the interference fixed: choose the rejected pair and compare the spectra before and after rejection. Also test a neighboring frequency.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Inspect the selected point
What the plot shows
The relevant pair weakens the stripes; a neighboring pair may remove scene detail while leaving the stripes. A rejected coefficient does not distinguish useful signal from interference.
Parameters and details
Direct 16×16 DFT: unscaled forward transform, inverse /256. The centered spectrum uses a logarithmic display and frequency coordinates. A notch removes a conjugate pair, including any useful signal at those frequencies.
Select an image point. Arrows move it; Home and End reach row edges. Viewing does not change the calculation.
Changing the example requires JavaScript and Canvas. Computed images remain available above.
Games
Test your explanation
Question 1 of 5
What changes when DC is removed?
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Blue − · white 0 · red +; scale -0.3…0.3
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
Grayscale 0…1: black to white.
Choose one answer. It is checked immediately.
Limitations and references
Limits of this example
The DFT is bounded to 16×16 and the notch to one exact frequency pair. No large-photo FFT or universal stripe-removal claim is made.