Gaussian low pass filter

advertisement
Image Processing
Ch4:
Filtering in frequency domain
Prepared by: Tahani Khatib
AOU
1
Part 2
Filtering in frequency domain
2
Frequency Domain Filtering & Spatial
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
Ch4, lesson 8: The basics of filtering in the Frequency Domain (FD)
introduction


It consists of modifying the FT of an input image and
then finding the IFT to get the output image.
Mathematically its given by:
G(u,v)= H(u,v)F(u,v)
4
Ch4, lesson 8: The basics of filtering in the Frequency Domain (FD)
Steps of frequency domain filter
Multiply the input image by (-1)x+y
2. Compute F(u,v)
3. Multiply F(u,v) by a filter function
H(u,v)
4. Compute the inverse DFT
5. Obtain the real part
6. Multiply the real part by (-1)x+y
5
Ch4, lesson 8: The basics of filtering in the Frequency Domain (FD)
Steps of frequency domain filter
1.
2.
3.
4.
5.
6.
7.
8.
Given an input image f(x,y) of size MxN, select the padding
parameters P=2M and Q=2N.
Form a padded image of size PxQ by appending the necessary
zeros to f(x,y).
Multiply
padded image
by
(-1)(x+y) to center its
transform.
Compute the DFT F(u,v) of the image from step 3.
Generate a real, symmetric filter function H(u,v) of size PxQ.
Form the product G(u,v)=H(u,v)F(u,v).
Find the processed image by computing the real part of the IDFT
of G(u,v)
Multiply above by by
(-1)(x+y)
get g(x,y) from above step by extracting an MxN region from
top left quadrant.
6
Ch4, lesson 9: correspondence between FD & SD filters
Correspondence between FD and SD filtering:


SD: filtering is given by discrete convolution
Correlation is…

FD: Discrete convolution in FD is equivalent to
multiplication

Filtering can be done in either domain.
7
SD VS FD filters
Low pass
High pass
Average filters
laplace filters
8
Ch4, lesson 10: low pass & high pass filters in FD
Low pass & High pass filters in FD

Low-pass filter: A filter that attenuates high frequencies while
passing low frequencies.- used for blurring (smoothing)

High-pass filter: A filter that attenuates low frequencies while
passing high frequencies. used for sharpening
9
Ch4, lesson 10: low pass & high pass filters in FD
Low pass & High pass filters in FD
1) Low pass - Smoothing filters
1.1) Ideal lowpass filters (very sharp)
1.2) Butterworth lowpass filters
1.3) Gaussian lowpass filters (very smooth)



Butterworth filter parameter: filter order
High values: filter has the form of the ideal filter.
Low values: filter has the form of the Gaussian filter.
2) High pass- Sharpening filters
2.1) Ideal highpass filters
2.2) Butterworth highpass filters
2.3) Gaussian highpass filters
10
Ch4, lesson 10: low pass & high pass filters in FD
1) Low pass – image smoothing
Image smoothing using FD filters

Noise is usually high frequency.

Hence noise removal is usually termed smoothing or blurring.

Smoothing is achieved by lowpass filters (LPFs).

3 types of LPFs will be studied i.e. Ideal LPF, Butterworth LPF and
Gaussian LPF.

Note/Caution: Image details and edges have high frequency
characteristics.
11
Ch4, lesson 10: low pass filters
1) Low pass - image Smoothing
Smoothing filters:
1.1) Ideal low pass filters (ILPF)
1 if D(u, v)  D0
H (u, v)  
0 if D(u, v)  D0
1.2) Butterworth low pass filters (BLPF)
H (u, v) 
1
1  [ D(u, v) / D0 ]2 n
1.3) Gaussian low pass filters (GLPF)
H (u, v)  e
 D2 (u ,v ) / 2 D0 2
Ch4, lesson 11: ILPF
1.1) 2-D Ideal low pass filter ILPF
The simplest lowpass filter is ILPF, it (cuts off) all high
frequency components that are at distance greater
than a specified distance: D0 from the center
1 if D(u, v)  D0
H (u, v)  
0 if D(u, v)  D0
Where
 D(u,v) is the distance from (u,v) to the center of the frequency rectangle
 Image size: MxN
 Center of the frequency rectangle: (u,v) = (M/2, N/2)
 Distance to the center: D(u,v) = [(u – M/2)2 + (v – N/2)2]1/2
