CoE4TN4
Image Processing
Chapter 4
Filtering in the Frequency
Domain
Fourier Transform
• Sections 4.1 to 4.5 will be done on the board
2
2D Fourier Transform
3
2D Sampling and Aliasing
4
2D Sampling and Aliasing
• Perfect reconstruction of a bank-limited image from a set of
its samples requires 2-D convolution in the spatial domain
with a sinc function.
• To reduce aliasing it is a good idea to blur an image before
shrinking or sampling
5
2D Sampling and Aliasing
6
2D Sampling and Aliasing
• In images with strong edge content, the effects of aliasing are
called jaggies
7
2D Sampling and Aliasing
• Moire patterns happens in sampling scenes with periodic or
nearly perodic components
• Scanning of media prints such as newspaper
8
2D Sampling and Aliasing
• Newspapers and other printed materials use halftone dots
• Halftone: black dots or ellipses whose sizes are used to
simulate gray tones
9
2D Sampling and Aliasing
10
2D DFT
11
2D DFT
12
Fourier Transform
• Fourier Transform (FT) of a 2-D signal:
13
Fourier Transform
• Properties of Fourier Transform (FT) of a 2-D real, signal:
14
Fourier Transform
• It is common to multiply input image by (-1)x+y prior to
computing the Fourier Transform.
• This shift the center of the FT to (M/2,N/2)
15
Fourier Transform
16
2D DFT
17
2D DFT
18
Discrete Fourier transform
• When working with discrete Fourier transform, we have to
keep in mind the periodicity of functions involved.
• This periodicity is a byproduct of the way in which discrete
FT (DFT) is defined
• Using DFT allows us to perform convolution in the frequency
domain but the functions are treated as periodic.
19
2D DFT
20
2D DFT
21
2D DFT
22
Frequency domain filtering
1. Multiply the input image by (-1)x+y to center the transform
Compute the DFT of the image from step 1
2. Multiply the result by the transfer function of the filter
(centered)
3. Take the inverse transform.
4. Multiply the result by (-1)x+y
23
• H(u,v)is 0 at the center of the transform and 1 elsewhere
25
• Low frequencies: slowly varying components in an image
• High frequencies: caused by sharp transitions in intensity such
as edges and noise
Steps for filtering in frequency domain
• For input image f(x,y) of size MxN obtain the padding
parameters P and Q
• Form a padded image fp(x,y) of size PxQ by appending the
necessary number of zeros to f(x,y)
• Multiply fp(x,y) by (-1)x+y to center the Fourier transform
• Compute DFT of f, F(u,v)
• Generate a real, symmetric filter H(u,v) of size PxQ. Form
product G(u,v)=H(u,v)F(u,v)
• Obtain the processed image: gp (x, y) = {real(F 1 (G(u, v)))}( 1)x+y
• Obtain the final processed result by extracting the MxN
region from the top left quadrant of gp(x,y)
27
Frequency domain filtering
• G(u,v)=F(u,v)H(u,v)
• Based on convolution theorem: g(x,y)=h(x,y)*f(x,y)
– f(x,y) is the input image
– g(x,y) is the processed image
– h(x,y): impulse response or point spread function
• Based on the form of H(u,v), the output image exhibits some
features of f(x,y)
28
Frequency domain filtering
Convolution Implementing a mask
w(x,y)
h(x,y) f(x,y)
f(x,y)
1) Flip 2) Shift, multiply, add
29
Frequency domain filtering
• Convolution with a filter and implementing a mask are very
similar
• The only difference is the flipping operation
• If the impulse response of the filter is symmetric about the
origin the two operations are the same.
• Instead of filtering in the frequency domain, we can
approximate the impulse response of the filter by a mask, and
use the mask in the spatial domain.
30
31
Frequency domain filtering
• Edges and sharp transitions (e.g., noise) in the gray levels of
an image contribute significantly to high-frequency content of
FT.
• Low frequency in the Fourier transform of an image are
responsible for the general gray-level appearance of the image
over smooth areas.
• Blurring (smoothing) is achieved by attenuating range of high
frequency components of FT.
• We consider 3 types of lowpass filters: ideal, Butterworth and
Gaussian
32
Ideal low-pass filter
• Ideal: all the frequencies inside a circle of radius D0 are
passed and all the frequencies outside this circle are
completely removed.
|H| |H|
v
u
u
M/2-D0 M/2+D0
33
34
35
Ideal low-pass filter
• Effects of ideal low-pass filtering: blurring and ringing
36
Ideal low-pass filter
• The radii of the concentric rings in h(x,y) are proportional to 1/D0
D0 1/D0 Less blurring,
Less ringing (amplitude
of rings drop)
1/D0 More blurring,
D0
More ringing
(amplitude of rings
increase)
37
Butterworth Lowpass Filters
• Smooth transfer function, no sharp discontinuity, no clear
cutoff frequency.
38
Butterworth Lowpass Filters
39
Butterworth Lowpass Filters
40
Gaussian Lowpass Filters
• Smooth transfer function, smooth impulse response, no
ringing
41
Gaussian Lowpass Filters
42
Applications of Lowpass Filters
43
Applications of Lowpass Filters
44
High-pass filtering
• Image sharpening can be achieved by a high-pass filtering
process.
• Hhp(u,v)=1-Hlp(u,v)
• Ideal:
• Butterworth:
• Gaussian:
45
High-pass filtering
46
High-pass filtering
47
High-pass filtering
48
High-pass filtering
49
High-pass filtering
50
Laplacian in Frequency Domain
51
Laplacian in Frequency Domain
52
53
Unsharp Masking, High-boost Filtering
• Unsharp masking: fhp(x,y)=f(x,y)-flp(x,y)
• Hhp(u,v)=1-Hlp(u,v)
• High-boost filtering: fhb(x,y)=Af(x,y)-flp(x,y)
• fhb(x,y)=(A-1)f(x,y)+fhp(x,y)
• Hhb(u,v)=(A-1)+Hhp(u,v)
54
Homomorphic filtering
• In some images, the quality of the image has reduced because
of non-uniform illumination
• Homomorphic filtering can be used to perform illumination
correction
• We can view an image f(x,y) as a product of two components:
• This equation cannot be used directly in order to operate
separately on the frequency components of illumination and
reflectance
55
Homomorphic filtering
56
Homomorphic filtering
• The key to the approach is that separation of the illumination
and reflectance components is achieved. The homomorphic
filter can then operate on these components separately
• Illumination component of an image generally has slow
variations, while the reflectance component vary abruptly
• By removing the low frequencies (highpass filtering) the
effects of illumination can be removed
57
Homomorphic filtering
58
Selective Filtering
• Bandreject filters remove or attenuate a band of frequencies
59
Selective Filtering
60
Selective Filtering
61
Bandpass and band reject filters
• A bandpass filter performs the opposite of a bandreject filter.
– Hbp(u,v)=1-Hbr(u,v)
• A notch filter rejects (or passes) frequencies in predefined
neighborhood about a center frequency
• Due to symmetry of the FT, notch filters must appear in
symmetric pairs about the origin in order to obtain meaningful
results
62
Periodic noise reduction
63
Periodic noise reduction
64
65