Understanding 2D Fourier space
Build your 2D Fourier intuitions for real-value imagery
Feel free to reuse the images from this article in any context without attribution (no rights reserved).
Motivation
Whether you are getting familiar with the “polar raster” of synthetic aperture radar samples or MRI “k-space,” you are dealing with the same fundamental representation: 2D Fourier space. It can be intimidating!
Previously, we’ve explored lots of different ways to get comfortable with the mechanics of the Fourier transform:
- Fourier Transform, Applied (1): Introduction to the frequency domain [https://towardsdatascience.com/the-fourier-transform-1-ca31adbfb9ef]
- Fourier Transform, Applied (2): Understanding phase angle [https://towardsdatascience.com/the-fourier-transform-2-understanding-phase-angle-a85ad40a194e]
- Fourier Transform, Applied (3): Magnitude and phase encoding in complex data [https://towardsdatascience.com/the-fourier-transform-3-magnitude-and-phase-encoding-in-complex-data-8184e2ef75f0]
- Fourier Transform, Applied (4): Putting the FFT to work [https://towardsdatascience.com/the-fourier-transform-4-putting-the-fft-to-work-38dd84dc814]
- Fourier Transform, Applied (5): Fourier cheatsheet [https://towardsdatascience.com/fourier-transform-applied-5-fourier-cheatsheet-f73a0c8eac04]
- Teach (and learn) the Fourier transform geometrically! [https://medium.com/towards-data-science/teach-and-learn-the-fourier-transform-geometrically-ce320f4200c9]
This time, we’ll take a look at some example 2D FFTs of real-valued images to build intuitions. As a computer vision practitioner, a good grasp on 2D FFTs will allow you to perform training data augmentation, filter artifacts, and understand common compression techniques.
Instructive examples
In each example, the 2D FFTs have been shifted so that the DC (i.e., 0Hz) term is at the center. Phase values are only interpretable when magnitude isn’t near zero, so I’ve zero-ed out phase components that correspond to small magnitude terms.
Uniform energy
A uniform image is just a point in Fourier space. There are no meaningful frequency contents, just a 0Hz term.
Uniform noise
Uniform noise looks like uniform noise in both magnitude and phase.
Low frequency horizontal sinusoid grating
A simple horizontal grating corresponding to a pure-tone sinusoid is represented by two non-zero terms in Fourier space. The two points are vertically offset from the origin. Why two? This is because the Fourier transform of a real-valued input is Hermitian.
High frequency horizontal sinusoid grating
Higher frequency terms are farther from the origin.
Low frequency vertical sinusoid grating
Vertical sinusoids show us the same, but are offset from the origin horizontally.
High frequency vertical sinusoid grating
Same as above!
Checkerboard (2D sinusoid)
Two-dimensional sinusoids are a combination of horizontal and vertical frequency terms.
Circular support
A circular support in pixel space gives us an Airy disk in Fourier space. This is actually really interesting! This corresponds to how light would be focused by a perfect, diffraction-limited lens.
Rectangular support
A rectangular support gives us a nice two-dimensional sinc function.
Camera man
Natural images are composed of lots of frequency components. In this image, we can see lots of energy at the cardinal orientations and two other angles.
Low frequency camera man
If we remove all the terms beyond a given radius, we can filter out all the high-frequency content (i.e., the edges).
High frequency camera man
Or we can remove all the terms near the center, recovering just the edges.
Orientation filter
If we grab the Fourier components along an angular slice, we can grab just the edges at that orientation.
Thanks for reading! I hope you learned something!