13
‫‪Ch4, lesson 11: ILPF‬‬
‫?‪How does ILPF function works‬‬
‫•نضرب قيم هذا الماسك )‪ H(u,v‬بالقيم المكافئة لها بالصورة )‪ .F(u,v‬فنحصل فقط على ال ‪ frequencies‬داخل‬
‫الدائرة‬
‫•دائما منتصف الصورة تحمل اهم المعلومات عنها ( اي معظم معلومات الصورة)‪ ,‬بينما تتوزع التفاصيل‬
‫•كل ما‪14‬كبر نصف قطر الدائرة (اي ‪ ,)D0‬كل ما حصلنا على صورة اقرب لالصل‪ (.‬انظر الشريحة التالية)‬
‫‪Ch4, lesson 11: ILPF‬‬
‫كل ما كبر نصف قطر الدائرة (اي ‪,)D0‬‬
‫كل ما حصلنا على صورة اقرب لالصل‬
‫دائما منتصف الصورة تحمل اهم‬
‫المعلومات عنها ( اي معظم معلومات‬
‫الصورة)‪ ,‬بينما تتوزع التفاصيل‬
‫‪15‬‬
‫‪total image power %‬‬
‫‪92.0‬‬
‫‪94.6‬‬
‫‪96.4‬‬
‫‪98‬‬
‫‪99.5‬‬
‫‪Radius‬‬
‫‪5‬‬
‫‪15‬‬
‫‪30‬‬
‫‪80‬‬
‫‪230 pixels‬‬
Ch4, lesson 11: ILPF
Ideal Low Pass Filter results
Original
image
Ringing is a characteristics of
ideal Filter
Result of filtering
with ideal low
pass filter of
radius 15
Result of filtering
with ideal low
pass filter of
radius 80
Result of filtering
with ideal low
pass filter of
radius 5
Result of filtering
with ideal low
pass filter of
radius 30
Result of filtering
with ideal low
pass filter of
radius 230
16
Ideal lowpass filtering is not very practical but they can be implemented on a computer to study
their behavior.
Ch4, lesson 11: ILPF
Blurring and ringing feature of ILPFs:
The ILPF has sharp cutoffs or discontinuities which cause ringing.
 The ILPF has a sink function behaviour in the SD.
 The center of lobe is the cause for blurring but the outer smaller
lobes cause ringing.
 We want to achieve blurring with little ringing.
17
Ch4, lesson 12: BLPF
1.2) Butterworth low pass filter - BLPF:
ILPF transfer function has sharp discontinuities.
BLPF transfer function does not have sharp discontinuities in order
to reduce ringing.
The transfer function of a Butterworth lowpass filter of order n with
cutoff frequency at distance D0 from the origin is defined as:
1
H (u, v) 
1  [ D(u, v) / D0 ]2 n
18
Ch4, lesson 12: BLPF
Butterworth low pass filter - BLPF:
1
H (u, v) 
1  [ D(u, v) / D0 ]2 n
Note:
H(U,V) =0.50 (50% from its maximum value of 1) when D(u,v) =D0
19
Ch4, lesson 12: BLPF
Butterworth Lowpass Filter (cont…)
Original
image
Ringing is not visible in
any of these images.
Result of filtering
with Butterworth
filter of order 2
and cutoff radius
15
Result of filtering
with Butterworth
filter of order 2
and cutoff radius
80
Result of
filtering with
Butterworth
filter of order 2
and cutoff radius
5
Result of
filtering with
Butterworth
filter of order 2
and cutoff
radius 30
Result of
filtering with
Butterworth
filter of order 2
and cutoff radius
Ch4, lesson 12: BLPF
Ringing increases with filter order (n) as
seen in SD
Ch4, lesson 13: GLPF
1.3) Gaussian Lowpass Filters -GLPF
The transfer function of a Gaussian
lowpass filter is defined as
2
H (u, v)  e
 D (u ,v ) / 2 D0 2
