Chapter 04
Chapter 04
Chapter 4:
Image Enhancement in the
Frequency Domain
Background: Fourier Series
Fourier series:
Any periodic signals can be
viewed as weighted sum
of sinusoidal signals with
different frequencies
Frequency Domain:
view frequency as an
independent variable
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Fourier Tr. and Frequency Domain
Fourier Tr.
Time, spatial Frequency
Domain Domain
Signals Inv Fourier Tr. Signals
f ( x )e
j 2ux
Fourier Tr.: F (u ) dx
F (u )e
j 2ux
Inv. Fourier Tr.: f ( x) du
Fourier Tr. and Frequency Domain (cont.)
1-D, Discrete case
M 1
1
Fourier Tr.: F (u )
M
f ( x )e
x 0
j 2ux / M
u = 0,…,M-1
M 1
Inv. Fourier Tr.: f ( x) F
u 0
( u ) e j 2ux / M
x = 0,…,M-1
1
u 0.02 Hz
100 0.5
2-D IDFT
M 1 N 1
f ( x, y ) F (u, v )e
u 0 v 0
j 2 ( ux / M vy / N )
x = 0 ,…, M-1
y = 0 ,…, N-1
2-Dimensional Discrete Fourier Transform (cont.)
1 1
u v
M x Ny
where
x = spatial resolution in x direction
y = spatial resolution in y direction
1-D
DFT
f(x,y) by row F(u,y)
1-D DFT
by column
F(u,v)
How to Perform 2-D DFT by Using 1-D DFT (cont.)
Alternative method
f(x,y)
1-D DFT
by column
1-D
DFT
F(x,v) by row F(u,v)
Periodicity of 1-D DFT
M 1
1
From DFT: F (u )
M
f ( x )e
x 0
j 2ux / M
-N 0 N 2N
F (u )
f(x)
DFT
0 N-1 0 N-1
0 N-1 F (u )
-M
We display only
2M in this range
-N 0 N 2N (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Conventional Display for 2-D DFT
2D FFTSHIFT
(Images from Rafael C. Gonzalez and Richard E. High frequency area Low frequency area
Wood, Digital Image Processing, 2nd Edition.
2-D FFT Shift (cont.) : How it works
-M
Display of 2D DFT
After FFT Shift
M
Original display
2M
of 2D DFT
-N 0 N 2N
2D DFT
Original image
2D FFT Shift
Example of 2-D DFT
2D DFT
Original image
2D FFT Shift
Basic Concept of Filtering in the Frequency Domain
From Fourier Transform Property:
g ( x , y ) f ( x , y ) h ( x , y ) F ( u, v ) H ( u, v ) G ( u, v )
H(u,v)
F(u,v) g(x,y)
(User defined)
FFT shift
X 2D IFFT
2D FFT
FFT shift
f(x,y) G(u,v)
In this case, F(u,v) and H(u,v) must have the same size and
have the zero frequency at the center.
Multiplication in Freq. Domain = Circular Convolution
40
20
g(x)
0
0 20 40 60 80 100 120
Multiplication in Freq. Domain = Circular Convolution
Original H(u,v)
image Gaussian
Lowpass
Filter with
D0 = 5
Filtered image
(obtained using
circular convolution)
0.5
Concatenation
0
0 50 100 150 200 250
1 g(x)
0.5
0 Padding zeros
0 50 100 150 200 250 Before DFT
40
Keep only this part
20
0
0 50 100 150 200 250
Linear Convolution by using Circular Convolution and Zero Padding
Filtered image
Lowpass Filter
Highpass Filter
1 D (u, v ) D0
H ( u, v )
0 D (u, v ) D0
where D(u,v) = Distance from (u,v) to the center of the mask.
The smaller D0, the more high frequency components are removed.
Results of Ideal Lowpass Filters
1 D (u, v ) D0
H ( u, v )
0 D (u, v ) D0
Surface Plot
0.8
0.6
with D0 = 5 0.2
20
20
0
0
Abrupt change in the amplitude -20 -20
How ringing effect happens (cont.)
Surface Plot
-3
x 10
15
20
20
0
Ripples that cause ringing effect -20 -20
0
How ringing effect happens (cont.)
Note: the Gaussian filter is the only filter that has no ripple and
hence no ringing effect.
Gaussian Lowpass Filter (cont.)
D 2 ( u ,v ) / 2 D0 2
H ( u, v ) e
1
0.8
0.6
Gaussian lowpass
0.4 filter with D0 = 5
0.2
20
20
0
0
-20 -20
0.03
with D0 = 5 0
20
20
0
0
-20 -20
Gaussian shape
Results of Gaussian Lowpass Filters
No ringing effect!
Original image
Softer-Looking
Hhp = 1 - Hlp
0 D (u, v ) D0
H ( u, v )
1 D (u, v ) D0
where D(u,v) = Distance from (u,v) to the center of the mask.
D 2 ( u ,v ) / 2 D0 2
1 H ( u, v ) 1 e
0.8
0
60
60
40 50
40
20 30
20
10
3000
2000
with D0 = 5 60
60
40 50
40
20 30
20
10
Spatial Responses of Highpass Filters
Ripples
x y
We get
2 u 2 v 2
Image of
–(u2+v2)
f hb ( x, y ) Af ( x, y ) f lp ( x, y )
f hb ( x, y ) ( A 1) f ( x, y ) f ( x, y ) f lp ( x, y )
f hb ( x, y ) ( A 1) f ( x, y ) f hp ( x, y )
H hp (u, v ) 1 H lp (u, v )
H hb (u, v ) ( A 1) H hp (u, v )
p 2 P
2 P P 2 P
f f hp 2 P
A=2 A = 2.7
a = 0.5, b = 2
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Homomorphic Filtering
An image can be expressed as
f ( x, y ) i ( x, y ) r ( x, y )
i(x,y) = illumination component
r(x,y) = reflectance component