Digital Image Processing: Image Enhancement: Filtering in The Frequency Domain
Digital Image Processing: Image Enhancement: Filtering in The Frequency Domain
Image Enhancement:
Filtering in the Frequency Domain
f3 w3
f4 w4
Periodic function f
7
of
41
The Big Idea (cont…)
Also there is a common • The frequency domain
characteristics that a
Taken from www.tfh-berlin.de/~schwenk/hobby/fourier/Welcome.html
for u 0,1,2,..., M 1
x 0 y 0
DFT
DFT
shift
23
of
The
The Property
Property of
of Two-Dimensional
Two-Dimensional DFT
DFT
41
Rotation
Rotation
DFT
DFT
24
of
The
The Property
Property of
of Two-Dimensional
Two-Dimensional DFT
DFT
41
Linear
Linear Combination
Combination
A
DFT
B
DFT
0.25 * A
+ 0.75 * B DFT
25
of
41 Filtering
Filtering in
in the
the Frequency
Frequency Domain
Domain
26
of
41
Some Basic Frequency Domain Filters
a circle of radius D0 from the origin simply cut off all high frequency
components that are at a specified distance D0 from the origin
changing the distance changes the behaviour of the filter
1 if D(u , v) D0
H (u , v)
Where
0 if D(u , v) D0
D0 is a positive constant threshold frequency and = and D(u,v) is the
distance between a point (u,v) in the frequency domain and the centre
of the frequency rectangle.
D(u,v) is given as:
D (u, v) [(u M / 2) (v N / 2) ]
2 2 1/ 2
32
of
41
Ideal Low Pass Filter (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Result of filtering
Original with ideal low
image pass filter of
radius 5
Result of filtering
Result of filtering
with ideal low
with ideal low
pass filter of
pass filter of
radius 230
radius 80
34
of
41
Butterworth Lowpass Filters
Butterworth is ILPF has a parameter called filter
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Result of filtering
Original with Butterworth
image filter of order 2 and
cutoff radius 5
Result of filtering
Result of filtering
with Butterworth
with Butterworth
filter of order 2 and
filter of order 2 and
cutoff radius 230
cutoff radius 80
36
of
41
Butterworth Lowpass Filter (cont…)
When D(u,v)= D0, the GLPF is down to 0.607 of its maximum value.
38
of
41
Gaussian Lowpass Filters (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Result of filtering
Original with Gaussian
image filter with cutoff
radius 5
Result of filtering
Result of filtering
with Butterworth
with ideal low
filter of order 2
pass filter of
and cutoff radius
radius 15
15
Result of filtering
with Gaussian
filter with cutoff
radius 15
40
of
41
Lowpass Filtering Examples
A low pass Gaussian filter is used to connect
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
broken text
41
of
41
Lowpass Filtering Examples (cont…)
Different lowpass Gaussian filters used to
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Original Gaussian
image lowpass filter
Spectrum of Processed
original image image
43
of
41
Sharpening in the Frequency Domain
0 if D(u , v) D0
H (u , v)
1 if D(u , v) D0
where D0 is the cut off distance as before
45
of
41
Ideal High Pass Filters (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
1
H (u , v)
1 [ D0 / D(u, v)] 2n
Results of Results of
Butterworth Butterworth
high pass high pass
filtering of filtering of
order 2 with order 2 with
D0 = 15 D0 = 80
D 2 ( u ,v ) / 2 D0 2
H (u , v) 1 e
where D0 is the cut off distance as before
49
of
41
Gaussian High Pass Filters (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Results of Results of
Gaussian Gaussian
high pass high pass
filtering with filtering with
D0 = 15 D0 = 80
of
41
High frequency 51
emphasis result Original image
of
41
Inverse DFT of 53
Laplacian in the Laplacian in the
frequency domain frequency domain
domain
in the frequency
2-D image of Laplacian
to spatial filter
of the image on
Zoomed section
Laplacian In The Frequency Domain
Original Laplacian
image filtered
image
Laplacian
Enhanced
image
image
scaled
55
of
41
Frequency Domain Steps Revisited
56
of
41
Fast Fourier Transform
The reason that Fourier based techniques
have become so popular is the development
of the Fast Fourier Transform (FFT)
algorithm
Allows the Fourier transform to be carried
out in a reasonable amount of time
Reduces the amount of time required to
perform a Fourier transform by a factor of
100 – 600 times!
57
of
41
FFT Continues
• FFT computes the DFT of sequence.
Converts a signal from its original domain
to frequency domain rapidly.
• Reduces the computation in order of
MNlog2 MN multiplications and additions.
• DFT is a mathematical operation. FFT is
an efficient algorithm for the evaluation of
that operation. It is the faster version of
DFT that can be applied when the number
of samples in the signal is a power of two.
58
of
Frequency Domain Filtering & Spatial
41 Domain Filtering
Similar jobs can be done in the spatial and
frequency domains
Filtering in the spatial domain can be easier
to understand
Filtering in the frequency domain can be
much faster – especially for large images
59
of
41
Summary
In this lecture we examined image
enhancement in the frequency domain
– The Fourier series & the Fourier transform
– Image Processing in the frequency domain
• Image smoothing
• Image sharpening
– Fast Fourier Transform
Next time we will begin to examine image
restoration using the spatial and frequency
based techniques we have been looking at
60
of
41
Questions?
?
61
of
41
Different enhancement approaches
Lowpass filter
Highpass filter
Homomorphic filter
61
62
of
41
Lowpass filtering
Ideal filter
– D(u, v): distance from point (u, v) to the origin
– cutoff frequency (D0) ì1 if D (u , v )£D0
H (u , v )=í
– nonphysical î0 if D(u , v )> D0
– radially symmetric about the origin
Butterworth filter
1
H (u, v )= 2n
1 + [D(u, v )/ D0 ]
Gaussian lowpass filter
- D 2 (u ,v )/ 2 D0 2
H (u , v )=e
62
63
of
41
63
64
of
Power ratio
41
99.9699.6599.0497.84
é ù
b =100 êå
ëu
å
v
P(u, v )/ PT (u , v )ú
û
64
65
of
41
Highpass filter
Ideal filter
ì0 if D(u , v )£D0
H (u , v )=í
î1 if D(u , v )> D0
Butterworth filter
1
H (u , v )= 2n
1 + [D0 / D(u, v )]
Gaussian highpass filter
- D 2 (u ,v )/ 2 D0 2
H (u , v )=1 - e
65
66
of
41
66
67
of
41
67
68
of
41
Example
68
69
of Laplacian frequency-domain
41
filters
• Spatial-domain Laplacian (2nd derivative)
• Fourier transform 2 f 2 f
f 2 2
2
x y
n f ( x)
( ju ) n
F (u )
x
n
2 f ( x, y ) 2 f ( x , y )
( ju ) 2
F (u , v ) ( jv ) 2
F (u , v)
x y
2 2
(u 2 v 2 ) F (u , v)
69
70
of Laplacian frequency-domain
41
filters
Input
F(u,v)
f(x,y) F
Laplacian -(u2+v2)
2
f 2
f
2 f 2 2
x y -(u2+v2)F(u,v)
F
71
spatial
72
of
41
original Laplacian
Scaled original+
Laplacian Laplacian
72
73
of
41 Image Enhancement - 3
Frequency vs. spatial domain
73
74
of
41
Homomorphic filtering
A simple image model
– f(x,y): the intensity is called the gray level for
monochrome image
– f(x, y) = i(x, y).r(x, y)
– 0 < i(x, y) < inf, the illumination
– 0< r(x, y) < 1, the reflectance
74
75
of
41
Image Enhancement - 3
75
76
of
41
Homomorphic filter (cont’)
f (x, y )=i (x, y )×r (x, y )
z (x, y )=ln f (x, y ) =ln i(x, y )+ ln r (x, y )
F {z (x, y )} =F {ln i (x, y )}+ F {ln r (x, y )}
Z (u, v) =Fi (u , v) + Fr (u , v)
gH > 1 - c ( D 2 ( u ,v ) / D02 )
H (u, v) =(gH - gL )[1 - e ] + gL
gL <1
78
80
of
41
80
81
of
41
Homomorphic filter - example
81
Point processing Mask processing • Frequency domain
82
of filters
(spatial filters)
41Simple gray level
transformations Smoothing filters (blur • Smoothing filters (blur
– Image negatives details) details)
– Log transformations – Average, weighted • Ideal lowpass filter
– Power-law average • Butterworth lowpass
transformations – Order statistics • Gaussian lowpass
– Contrast stretching • Sharpening filters
(e.g. median)
– Gray-level slicing (highlight details)
– Bit-plane slicing – Unsharp masking
Histogram processing Sharpening filters – High-boost filters
– Histogram (highlight details) – Derivative filters - The
equalization – Unsharp masking Laplacian
– *Histogram matching – Ideal highpass filter
– High-boost filters
(specification) – Butterworth highpass
Arithmetic/logic – Derivative filters filter
• The Laplacian – Gaussian highpass
operations
– Image averaging • The Gradient filter
• Homomorphic filtering
82
83
of
41
FFT and IFFT
83
84
of
41
END
(FREQUENCY DOMAIN FILTERING)