Introduction to frequency-domain filtering
1 Spatial domain
Do you remember these filters?
- smoothing linear filters
- order-statistics non-linear filters
- Sobel filters
- Laplacian filters?
These filters are called spatial filters because they are applied to images “spatially.”
The domain of these spatial filters is the spatial domain (i.e., $f(x,y)$ or the $x$-$y$ spatial coordinates).
2 Frequency domain
Now, a Fourier-transformed image is in the frequency domain (i.e., $F(u,v)$ or $u$-$v$ frequency coordinates).
2.1 Exercise: Plotting $F(u)e^{2i\pi ux/M}$
Do you want to see how a one-dimensional image is decomposed into multiple frequencies?
2.2 Exercise: Reading the Fourier spectrum
See the effect of $K$ in frequency_exercise_2.py.
This is the two-dimensional version: frequency_exercise_3.py.
3 Frequency-domain filtering
The fundamental idea behind frequency-domain filtering is to enhance images in the spatial domain by changing their Fourier transform in the frequency domain.
Low-frequency components in the Fourier transform represent the overall gray-level appearance of an image while high-frequency components, details such as edges.
3.1 Exercise: Fourier transform components
Try $F(0)=0$ and $F(3)=0$, and discuss what happens and why.
4 Frequency-domain filters
4.1 Low-pass filters
Low-pass filters “pass” low frequencies while attenuating high frequencies. Effects?
Reduced details $\rightarrow$ Smoothing
4.2 High-pass filters
High-pass filters “pass” high frequencies while attenuating low frequencies. Effects?
Reduced gray-level variations in smooth areas $\rightarrow$ Emphasized transitions
4.3 How do they work?
Element-by-element multiplication with the Fourier transform: \begin{align*} G(u,v)&=H(u,v)F(u,v)\\ g(x,y)&=\mathfrak{F}^{-1}[G(u,v)] \end{align*} where $G(u,v)$, $H(u,v)$, and $F(u,v)$ are the output Fourier transform, frequency-domain filter, and Fourier transform of the input image, respectively, $g(x,y)$ is the transformed image, and $\mathfrak{F}^{-1}$ denotes the inverse Fourier transform.
4.4 Notch filter
Probably, one of the simplest frequency-domain filter. We’ve already tried it manually in frequency_exercise_4.py.
\[H(u,v)= \begin{cases} 0& \text{if }(u,v)=(0,0)\\ 1& \text{otherwise.} \end{cases}\]
Or the shifted version (Remember why we shift the Fourier transform?)
\[H(u,v)= \begin{cases} 0& \text{if }(u,v)=(M/2,N/2)\\ 1& \text{otherwise.} \end{cases}\]
What does it do?
Set $F(0,0)=0$. That’s it. Effects?