MA3111: Mathematical
image processing
Frequency domain processing
Shen-Fu Tsai (蔡昇甫)
中央大學數學系
2-D Fourier analysis
● Extension from 1-D to 2-D is mostly straightforward
● We will quickly go through Fourier transform, discrete-time Fourier
transform, and discrete Fourier transform for 2-D
1-D Fourier
transform
2-D Fourier transform
2-D Discrete-time Fourier
transform
1-D
Discrete-time
Fourier
transform
2-D Discrete Fourier 1-D Discrete
transform
Fourier
transform
Fourier analysis for real-valued signal
The spectrum of real-valued signal has symmetric magnitude
with respect to the origin
Low vs. high frequencies
● Let’s say you computed the Discrete Fourier Transform (DFT) X(0), X(1), …,
X(N-1) of N-point signal x(0), x(1), x(2), …, x(N-1)
○ Among X(0), X(1), …, X(N-1), what corresponds to low frequency?
○ Among X(0), X(1), …, X(N-1), what corresponds to high frequency?
Low vs. high frequencies
High frequency
low frequency
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Spectrum of separable functions
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Example: 2-D box function
Example
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Example
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Rotation in spatial domain
● Lemma: if we rotate a 2-D function f(x, y) counterclockwise by θ to obtain a
new 2-D function g(x, y), then its spectrum G(μ, 𝜈) can also be obtained by
rotating the spectrum F(μ, 𝜈) of f(x, y) counterclockwise by θ
Spectrum of a thin line
Spectrum of a thin line
The spectrum of a horizontal line is a
vertical line:
Example
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Frequency domain processing
Frequency Inverse
Input Fourier Output
domain Fourier
image transform image
processing transform
Frequency domain processing
Frequency Inverse
Input Fourier Output
domain Fourier
image transform image
processing transform
Which Fourier transform to use?
Circular convolution
Discrete Fourier transform
Circular convolution
● Arise naturally from periodic signal
○ Similar definition for continuous and periodic spectrum in Discrete-time Fourier transform
●
● In Discrete Fourier transform
○ Multiplication in one domain is equivalent to circular convolution in the other domain
Circular convolution
Frequency domain processing
Frequency Inverse
Input Fourier Output
domain Fourier
image transform image
processing transform
For an N-by-M image, we can use (M, N)-point 2-D
Discrete Fourier transform (DFT)
Constructing filter transfer function
1. Given an N-by-M image f(x, y), compute its (M, N)-point 2-D DFT F(u, v)
2. Construct H(u, v), N-by-M filter transfer function
3. Compute G(u, v) = F(u, v)H(u, v), (u, v) in [0, M - 1] ✕ [0, N - 1]
4. g(x, y) = IDFT(G(u, v)), (x, y) in [0, M - 1] ✕ [0, N - 1]
Phase of
Spectrum
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Zero-phase-shift filter
● Phase of F(u, v) carries a lot of information about the image, so we usually
don’t want to change it when filtering.
● Thus the constraint of filter for image processing in frequency domain:
○ Phase of F(u, v) is identical to phase of F(u, v)H(u, v)
○ F(u, v)H(u, v) is still the spectrum of real image signal
○ h(x, y) is real
● What should H(u, v) look like?
Zero-phase-shift filter
● Phase of F(u, v) carries a lot of information about the image, so we usually
don’t want to change it when filtering.
● Thus the constraint of filter for image processing in frequency domain:
○ Phase of F(u, v) is identical to phase of F(u, v)H(u, v)
○ F(u, v)H(u, v) is still the spectrum of real image signal
○ h(x, y) is real
● What should H(u, v) look like?
○ Real, positive, and symmetric about the origin i.e. H(u, v) = H(-u, -v)
Example: DC removal
Clipping included,
as average intensity
is zero
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Example: various filters
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Ideal lowpass filter
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Ideal lowpass filter
Notice the ringing effect i.e.
Gibbs phenomenon introduced
by the ideal filter
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Ringing artifact
● A loosely defined phenomenon
● Definition
○ When a non-oscillating input yields a oscillating output
● Usually happens when
○ input signal has sharp transition, and
○ Fourier transform H(u) of the system has sharp transition in
frequency domain
https://en.wikipedia.org/wiki/Ringing
_artifacts
Ringing artifact
Ringing artifact
Gaussian lowpass filter
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Gaussian lowpass filter
Ringing effect is
gone
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Butterworth lowpass filter
R. C. Gonzalez and R. E. Woods, Digital Image
Higher order BLPF approximates ILPF, but may also have ringing effect Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Fixing low resolution text with LPF
Removing fine skin lines
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Highpass filters
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Highpass filters
Which row corresponds to more aggressive filtering
i.e. larger D0?
Ringing effect still
present with IHPF
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Revisiting Laplacian
Revisiting Laplacian
Laplacian via frequency 1 1 1 0 1 0
vs. spatial domains 1 -8 1 1 -4 1
1 1 1 0 1 0
● Spatial approach
○ Convolve the image f(x, y) with a Laplacian kernel to approximate ∇2f(x, y)
○ Return g(x, y) = f(x, y) + c∇2f(x, y), c < 0
● Frequency approach
○ Compute the DFT (Discrete Fourier Transform) F(u, v) of image f(x, y)
○ Return the IDFT (Inverse Discrete Fourier Transform) of (1 - 4cπ2D2(u, v))F(u, v), c < 0
Laplacian via Spatial result
frequency vs. spatial
domains
Frequency result
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Selective filtering
● Bandpass filter (BP)
○ Only allows specific bands of frequencies to pass after filtering
● Bandreject filter (BR)
○ Only removes specific bands of frequencies to pass after filtering
● HBP(u, v) = 1 - HBR(u, v)
Bandreject filter (BR)
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Bandreject filter (BR)
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Notch filters
● Notch: 刻痕,槽口,凹口
● Most useful selective filters.
● Rejects or passes frequencies in predefined areas.
● Why the terms Hk(u, v)H-k(u, v)?
Notch filters
● Notch: 刻痕,槽口,凹口
● Most useful selective filters.
● Rejects or passes frequencies in predefined areas.
● Why the terms Hk(u, v)H-k(u, v)? Hk(u, v) is usually not even
Remove moiré patterns
using notch filter
R. C. Gonzalez and R. E. Woods, Digital Image
Processing, Fourth Edition, Pearson Education Limited,
New York, 2018.
Review
● 2-D Fourier transform
○ Spectrum of lines
○ Rotation in spatial domain → rotation in frequency domain
○ For real-valued signal, F(u, v) = F*(-u, -v)
○ Low v.s high frequency in DFT
○ Information in phase v.s magnitude of spectrum
● Frequency domain processing
○ Circular convolution
○ Wraparound error
○ Ringing artifact
● Lowpass, highpass, and bandpass filters
○ Ideal filter, Gaussian filter, Butterworth filter
● Notch filter