Upload
src0108
View
212
Download
0
Embed Size (px)
Citation preview
7/29/2019 Low Pass and High Pass Filters
1/6
Dr. D. J. Jackson Lectur e 10-1Electrical & Computer Engineering
Computer Vision &
Digital Image Processing
Frequency Domain Filters
Dr. D. J. Jackson Lecture 10-2Electrical & Computer Engineering
Butterworth lowpass filter
The transfer function of aButterworth lowpass filter (BLPF)of order n with cutoff frequency
D0 is given by
where D(u,v)=[u2+v2]1/2
For this smooth transition filter, acutoff frequency locus is chosensuch that D(u,v) is a certainpercentage of its maximum
Designed such that at D(u,v)=D0H(u,v)=0.50 (50% of its maximumvalue)
[ ] nDvuDvuH
2
0/),(1
1),(
+=
H(u,v)
D(u,v)/D0
Dr. D. J. Jackson Lectur e 10-3Electrical & Computer Engineering
Butterworth lowpass filter (continued)
Another transfer function ofa Butterworth lowpass filter(BLPF) of order n withcutoff frequency D0 is givenby
Designed such that atD(u,v)=D0
nDvuDvuH
20]/),(][12[1
1),(
+=
2
1),( =vuH
H(u,v)
D(u,v)/D0
Dr. D. J. Jackson Lecture 10-4Electrical & Computer Engineering
MATLAB Butterworth lowpass filter
f unct i on [ g]=bl pf ( f , or der, cutof f );
% Usage [ g]=bl pf (f , order, cutof f );
F=f f t2(f ) ;
F=f f tshi f t( F);
[ umax vmax] =si ze( F) ;
f or u=1: umax
f or v=1: vmax
H( u, v) =1/ ( 1+( sqrt ( 2)- 1)*( sqrt ( ( ( umax/ 2-( u- 1)) . 2+( vmax/ 2-( v-1)) . 2)) / cutof f ). ( 2*order) ) ;
end;
end;
G=H. *F;
G=i f f t 2(G) ;
g=sqr t ( r eal ( G) . 2+i mag(G). 2);
Dr. D. J. Jackson Lectur e 10-5Electrical & Computer Engineering
Example MATLAB output
Cutoff frequency=10 Cutoff frequency=100
Dr. D. J. Jackson Lecture 10-6Electrical & Computer Engineering
Butterworth lowpass filter function
7/29/2019 Low Pass and High Pass Filters
2/6
Dr. D. J. Jackson Lectur e 10-7Electrical & Computer Engineering
Ringing in BLPF
Dr. D. J. Jackson Lecture 10-8Electrical & Computer Engineering
Gaussian lowpass filter
The transfer function of a Gaussian lowpass filter (GLPF) isgiven by
Here, is a measure of spread about the center Let =D0, then
where D0 is the cutoff frequency
22
2/),(),(vuDevuH =
20
2 2/),(),( DvuDevuH =
Dr. D. J. Jackson Lectur e 10-9Electrical & Computer Engineering
Gaussian lowpass filter function
Dr. D. J. Jackson Lecture 10-10Electrical & Computer Engineering
Ideal highpass filter (IHPF)
A transfer function for a 2-D ideal highpass filter (IHPF) isgiven as
where D0 is a stated nonnegative quantity (the cutofffrequency) and D(u,v) is the distance from the point (u,v) tothe center of the frequency plane
>
=
0
0
Dv)D(u,if1
Dv)D(u,if0),( vuH
22),( vuvuD +=
v
u
H(u,v)
Dr. D. J. Jackson Lecture 10-11Electrical & Computer Engineering
Butterworth highpass filter
The transfer function of aButterworth highpass filter(BHPF) of order n with cutofffrequency D0 is given by
where D(u,v)=[u2+v2]1/2
For this smooth transition filter, acutoff frequency locus is chosensuch that D(u,v) is a certainpercentage of its maximum
Designed such that at D(u,v)=D0H(u,v)=0.50 (50% of its maximumvalue)
[ ] nvuDDvuH
2
0 ),(/1
1),(
+=
Dr. D. J. Jackson Lecture 10-12Electrical & Computer Engineering
Butterworth highpass filter (continued)
Another transfer function ofa Butterworth highpassfilter (BHPF) of order n withcutoff frequency D0 is givenby
Designed such that atD(u,v)=D0
nvuDDvuH
20 )],(/][12[1
1),(
+=
2
1),( =vuH
7/29/2019 Low Pass and High Pass Filters
3/6
Dr. D. J. Jackson Lecture 10-13Electrical & Computer Engineering
Gaussian highpass filter
The transfer function of a Gaussian highpass filter (GHPF) isgiven by
Here, is as in the Gaussian lowpass case Let =D0, then
where D0 is the cutoff frequency
22
2/),(1),(vuDevuH =
20
2 2/),(1),( DvuDevuH =
Dr. D. J. Jackson Lecture 10-14Electrical & Computer Engineering
Highpass filter functions
Dr. D. J. Jackson Lecture 10-15Electrical & Computer Engineering
Unsharp masking, highboost filtering, and high-
frequency-emphasis filtering
Let
where
Where HLP(u,v) is a lowpass filter andF(u,v) is theFourier transform of f(x,y)
Then
If k=1 this is an unsharp mask
If k>1 this is a highboost filter
),(),(),( yxfyxfyxg LPmask =
)],(),([),( 1 vuFvuHyxf LPLP=
),(*),(),( yxgkyxfyxg mask+=
Dr. D. J. Jackson Lecture 10-16Electrical & Computer Engineering
Unsharp masking, highboost filtering, and high-
frequency-emphasis filtering
In frequency domain only terms
This is a high-frequency-emphasisfilter
A more general form is
Here k10 controls an offset from the origin and k20 controlscontributions of high frequencies
)},()],(*1{[),(
filterhighpassaofin termsor
)},()]],(1[*1{[),(
1
1
vuFvuHkyxg
vuFvuHkyxg
HP
LP
+=
+=
)},()],(*{[),( 211 vuFvuHkkyxg HP+=
Dr. D. J. Jackson Lecture 10-17Electrical & Computer Engineering
Example use of a high-frequency-emphasis filter
Dr. D. J. Jackson Lecture 10-18Electrical & Computer Engineering
Homomorphic filtering
Recall f(x,y) can be expressed as f(x,y)=i(x,y)r(x,y)
We cannot use this directly to operate on the frequencycomponents of i(x,y) and r(x,y) because
But if we define
then
)},({)},({)},({ yxryxiyxf
)],(ln[)],(ln[
)],(ln[),(
yxryxi
yxfyxz
+=
=
)]},({ln[)]},({ln[
)]},({ln[)},({
yxryxi
yxfyxz
+=
=
7/29/2019 Low Pass and High Pass Filters
4/6
Dr. D. J. Jackson Lecture 10-19Electrical & Computer Engineering
Homomorphic filtering (continued)
Then,
where I(u,v) and R(u,v) are the Fourier transforms of ln[i(x,y)]and ln[r(x,y)] respectively
Z(u,v) can be processed by a filter function
where S(u,v) is the Fourier transform of the result
In the spatial domain,
),(),(),( vuRvuIvuZ +=
),(),(),(),(
),(),(),(
vuRvuHvuIvuH
vuZvuHvuS
+=
=
)},(),({)},(),({
)},({),(11
1
vuRvuHvuIvuH
vuSyxs
+=
=
Dr. D. J. Jackson Lecture 10-20Electrical & Computer Engineering
Homomorphic filtering (continued)
If,
then
Taking the exponential yields the final result
)},(),({),('
and)},(),({),('1
1
vuRvuHyxr
vuIvuHyxi
=
=
),('),('),( yxryxiyxs +=
),(),(
)],('exp[*)],('exp[
)],(exp[),(
00 yxryxi
yxryxi
yxsyxg
=
=
=
Dr. D. J. Jackson Lecture 10-21Electrical & Computer Engineering
Homomorphic filtering (continued)
The process can be viewed graphically as above
The illumination of an image is generallycharacterized byslow spatial variations (associated with the low frequenciesof the Fourier transform of the logarithm)
The reflectance of an image tends to vary abruptly,especially at the junctions of dissimilar objects (associatedwith the high frequencies of the Fourier transform of thelogarithm)
ln
f(x,y)
FFT H(u,v) FFT-1 exp
g(x,y)
Dr. D. J. Jackson Lecture 10-22Electrical & Computer Engineering
Homomorphic filtering (continued)
The filter function H(u,v) should/will affect the low-and high-frequencycomponents in different ways and can be approximated by
If the filter function chosen is such thatL1 then the lowfrequencies tend to be decreased and the high frequencies are amplified
functiontheofslopethecontrolswhere
]1)[(),( ]/),([20
2
c
evuH LDvuDc
LH +=
Dr. D. J. Jackson Lecture 10-23Electrical & Computer Engineering
Homomorphic filtering (example)
Dr. D. J. Jackson Lecture 10-24Electrical & Computer Engineering
Homomorphic filtering (example)
7/29/2019 Low Pass and High Pass Filters
5/6
Dr. D. J. Jackson Lecture 10-25Electrical & Computer Engineering
Selective fil tering
Previously discussed filters operate over the entirefrequency rectangle (i.e. complete representation in
the frequency domain) Occasionally it is useful to operate on specific
frequency bands or small regions of the frequencyrectangle
Bandrejector Bandpass filters operate on specificfrequency bands
Notch filters operate on small regions of thefrequency rectangle
Dr. D. J. Jackson Lecture 10-26Electrical & Computer Engineering
Bandreject filters
Bandreject filters can, in general, be easilyconstructed using the same concepts as described
for other filters Assume the following:
D(u,v) is the distance from the center of the frequencyrectangle
D0 is the radial center of the band of interest
Wis the width of the band of interest
Dr. D. J. Jackson Lecture 10-27Electrical & Computer Engineering
Bandreject filters
Ideal bandreject filter
Butterworth bandreject filter
Gaussian bandreject filter
+=
otherwise122
if0),( 00
WDD
WD
vuH
n
DD
DWvuH
2
20
21
1),(
+
=
220
2
1),(
= DWDD
evuH
Dr. D. J. Jackson Lecture 10-28Electrical & Computer Engineering
Bandpass filters
Bandpass filters can be derived from any of thebandrejectexpressions as
HBP(u,v)=1- HBR(u,v)
HBR(u,v) is the corresponding bandrejectfilter
This formulation is exactly as in thehighpass/lowpass case
Dr. D. J. Jackson Lecture 10-29Electrical & Computer Engineering
Gaussian filter example
Dr. D. J. Jackson Lecture 10-30Electrical & Computer Engineering
Notch filters
A notch filter rejects (or passes depending on itsconstruction) frequencies in a pre-defined area(neighborhood) about the center of the frequencyrectangle
We desire that the filters be zero-phase-shift Must be symmetric about the origin
A notch with center at (u0,v0) must have a correspondingnotch at (-u0,-v0)
7/29/2019 Low Pass and High Pass Filters
6/6
Dr. D. J. Jackson Lecture 10-31Electrical & Computer Engineering
Notch reject filters
Notch reject filters are easily constructed asproducts of highpass filters whose centers have
been translated to the center of the notchesThe general form is:
Where Hk(u,v) and H-k(u,v) are highpass filterswhose centers are at (uk,vk) and (-uk,-vk)
Q is the number of notches
=
=Q
kkkNR vuHvuHvuH
1
),(),(),(
Dr. D. J. Jackson Lecture 10-32Electrical & Computer Engineering
Notch reject filters (continued)
The centers at (uk,vk) and (-uk,-vk) are specified withrespect to the center of the frequency rectangle,
(M/2,N/2) Distances can be calculated as:
22
22
)2/()2/(),(
)2/()2/(),(
kkk
kkk
vNvuMuvuD
and
vNvuMuvuD
+++=
+=
Dr. D. J. Jackson Lecture 10-33Electrical & Computer Engineering
Notch reject filters (continued)
A general form for a Butterworth notch reject filterof order n and containing three notch pairs is:
The constant D0kis the same for each pair ofnotches, but can be different for different pairs
A notch pass filtercan be expressed as
+
+=
= n
kkkn
kk
NRvuDDvuDD
vuH2
0
3
12
0 )],(/[1
1
)],(/[1
1),(
),(1),( vuHvuHNRNP
=