Note:
The IFT (INVERSE FOURIOUR) of Gaussian is also Gaussian. Hence there is no ringing effect.
Ch4, lesson 12: BLPF
Gaussian low pass filter - GLPF:
Note:
H(U,V) =0.667 when D(u,v) =D0
23
Ch4, lesson 13: GLPF
Gaussian Lowpass Filters (cont…)
No ringing
Original
image
Result of
filtering with
Gaussian filter
with cutoff
radius 5
Result of
filtering with
Gaussian filter
with cutoff
radius 15
Result of
filtering with
Gaussian filter
with cutoff
radius 30
Result of
filtering with
Gaussian
filter with
cutoff radius
Result of
filtering with
Gaussian filter
with cutoff
radius 230
Lowpass Filters Compared
Result of
filtering with
ideal low pass
filter of radius
15
Result of
filtering with
Gaussian filter
with cutoff
radius 15
Result of
filtering with
Butterworth
filter of order
2 and cutoff
radius 15
Lowpass Filtering Examples
A low pass Gaussian filter is used to connect
broken text
Machine recognition systems have
difficulty in reading broken characters.
GLPF with D0 = 80
Lowpass Filtering Examples
(cont…)
Different lowpass Gaussian filters used to
remove blemishes in a photograph
Ch4, lesson 14: high pass
2)High pass - image Sharpening
Blurring (smoothing) is achieved by attenuating
‫ التخلص‬the HF(high frequency) components of DFT of an
image. (low pass filters)

Sharpening is achieved by attenuating the LF (low
frequency) components of DFT of an image. Where
Edges and fine detail in images are associated with
high frequency components (high pass filters)

High pass filters – only pass the high frequencies,
drop the low ones. High pass frequencies are precisely
the reverse of low pass filters, so:
Hhp(u, v) = 1 – Hlp(u, v)
Ch4, lesson 14: high pass
2)High pass - image Sharpening
Sharpening filters:
2.1) Ideal high pass filters (IHPF)
0 if D(u, v)  D0
H (u, v)  
1 if D(u, v)  D0
2.2) Butterworth high pass filters (BHPF)
1
H (u, v) 
1  [ D0 / D(u, v)]2 n
2.3) Gaussian high pass filters (GHPF)
H (u, v)  1  e
 D2 (u ,v ) / 2 D02
Ch4, lesson 15: IHPF
2.1) Ideal High Pass Filters
The ideal high pass filter is given as:
0 if D(u, v)  D0
H (u, v)  
1 if D(u, v)  D0
where D0 is the cut off distance as before
Ch4, lesson 15: IHPF
Ideal High Pass Filters (cont…)
Results of ideal
high pass filtering
with D0 = 15
Results of ideal
high pass filtering
with D0 = 30
Results of ideal
high pass filtering
with D0 = 80
Ch4, lesson 16: BHPF
Butterworth High Pass Filters
The Butterworth high pass filter is given as:
1
H (u, v) 
1  [ D0 / D(u, v)]2 n
where n is the order and D0 is the cut off
distance as before
Ch4, lesson 16: BHPF
Butterworth High Pass Filters (cont…)
Results of
Butterworth
high pass
filtering of
order 2 with
D0 = 15
Results of
Butterworth
high pass
filtering of
order 2 with
D0 = 80
Results of Butterworth high pass
filtering of order 2 with D0 = 30
Ch4, lesson 17: GHPF
Gaussian High Pass Filters
The Gaussian high pass filter is given as:
H (u, v)  1  e
 D2 (u ,v ) / 2 D02
where D0 is the cut off distance as before
Ch4, lesson 17: GHPF
Gaussian High Pass Filters (cont…)
Results of
Gaussian
high pass
filtering with
D0 = 80
Results of
Gaussian
high pass
filtering with
D0 = 15
Results of Gaussian high
pass filtering with D0 = 30
Highpass Filter Comparison
BF represents a transition
between the sharpness
of the IF and the
smoothness of the GF
GF ‫ و‬IF ‫ مرحلة وسطية بين‬BF ‫يعني يعتبر‬
GF ‫ حاد للغاية بينما يمتاز‬IF ‫حيث يعتبر‬
‫بنعومته‬
Highpass Filter Comparison
Results of ideal
high pass filtering
with D0 = 15
Results of Butterworth
high pass filtering of
order 2 with D0 = 15
Results of Gaussian
high pass filtering with
D0 = 15
The 3 HPF SD representation
Download