DIP Chap 4 (Filtering in the Frequency Domain) Lect 11
Transcript of DIP Chap 4 (Filtering in the Frequency Domain) Lect 11
![Page 2: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/2.jpg)
Lowpass Filtering in the Frequency DomainThree types of low pass filters:
1. Ideal filters2. Butterworth filters (parameter: filter
order)3. Gaussian filters
![Page 3: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/3.jpg)
Ideal Filter (Lowpass)
A 2-D ideal low-pass filter:
0
0
),( if 0
),( if 1),(
DvuD
DvuDvuH
where D0 is a specified nonnegative quantity and D(u,v) is the distance from point (u,v) to the center ofthe frequency rectangle.
• Center of frequency rectangle: (u,v)=(M/2,N/2)• Distance from any point to the center (origin) of the Fourier Transform:
2/122 ))2/()2/(),( NvMuvuD
![Page 4: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/4.jpg)
Ideal Low pass filter
![Page 5: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/5.jpg)
Ideal Low pass filter:
all frequencies inside a circle of radius D0 are passed with no attenuation
all frequencies outside this circle are completely attenuated.
![Page 6: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/6.jpg)
Ideal Filter (Lowpass)Cutoff-frequency: the point of transition between
H(u,v)=1 and H(u,v)=0 (D0)
To establish cutoff frequency loci, we typically compute circles that enclose specified amounts of total image power PT.
1
0
1
0
),(M
u
N
vT vuPP
2),(),( vuFvuP where
![Page 7: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/7.jpg)
Fourier Spectrum with different radiiFourier Spectrum with different radii
![Page 8: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/8.jpg)
8% power removed
0.5% power removed
2% power removed
5.4% power removed
3.6% power removed
![Page 9: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/9.jpg)
Blurring with little or no ringingButterworth low pass filter (BLPF)
Gaussian low pass filter (GLPF)
![Page 10: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/10.jpg)
2
0
1( , )
( , )1
nH u v
D u v
D
where
2/122 ))2/()2/(),( NvMuvuD
The transfer function of a Buterworth low pass filter (BLPF) of order n, and with cutoff frequency at a distance D0 from the origin, is
![Page 11: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/11.jpg)
Sharp Discontinuity
Does not have sharp Discontinuity
![Page 12: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/12.jpg)
Butterworth Filter (Lowpass)To define a cutoff frequency locus: at points
for which H(u,v) is down to a certain fraction of its maximum value.
When D(u,v) = D0, H(u,v) = 0.5
i.e. down 50% from its maximum value of 1.
![Page 13: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/13.jpg)
![Page 14: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/14.jpg)
Smooth transition of blurring as a function of increasing cutoff frequency for n=2 and D0= 5, 15, 30, 80, 320
ILPF results BLPF results with n=2
![Page 15: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/15.jpg)
A Butterworth filter of order 1 has no ringing. Ringing generally is imperceptible in filter of order 2 , but can become a significant factor in filter of higher order. (with cutoff frequency of 5 pixels)
n = 1 n = 2 n = 5 n = 20
![Page 16: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/16.jpg)
Summary of BLPFBLPF of order 1 has no ringing at all.BLPF of order 2 shows mild ringing but
small as compared to ILPF.BLPF of higher order have significant
ringing effect.BLPF of order 20 = ILPF
BLPF of order 2 is a good compromise between effective low pass filtering and acceptable ringing characteristics.
![Page 17: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/17.jpg)
Gaussian Low Pass Filter
2
2
2
),(
),( vuD
evuH
where sigma is a measure of the spread of the Gaussian curve . Let sigma = D0, then
20
2
2
),(
),( D
vuD
evuH
When D(u,v) = D0 , the filter is down to 0.607 of its maximum value
Gaussian low pass filters (GLPFs) in two dimensions is
D(u,v) is the distance from the origin of the Fourier Transform
![Page 18: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/18.jpg)
Gaussian Low Pass Filters
![Page 19: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/19.jpg)
![Page 20: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/20.jpg)
Comparison of GLPF with BLPFSmooth transition in blurring as a function
of increasing cutoff frequency.GLPF did not achieve as much smoothing as
the BLPF of order 2 for the same value of cutoff frequency because the profile of GLPF is not as tight as that of BLPF.
It is assumed that no ringing in GLPF.BLPF is a suitable choice where tight
control of the transition between low and high frequencies about the cutoff frequency are needed.
The price of this additional control over the filter profile is the possibility of ringing
![Page 21: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/21.jpg)
Example from machine perception GLPF with D0=80 (Application to Character Recognition )
Fax transmissionDuplicate materialHistorical records
![Page 22: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/22.jpg)
Sharpening frequency domain filters• Image can be blurred by attenuating the high frequency components• Edges and other abrupt changes in gray levels are associated with high
frequency components • Image can be sharpened by attenuating low frequency components i.e.
HP filtering
( , ) 1 ( , )hp lpH u v H u v
Three types of High Pass Filters:1.Ideal High Pass Filters (IHPF)2.Butterworth filter (BHPF)3.Gaussian filter (GHPF)
Transfer function of LP filter
When LP filters attenuates frequencies HP filter passes them and vice versa
![Page 23: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/23.jpg)
Sharpening frequency domain filtersB
HP
F r
epre
sen
ts a
tra
nsi
tion
bet
wee
n t
he
shar
pn
ess
of t
he
idea
l fil
ter
and
th
e to
tal
smoo
thn
ess
of t
he
Gau
ssia
n f
ilte
r
![Page 24: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/24.jpg)
Spatial Representation of a frequency domain filter
Multiply H(u,v) by (-1)u+v for centeringComputing the inverse DFTMultiplying the real part of inverse DFT by (-1)x+y
![Page 25: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/25.jpg)
Ideal Filter (Highpass)
A 2-D ideal low-pass filter:
0
0
),( if 1
),( if 0),(
DvuD
DvuDvuH
where D0 is a specified nonnegative quantity and D(u,v) is the distance from point (u,v) to the center of the frequency rectangle.
• Center of frequency rectangle: (u,v)=(M/2,N/2)• Distance from any point to the center (origin) of the FT:
2/122 ))2/()2/(),( NvMuvuD
![Page 26: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/26.jpg)
Same ringing properties as ILPF
![Page 27: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/27.jpg)
IHPF with D0=15, 30, 80
![Page 28: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/28.jpg)
Butterworth Filter (Highpass)This filter does not have a sharp
discontinuity establishing a clear cutoff between passed and filtered frequencies.
nvuDDvuH
20 )],(/[1
1),(
![Page 29: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/29.jpg)
BHPF with D0=15, 30, 80• BHPF behave smoother than IHPF• The boundaries are less distorted than the result of IHPF even for
smallest value of cutoff frequency• The transition into higher values of cutoff frequencies is mush smoother
with BHPF
![Page 30: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/30.jpg)
Gaussian High Pass Filter2
2
2
),(
1),( vuD
evuH
Where sigma is a measure of the spread of the Gaussian curve . Let sigma = D0, then
20
2
2
),(
1),( D
vuD
evuH
![Page 31: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/31.jpg)
GHPF GHPF
D0 = 15 D0 = 30 D0 = 80
Better results than IHPF and BHPF, even the filtering of the smaller objects and thin bars is cleaner with the Gaussian filter
![Page 32: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/32.jpg)
The Laplacian in Frequency Domain
If the centre of the filter function is shifted to (M/2, N/2)
![Page 33: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/33.jpg)
The Laplacian filtered image in the spatial domain is obtained by computing the inverse Fourier transform of
In Fourier Transform pair notation
![Page 34: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/34.jpg)
The Laplacian in the frequency domainThe Laplacian in the frequency domain
![Page 35: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/35.jpg)
We form an enhanced image g(x,y) by subtracting the Laplacian from the original image
As in the spatial domain, where we obtained the enhanced image with a single mask, it is possible to perform the entire operation in the frequency domain with only one filter
2 2
2 2
1 2 2
( , ) ( , ) ( / 2) ( / 2) ( , )
( , ) 1 ( / 2) ( / 2) ( , )
( , ) 1 ( / 2) ( / 2) ( , )
G u v F u v u M v N F u v
G u v u M v N F u v
g x y u M v N F u v
![Page 36: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/36.jpg)
Scaled image
![Page 37: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/37.jpg)
Operated in frequency domain
Operated in spatial domain
![Page 38: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/38.jpg)
High boost filtering
),(),(),( yxfyxAfyxf lphb
),(),(),()1(),( yxfyxfyxfAyxf lphb
),(),()1(),( yxfyxfAyxf hphb
( , ) ( , ) ( , )mask lpg x y f x y f x y
High boost filtering generalized this by multiplying f(x,y) by a constant A ≥ 1
),(1),( vuHvuH lphp
hb hpH (u, v) (A 1) H (u, v)
In high pass filters average background intensity reduced to nearblack because of zero frequency component elimination
![Page 39: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/39.jpg)
Highboost filtering in the frequency domainHighboost filtering in the frequency domain
Original Image High pass filtered(Laplacian)
),(),()1(),( yxfyxfAyxf hphb
A = 2A = 2.7
![Page 40: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/40.jpg)
End Chapter 4
?
![Page 41: DIP Chap 4 (Filtering in the Frequency Domain) Lect 11](https://reader033.fdocuments.in/reader033/viewer/2022061123/5470f8c1b4af9f0f708b45ef/html5/thumbnails/41.jpg)
44
MATLABMATLAB functions