selected topics in computer engineering (0907779)...fundamentals of frequency filtering...
TRANSCRIPT
-
Selected Topics in Computer
Engineering (0907779)Engineering (0907779)
Filtering in the Frequency Domain – Part II
Chapter 4
Dr. Iyad Jafar
Chapter 4
Sections : 4.7-4.10
-
Outline
� Introduction
� Fundamentals of Filtering in Frequency DomainDomain
� Steps for Filtering in Frequency Domain
� Smoothing in Frequency Domain
� Sharpening in Frequency Domain
� Selective Filtering
� Homomorphic Filtering
2
-
Introduction� When the image is represented in frequency domain using
Fourier transform, it is almost impossible to make directassociation between the pixel values and their transform
� However, the following generalization can be made� However, the following generalization can be maderegarding the relation between the two representations
� Since frequency is related to spatial rates of change, wecan associate frequencies in the Fourier transform withpattern of intensity variations in the image
� For example� The slowest frequency component (u=v=0) is associated with� The slowest frequency component (u=v=0) is associated with
average intensity (DC component)
� Smooth intensity variations correspond to low frequencies suchas walls or cloudless sky
� High frequencies correspond to higher levels or abrupt intensityvariations such as edges and noise
3
-
Introduction
� Example 4.10.
� Note
� The correspondence between the strong edges at angles45 and -45 and the presence of high intensity frequenciesThe correspondence between the strong edges at angles45 and -45 and the presence of high intensity frequenciesin the same direction
� A little variation that is off the vertical access in thefrequency domain which is associated by the oxideprotrusion variation in the vertical axis in the image
4
-
Fundamentals of Frequency
Filtering� Generally, image filtering in the frequency domain consists
primarily of the following steps
1) Computing the Fourier transform of the image1) Computing the Fourier transform of the image
2) Modifying the magnitude of image spectrum using specificoperation
3) Taking the inverse Fourier transform of the result
� The basic filtering operation can be expressed as
where H(u,v) is called the filter function and it is of same
[ ]1g( x,y ) H(µ,υ )F( µ,υ )−= ℑwhere H(u,v) is called the filter function and it is of samesize as F(u,v)
� Filtering is performed usually by using real filter functionsH(u,v) as we don’t want to modify the structure of the imagewhich is contained in the phase of F(u,v)
5
-
� One simple filter is
Fundamentals of Frequency
Filtering
0 0 , µ υH( µ,υ )
= ==
� Simply this filter sets the average intensity value (the dcvalue) to zero. We should expect the output image to bedarker than the original
0 0
1
, µ υH( µ,υ )
, otherwise
= ==
6
[ ]1 H( µ,υ )F( µ,υ )−ℑ
-
Fundamentals of Frequency
Filtering� Common filter functions
� Lowpass filter: it is used to attenuate high frequency componentsof the image.Thus, the output image appears blurredof the image.Thus, the output image appears blurred
� Highpass filter: it is exactly the opposite of lowpass filter, i.e. itattenuates low frequency components. It enhances sharp details inthe image but reduces image contrast
Attenuation of Attenuation of low frequencies
Lowpass Filter Highpass Filter7
Attenuation of high frequencies
low frequencies
-
Fundamentals of Frequency
Filtering� Common filter functions
�Example 4.11
Original
8
Lowpass Filtered Highpass Filtered
-
Fundamentals of Frequency
Filtering� Filter Function Design Considerations
� Effect on the phase: the filtering equation
can be written as
Thus, if H(u,v) is real (we call it zero-phase-shift filter) , then thephase of F(u,v) is not changed. This is an essential requirement
[ ]1g( x,y ) H(µ,υ )F( µ,υ )−= ℑ
[ ]1g( x,y ) H(µ,υ )Real( F(µ,υ )) jH( µ,υ )imag( F(µ,υ ))−= ℑ +
phase of F(u,v) is not changed. This is an essential requirementsince as we saw earlier, the phase of the spectrum specifies thestructure of the image objects
� So it’s important to preserve the phase of the original image when filtering9
-
Fundamentals of Frequency
Filtering� Filter Function Design Considerations
� Effect of changing the phase - example
10
Original Image reconstructed by multiplying the phase by 0.5 without changing
|F(u,v)|
Image reconstructed by multiplying the phase by 0.25 without changing
|F(u,v)|
-
Fundamentals of Frequency
Filtering� Filter Function Design Considerations
� Padding filters with Zeros: the filtering equation
[ ]1g( x,y ) H(µ,υ )F( µ,υ )−= ℑimplies convolution in the spatial domain and requires H(u,v) to beof the same size as F(u,v). So, do we pad the filter in the spatialdomain or in the frequency domain to avoid wraparound errors ??
� Answer: we usually zero-pad the original image such that its sizeis at least 2Mx2N then we specify the desired filter in thefrequency domain with the same size as the padded image
[ ]1g( x,y ) H(µ,υ )F( µ,υ )−= ℑ
frequency domain with the same size as the padded image
� Why? We are concerned about the filter shape in the frequencydomain. If we define the filter in the frequency domain, find itsIDFT, pad it with zeros, and then compute the DFT of the paddedfilter, then the padded filter in the frequency domain is not exactlythe same as the original unpadded filter
11
-
Fundamentals of Frequency
Filtering� Filter Function Design Considerations
� Padding filters with Zeros – 1D Example
Filter specified in frequency
domain IDFT
Filter in spatialdomain
12
Filter in spatialDomain padded
with zeros DFT
Ringing Effect
-
Fundamentals of Frequency
Filtering� Steps for Filtering in the Frequency Domain
1) Multiply f(x,y) by (-1)x+y to center its transform
2) For a MxN input image f(x,y), zero pad the image with M zeros in the 2) For a MxN input image f(x,y), zero pad the image with M zeros in the vertical direction and N zeros in the horizontal direction to form the padded image fp(x,y)
3) Compute the DFT, F(u,v), of fp(x,y)
4) Generate a real, symmetric filter function, H(u,v), of size 2Mx2N that is centered at M and N
5) Perform filtering by computing the product G(u,v) = H(u,v)F(u,v)5) Perform filtering by computing the product G(u,v) = H(u,v)F(u,v)
6) Obtain the processed image by computing the IDFT of G(u,v)
7) Extract the filtered image g(x,y) of size MxN from the top-left quadrant of gp(x,y)
8) Multiply g(x,y) by (-1)x+y13
[ ] [ ]1 1pg ( x,y ) G( u,v ) H(µ,υ )F( µ,υ )− −= ℑ = ℑ
-
Fundamentals of Frequency
Filtering
� Example 4.12. Steps for Filtering in the Frequency Domain
Original image Size MxN
Original multiplied by (-1) x+y
Padding*(-1)x+y DFT
14
Original padded with zeros Size 2Mx2N
-
Fundamentals of Frequency
Filtering
� Example 4.12. Continued
15
Magnitude of Spectrum |F(u,v)|
Size 2Mx2N
Specified Filter H(u,v) Size 2Mx2N
G(u,v) = |H(u,v) F(u,v)|Size 2Mx2N
-
Fundamentals of Frequency
Filtering
� Example 4.12. Continued
ExtractIDFT
16
Filtered image g p(x,y)Size 2Mx2N
Filtered image g(x,y) Size MxN
-
Fundamentals of Frequency
Filtering� Correspondence Between Spatial and Frequency
Filtering
� According to the convolution theorem, multiplication in� According to the convolution theorem, multiplication infrequency domain is equivalent to convolution in the spatialdomain
� As we saw earlier, the filter function is of the same size as theimage.
� However, when we discussed spatial filtering, we used smallerfilter masks !! How can we explain this ?!filter masks !! How can we explain this ?!
� We usually use the IDFT of the filter function h(x,y) as aguidance in reconstructing small spatial filtering masks thatwould achieve the same task� Faster processing
� The spatial mask coefficients are selected to capture the essence of fullfilter function17
-
Fundamentals of Frequency
Filtering� Correspondence Between Spatial and Frequency
Filtering
� 1-D Example � 1-D Example
IDFT
1 1 1
1 1 1
1 1 1
1/9*
1 2 1
2 4 2
1 2 1
1/16*
18
IDFT
-1 -1 -1
-1 8 -1
-1 -1 -1
0 -1 0
-1 4 -1
0 -1 0
-
Fundamentals of Frequency Filtering� Correspondence Between Spatial and Frequency
Filtering Filtering in the spatial domain
1 1 1 1 1
1 1 1 1 1
Original
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
* 1/25
h(x,y)H(u,v)
Filtering in the frequency domain using
020
4060
80100
0
50
100-0.02
0
0.02
0.04
0.06
0.08
020
4060
80100
0
50
1000
0.2
0.4
0.6
0.8
1
19
-
Smoothing Using Frequency
Filtering� Smoothing or blurring is achieved in the frequency domain
by using lowpass filters
As the name indicates, lowpass filters preserve the low� As the name indicates, lowpass filters preserve the lowfrequency components of the image while attenuating thehigh frequency components
� Common lowpass filters
� Ideal
� Butterworth
Gaussian� Gaussian
� In the following, we compare the performance of thesetypes
� Keep in mind that we are talking about discrete filters thatare centered in the middle of the spectrum20
-
Smoothing Using Frequency
Filtering
� Ideal Lowpass Filter (ILPF)
� ILPF passes all frequencies within a circle of radius D0 fromthe center of the spectrum (P/2,Q/2) and cuts all frequencies
0
the center of the spectrum (P/2,Q/2) and cuts all frequenciesoutside this circle
� The ILPF is defined as
where
1 0
0
, D(µ,υ ) DH( µ,υ )
0 , D(µ,υ ) > D
≤=
is the distance from each pixel to the center of the frequency rectangle (P/2,Q/2)
� The radius D0 is called the cutoff frequency 21
1 22 22 2/
D( µ,υ ) ( µ P / ) (υ Q / ) = − + −
-
0.6
0.8
1
µ,ν)
Smoothing Using Frequency
Filtering
D0
020
4060
80100
0
50
1000
0.2
0.4
µν
H( µ
ILPF Displayed as image ILPF Transfer Function
22
Filter Radial Cross Section
D0
-
Smoothing Using Frequency
Filtering� Using Power Spectrum in Defining Filters
� One way to define the cutoff frequency is to compute circlesthat enclose specified amounts of total image power PT whichthat enclose specified amounts of total image power PT whichis defined as
If the DFT of the filter is centered, then a circle with radiusD0 with origin at the center of frequency rectangle encloses
1 11 12
0 0 0 0
− −− −
= = = =
= =∑∑ ∑∑Q QP P
T
u v u v
P P( u ,v ) F( u ,v )
D0 with origin at the center of frequency rectangle enclosesα-percent of the power
and summation is for all values of u and v that fall inside thecircle
23
100 Tu v
α P( u,v ) / P= ∑∑
-
Smoothing Using Frequency
Filtering� Using Power Spectrum in Defining Filters
D0 α
10 87.0
24
10 87.0
30 93.1
60 95.7
160 97.8
460 99.2
-
Smoothing Using Frequency
Filtering� Example 4.13. Ideal Lowpass Filter
� Let’s smooth the image in the previous slide with ILPF withcutoff frequencies 10,30,60,160, and 460
D0 =10 D0 =30
Ringing Effect
25D0 =60 D0 =160 D0 =460
-
Smoothing Using Frequency
Filtering� Ideal Lowpass Filter
� Why Ringing Effects ?
� We saw earlier that the cross section of ILPF in the frequency� We saw earlier that the cross section of ILPF in the frequencydomain is a pulse. It is expected that the IDFT of ILPF h(x,y) is asinc function.
� According to the convolution theorem, the multiplicationperformed in the frequency domain implies convolving the h(x,y)with f(x,y).
� If we think of f(x,y) as set of impulses, each with a weight thatrepresents pixel intensity, then convolution simply replaces arepresents pixel intensity, then convolution simply replaces areplica of h(x,y) at each impulse.
� The main lobs of the sinc function are responsible for blurringwhile the side lobs are responsible for ringing
� As the radius of the ILPF increase, its IDFT (the sinc function)approaches an impulse. In this case blurring and ringing isreduced.26
-
Smoothing Using Frequency
Filtering� Ideal Lowpass Filter - Why Ringing Effects ?
10
x 10-3
ILPFH(u,v)
ILPFh(x,y)
270
2040
6080
100
0
50
100-2
0
2
4
6
8
xy
h(x
,y)
ILPFh(x,y)
ILPF Cross section
-
Smoothing Using Frequency
Filtering� Butterworth Lowpass Filter (BLPF)
� The BLPF is defined as
1
� n is called the order of the filter. As n increases, the steepnessof BLPF increases and approaches that of ILPF
� Unlike ILPF, the BLPF has no sharp discontinuity that gives aclear cutoff between filtered and passed frequencies
[ ]201
1n
H( µ,υ )D( µ,υ ) / D
=+
clear cutoff between filtered and passed frequencies
� The cutoff frequency is usually defined as the locus of pointsfor which H(u,v) is down to a certain fraction of its maximumvalue; usually 50% (-3dB).
28
-
0.8
1
� Butterworth Lowpass Filter (BLPF)
Smoothing Using Frequency
Filtering
020
4060
80100
0
50
1000
0.2
0.4
0.6
µν
H( µ
, ν)
BLPF Displayed as image
BLPF Transfer Function
29
Filter Radial Cross Section
0 5 10 15 20 25 30 35 40 45 500
0.2
0.4
0.6
0.8
1
D(µ,ν)
H( µ
, ν)
-
� Butterworth Lowpass Filter (BLPF)
� Effect of Changing BLPF order – Frequency Domain
Smoothing Using Frequency
Filtering
As n increases, the BLPF approaches ILPF 30
-
� Butterworth Lowpass Filter (BLPF)
� Effect of Changing BLPF order – Spatial Domain
Smoothing Using Frequency
Filtering
As n increases, the ringing effect is more pronounced 31
-
� Example 4.14. Butterworth Lowpass Filter (BLPF)
Smoothing Using Frequency
Filtering
D0 =10 D0 =30
BLPF order is 232
D0 =60 D0 =160 D0 =460
-
Smoothing Using Frequency
Filtering� Gaussian Lowpass Filter (GLPF)
� The GLPF is defined as
� Unlike ILPF, the GLPF has no sharp discontinuity that gives aclear cutoff between filtered and passed frequencies
� The cutoff frequency is usually defined as the locus of points
2
22 0
D ( µ ,υ )
DH( µ,υ ) e
−
=
� The cutoff frequency is usually defined as the locus of pointsfor which H(u,v) is down to a certain fraction of its maximumvalue; usually 50% (-3dB).
� Note: GPLF has no ringing at all since its IDFT is also a Gaussian 33
-
Smoothing Using Frequency
Filtering
0.4
0.6
0.8
1
H( µ
, ν)
GLPF Displayed as image GLPF Transfer Function
020
4060
80100
0
50
1000
0.2
µν
1
34
Filter Radial Cross Section
0 5 10 15 20 25 30 35 40 45 500
0.2
0.4
0.6
0.8
D(µ,ν)
H( µ
, ν)
-
� Gaussian Lowpass Filter (GLPF)
� Effect of Changing Radius
Smoothing Using Frequency
Filtering
35
-
� Example 4.15. Gaussian Lowpass Filter (GLPF)
Smoothing Using Frequency
Filtering
D0 =10 D0 =30
36 D0 =60 D0 =160 D0 =460
-
� Applications
Smoothing Using Frequency
Filtering
37
Original low resolution text Result of smoothing using a GLPFNote how the broken text segments were joined
-
� Applications
Smoothing Using Frequency
Filtering
38
Satellite Image showing prominent horizontal scan lines
Result of smoothing using a GLPFNote how the scan lines are less pronounced
-
Sharpening Using Frequency
Filtering� Enhancing sharp details and edges is performed by using
highpass filters
� Highpass filters preserves the high frequency components� Highpass filters preserves the high frequency componentsof the image (which correspond to edges, abrupt changes ,or noise) while attenuating the low frequency components
� A highpass filter is obtained from a low pass filter using
1HP LPH ( µ,υ ) H ( µ,υ )= −
� Common High filters
� Ideal
� Butterworth
� Gaussian
39
-
Sharpening Using Frequency
Filtering� Ideal Highpass Filter (IHPF)
� IHPF cuts all frequencies within a circle of radius D0 from thecenter of the spectrum (P/2,Q/2) and passes all frequenciescenter of the spectrum (P/2,Q/2) and passes all frequenciesoutside this circle
� The IHPF is defined as
where
0 0
0
, D(µ,υ ) DH( µ,υ )
1 , D(µ,υ ) > D
≤=
1 22 2 /
is the distance from each pixel to the center of the spectrum(P/2,Q/2)
� The radius D0 is called the cutoff frequency40
1 22 22 2/
D( µ,υ ) ( µ P / ) (υ Q / ) = − + −
-
0.6
0.8
1
µ,ν)
Sharpening Using Frequency
Filtering
D0
020
4060
80100
0
50
1000
0.2
0.4
µν
H( µ
IHPF Displayed as image IHPF Transfer Function
41
Filter Radial Cross Section
D0
-
� Ideal Highpass Filter � Ringing effects is unavoidable in IHPF as it is derived from the ILPF
Sharpening Using Frequency
Filtering
IHPF H(u,v) IHPF h(x,y)
x 10-3
IDFT
42
0
x 10-3
-
Sharpening Using Frequency
Filtering� Example 4.16. Ideal Highpass Filter
� Result of highpass filtering using D0 = 30, 60, and 160
D0 =30
Ringing Effect
43 D0 =60 D0 =160
-
Sharpening Using Frequency
Filtering� Butterworth Highpass Filter (BHPF)
� The BHPF is defined as
[ ]21
1 0n
H( µ,υ )D / D( µ,υ )
=+ [ ]1 0D / D( µ,υ )+
020
4060
80100
0
50
1000
0.2
0.4
0.6
0.8
1
µν
H( µ
, ν)
44
µν
0 5 10 15 20 25 30 35 40 45 50 550
0.2
0.4
0.6
0.8
1
D(µ,ν)
H( µ
, ν)
BHPF Displayed as image BHPF Transfer Function
Filter Radial Cross Section
-
� Example 4.17. Butterworth Highpass Filter
� Result of highpass filtering using D0 = 30, 60, and 160 and n = 2
Sharpening Using Frequency
Filtering
� Note that ringing effects decrease as we increase D0� Similar to BLPF, the ringing in BHPF increases as we increase n
45
D0 =30 D0 =60 D0 =160
-
� Gaussian Highpass Filter (GHPF)
� The GHPF is defined as
Sharpening Using Frequency
Filtering
2
22 01
D ( µ ,υ )
DH( µ,υ ) e
−
= −
GHPF Displayed as image GHPF Transfer Function
01H( µ,υ ) e= −
020
4060
80100
0
50
1000
0.2
0.4
0.6
0.8
1
µν
H( µ
, ν)
46
GHPF Displayed as image GHPF Transfer Function
Filter Radial Cross Section
µν
0 5 10 15 20 25 30 35 40 45 50 550
0.2
0.4
0.6
0.8
1
D(µ,ν)
H( µ
, ν)
-
� Example 4.18. Gaussian Highpass Filter
� Result of highpass filtering using D0 = 30, 60, and 160
Sharpening Using Frequency
Filtering
� Note that GHPF has no ringing effects
47
D0 =30 D0 =60 D0 =160
-
Sharpening Using Frequency
Filtering� Example 4.19. Applications
Original Filtered using BHPF n =4 Threshold Image
� Note how the highpass filtered image has lost gray tones because the DC component was removed
� Thresholding was applied to point out ridges in the fingerprint
48
-
Sharpening Using Frequency
Filtering� The Laplacian in Frequency Domain
� It can be shown that the Laplacian can be implemented in frequency domain as a filter H(u,v) asfrequency domain as a filter H(u,v) as
� And with respect to the center of the frequency rectangle
2 2 24H( µ,υ ) π ( µ υ )= − +
( ) ( )2 22 24 2 2 4H( µ,υ ) π ( µ P / υ Q / ) π D( µ,υ )= − − + − = −
� Thus, the Laplacian of an image f(x,y) is
49
( ) ( )4 2 2 4H( µ,υ ) π ( µ P / υ Q / ) π D( µ,υ )= − − + − = −
[ ]2 1f ( x,y ) H(µ,υ )F( µ,υ )−∇ = ℑ
-
Sharpening Using Frequency
Filtering� The Laplacian in Frequency Domain
� Enhancement using Laplacian is achieved by
� Or, in frequency domain
2g( x,y ) f ( x,y ) f ( x,y )= − ∇
[ ][ ]
1
1
1 2
1
1 4
g( x,y ) F(µ,υ ) H( µ,υ )F( µ,υ )
= ( H(µ,υ ))F( µ,υ )
= ( π D( µ,υ ))F( µ,υ )
−
−
−
= ℑ −
ℑ −
ℑ +
� Although this formulation is elegant, it is hard to find the scaling factors in the frequency domain. So, we usually find the IDFT of the Laplacian then we carry out enhancement in spatial domain by normalizing the Laplacian to ~[-1,1]50
1 21 4 = ( π D( µ,υ ))F( µ,υ )− ℑ +
-
Sharpening Using Frequency
Filtering� Example 4.20. The Laplacian in Frequency Domain
51
Original Enhanced Image Using Laplacian
-
Selective Filtering
� The lowpass and highpass filters discussed so faroperate over the entire range of the frequencyrectanglerectangle
� In several applications, the interest is usually aboutspecific frequency bands or smaller regions of thefrequency rectangle
� Filters in the first category are called Bandreject� Filters in the first category are called Bandrejectand Bandpass filters
� Filters in the second category are called notchfilters
52
-
Selective Filtering� Bandreject Filters
� They are used to reject a certain band of frequencies
� They can be easily reconstructed using the filter types wediscussed earlier
Ideal
Butterworth
discussed earlier
02 20 0
W W , D - D(µ,υ ) D +
H( µ,υ ) 1 , otherwise
≤ ≤=
2
2 2
1
1
nH( µ,υ )
D( µ,υ ) W
D ( µ,υ ) D
=
+ −
Gaussian
53 W is the width of the reject band and D0 is the radial center of the band
2 20
1
D ( µ,υ ) D
D( µ ,υ ) WH( µ,υ ) e
− − = −
2 20D ( µ,υ ) D
−
-
Selective Filtering
� Bandreject Filters
0.8
1
Gaussian BRFD0 = 20 W = 8
020
4060
80100
0
50
1000
0.2
0.4
0.6
µν
H( µ
, ν)
GBRF Displayed as image
54
D0 = 20 W = 8
0 10 20 30 40 50 60 70 80 90 1000
0.2
0.4
0.6
0.8
1
D(µ,ν)
H( µ
, ν)
Filter Radial Cross Section
-
Selective Filtering� Example 4.21. Bandreject Filters
Frequency Corrupted
Image
Frequency Spectrum of Image
55
GaussianBand-Reject
Filter
FilteredImage
-
Selective Filtering� Bandpass Filters
� They are used to pass a certain band of frequencies
� They can be easily reconstructed from bandreject filters using
1BP BRH ( µ,υ ) H ( µ,υ )= −1BP BRH ( µ,υ ) H ( µ,υ )= −
020
4060
80100
0
50
1000
0.2
0.4
0.6
0.8
1
µν
H( µ
, ν)
BBPF Displayed as image
56
Butterworth Bandpass Filter µν
0 10 20 30 40 50 60 70 80 90 1000
0.2
0.4
0.6
0.8
1
D(µ,ν)
H( µ
, ν)
BBPF Displayed as image
Filter Radial Cross Section
-
Selective Filtering� Example 4.22. Bandpass Filters
Frequency Corrupted
Image
Frequency Spectrum of Image
57
GaussianBandpass
Filter
Extracted Degradation
-
Selective Filtering
� Notch Filters
� They are the most useful of selective filters
� They can be used to pass (notch-pass) or reject (notch-reject) frequencies in a predefined neighborhood about thereject) frequencies in a predefined neighborhood about thecenter of the frequency rectangle
� Notch filters are required to be symmetric around the origin.This implies that a notch centered at (u0,v0) must have acorresponding notch at (-u0,-v0)
1 1
580
2040
6080
100
0
50
1000
0.2
0.4
0.6
0.8
µν
H( µ
, ν)
Gaussian Notch-Reject Filter0 50 100 150 200 250 300
0
0.2
0.4
0.6
0.8
D(µ,ν)
H( µ
, ν)
-
Selective Filtering
� Notch Filters
� Notch filters are reconstructed as the product of twohighpass filters whose centers are translated to the center ofthe notchesthe notches
Hk(u,v) and H-k(u,v) are the highpass filters centered at (uk,vk) and (-uk,-vk)
Q is the number of notch pairs
� The centers of the highpass filters are specified with respectto the center (M/2,N/2)
1
Q
NR k k
k
H ( µ,υ ) H ( µ,υ )H ( µ,υ )−−
=∏
to the center (M/2,N/2)
59
1 22 22 2/
k k kD ( µ,υ ) ( µ M / µ ) ( υ N / υ ) = − − + − −
1 22 22 2/
k k kD ( µ,υ ) ( µ M / µ ) ( υ N / υ )− = − + + − +
-
� Example 4.23. Notch Filters
� Notch filter with three notch pairs that is constructed using BHPF
Selective Filtering
3
1
� Notch-pass Filters � They can be constructed using
[ ] [ ]
3
2 20 01
1 1
1 1NR n n
k k k kk
H ( µ,υ )D / D ( µ,υ ) D / D ( µ,υ )−−
= + +
∏
1NP NRH ( µ,υ ) H ( µ,υ )= −
020
4060
80100
0
50
1000
0.2
0.4
0.6
0.8
µν
H( µ
, ν)
IdealNotch-pass Filter
60
-
Selective Filtering� Example 4.24. Notch-reject Filters
Frequency Corrupted
Image
Frequency Spectrum of Image
61
ButterworthNotch-reject
Filter
Filtered Image
-
Selective Filtering
Frequency
� Example 4.25. Notch-pass Filters
Corrupted Image
Frequency Spectrum of Image
62
ButterworthBandpass
Filter
Extracted Degradation
-
Homomorphic Filtering� The image formation model using illumination and reflectance
is given by
� This equation can’t be used to operate on the illumination or
f ( x,y ) i( x,y )r( x,y )=� This equation can’t be used to operate on the illumination or
reflectance functions separately in the frequency domain sincethe product of the two functions in the spatial domain is notequivalent to multiplying their transforms
� However, if we define
[ ] [ ][ ] [ ]
z( x,y ) ln f ( x,y ) ln i( x,y )r( x,y )
ln i( x,y ) ln r( x,y )
= =
= +� Then
63
[ ] [ ] ln i( x,y ) ln r( x,y )= +
{ } [ ]{ }[ ]{ } [ ]{ }
i r
z( x,y ) ln f ( x,y )
ln i( x,y ) ln r( x,y )
Z( µ,υ ) = F (µ,υ ) F ( µ,υ )
ℑ = ℑ
= ℑ + ℑ
+
-
Homomorphic Filtering� Now, we filter Z(u,v) by a filter H(u,v)
� The filtered image in the spatial domain isi r
S(µ,υ ) = Z( µ,υ )H( µ,υ )
= H(µ,υ )F ( µ,υ ) H( µ,υ )F ( µ,υ )+� The filtered image in the spatial domain is
� If we define
{ }{ } { }
-1
-1 -1i r
s( x,y ) = S(µ,υ )
= H(µ,υ )F ( µ,υ ) H( µ,υ )F ( µ,υ )
ℑ
ℑ + ℑ
{ }-1 ii'( x, y ) = H( µ,υ )F ( µ,υ )ℑ
� then
64
{ }-1 rr'( x,y ) H( µ,υ )F ( µ,υ )= ℑ
s( x,y ) i'( x,y ) + r'( x,y )=
-
Homomorphic Filtering� The output image is computed by exponentiation
s( x,y )
i'( x,y ) + r'( x,y )
g( x,y ) e
= e
=
� This approach is called homomorphic filtering which is summarized in the figure below
i'( x,y ) r'( x,y )
0 0
= e
= e e
= i (x,y)r (x,y)
65
-
Homomorphic Filtering� Homomorphic filtering is of great importance if we want to operate
on the illumination and reflectance components separately
� The illumination component is characterized with slow variationswhile the reflectance tends to vary greatly; especially at the bordersof dissimilar objectsof dissimilar objects
� We can design a single filter that affects the low and highfrequencies in different controllable ways
Hγ
66
2 201
c[ D ( u,v )/ D ]H LH( u,v ) (γ γ ) e
= − −
Hγ
Lγ
-
Homomorphic Filtering� Example 4.26
� A PET image that is blurred and many of its low-intenisty features areobscured by the high intensity of the hot spots
� Use the filter in the previous slide with = 2 , = 0.25, c=1, andD0 = 80
Hγ Lγ
D0 = 80
Homomorphic
67
Homomorphic Filtering
-
Matlab Related Functions
� padarray
� meshgrid� meshgrid
� truesize
� impixelinfo
� generateShiftingArray
� lpfilterlpfilter
� brfilter
� nrfilter
� homofilter68