frequency domain filtering (chapter 4)farid/teaching/dip/lecture - frequency filtering.pdf ·...
TRANSCRIPT
Major filter categories
• Typically, filters are classified by examining their properties in the frequency domain:
(1) Low-pass (2) High-pass (3) Band-pass (4) Band-stop
Low-pass filters(i.e., smoothing filters)
• Preserve low frequencies - useful for noise suppression
frequency domain time domain
Example:
High-pass filters(i.e., sharpening filters)
• Preserves high frequencies - useful for edge detection
frequency domain
timedomain
Example:
Band-pass filters
• Preserves frequencies within a certain band
frequency domain
timedomain
Example:
Frequency Domain Methods
Case 1: H(u,v) is specified inthe frequency domain.
Case 2: h(x,y) is specified inthe spatial domain.
(real)
Frequency domain filtering: steps (cont’d)
G(u,v)= F(u,v)H(u,v) = H(u,v) R(u,v) + jH(u,v)I(u,v)
(Case 1)
(Case 2) h(x,y) specified in spatial domain
• If h(x,y) is given in the spatial domain, we can generate H(u,v) as follows:
1.Form hp(x,y) by padding with zeroes.
2. Multiply by (-1)x+y to center its spectrum.
3. Compute its DFT to obtain H(u,v)
Recall these properties:
Example: h(x,y) is specified in the spatial domain
600 x 600
Sobel
time
frequency
frequency
Warning: need to preserve odd symmetry when padding with zeroes H(u,v) should be imaginary and odd (read details on pages 241 and 268)
0 0 0 0 0 00 0 0 0 0 00 0 -1 0 1 00 0 -2 0 2 00 0 -1 0 1 00 0 0 0 0 0
Example: 6 x 6g(x,y)= -g(6-x,6-y)
602 x 602
Results of Filtering in the Spatial and Frequency Domains
spatial domainfiltering
frequency domainfiltering
Low Pass (LP) Filters
• Ideal low-pass filter (ILPF) • Butterworth low-pass filter (BLPF)• Gaussian low-pass filter (GLPF)
Low-pass (LP) filtering
• Preserves low frequencies, attenuates high frequencies.
IdealIn practice
D0: cut-off frequency
Specifying a 2D low-pass filter• Specify cutoff frequencies by specifying the radius of a circle
centered at point (N/2, N/2) in the frequency domain.• The radius is chosen by specifying the percentage of total
power enclosed by the circle.
Specifying a 2D low-pass filter (cont’d)• Typically, most frequencies are concentrated around the
center of the spectrum.r=8 (90% power) r=18 (93% power)
r=43 (95%) r=78 (99%) r=152 (99.5%)
original
r: radius
How does D0 control smoothing?
• Reminder: multiplication in the frequency domain implies convolution in the time domain
* =
freq. domaintime domain
sinc
Ringing Effect
• Sharp cutoff frequencies produce an overshoot of image features whose frequency is close to the cutoff frequencies (ringing effect).
h=f*g
Butterworth LP filter (BLPF)
• In practice, we use filters that attenuate high frequencies smoothly (e.g., Butterworth LP filter) less ringing effect
n=1 n=4 n=16
2 2 2( )/2
Gaussian Lowpass Filters (GLPF) in two dimensions is given
( , ) u vH u v e σ− +=
Gaussian LP filter (GLPF)
2 2 20
0
( )/2
By letting
( , ) u v D
D
H u v e
σ− +
=
=
Gaussian: Frequency – Spatial Domains
2 2- /2
Let H(u) denote the 1-D frequency domain Gaussian filter
( ) uH u Ae σ=
2 2 22
The corresponding filter in the spatial domain
( ) 2 xh x Ae π σπσ −=
frequencydomain
spatialdomain
High Pass (LP) Filters
• Ideal high-pass filter (IHPF) • Butterworth high-pass filter (BHPF)• Gaussian high-pass filter (GHPF)• Difference of Gaussians• Unsharp Masking and High Boost filtering
High-Pass filtering (cont’d)
• A high-pass filter can be obtained from a low-pass filter as follows:
( , ) 1 ( , )HP LPH u v H u v= −
= 1 -D0
Butterworth high pass filter (BHPF)• In practice, we use filters that attenuate low frequencies
smoothly (e.g., Butterworth HP filter) less ringingeffect
Gaussian HP filter
2 2 20( )/2
A 2-D Gaussian highpass filter (GHPL) is defined as
( , ) 1 u v DH u v e− += −
GHPF
BHPF
Example: High-pass Filtering and Thresholding for Fingerprint Image Enhancement
BHPF (order 4 with a cutoff frequency 50)
Difference of Gaussians (DoG) filter
2 22 21 2/2 /2- -
1 2
Let ( ) denote the difference of Gaussian filter
( ) with and
u u
H u
H u Ae BeA B
σ σ
σ σ= −≥ ≥
2 2 2 2 2 21 22 2
1 2
The corresponding filter in the spatial domain
( ) 2 2x xh x Ae Aeπ σ π σπσ πσ− −= −
This is a high-pass filter!
Unsharp Masking and Highboost Filtering (revisited)
( , ) ( , ) ( , )mask LPg x y f x y f x y= −Unsharp Masking:
Highboost filtering:(textbook’s formulation) ),(),(
)),(),((),(),(),(),(yxkfyxf
yxfyxfkyxfyxkgyxfyxg
HP
LPmask
+=
−+=+=
),(),()1(),( yxfyxfAyxg HP+−=Previous definition:
Revisit: Unsharp Masking and Highboost Filtering
1
( , ) { ( , ) ( ( , ) ( , ))}( , ) ( ( , ) ( , ) ( , ))
[1 (1 ( , ))] ( , ) [1 ( , )] ( , )
: ( , ) {[1 ( , )] ( , )}
LP
LP
LP HP
HP
G u v f x y k f x y f x yF u v k F u v H u v F u v
k H u v F u v kH u v F u v
so g x y kH u v F u v−
= + −= + − == + − = +
= +
F
FHighboost Filter
FT
( , ) ( , ) ( , ) ( , ) ( ( , ) ( , ))mask LPg x y f x y kg x y f x y k f x y f x y= + = + −
Highboost and High-Frequency-Emphasis Filters
1
1+k
k1
k1+k2
HighboostHigh-emphasis
0)),()),(1((),( 1
≥+= −
kvuFvukHyxg HPF
0,0)),()),(((),(
21
211
≥≥+= −
kkvuFvuHkkyxg HPF
High-FrequencyEmphasis filteringUsing Gaussian filterk1=0.5, k2=0.75
D0=40
Example
GHPF
High-emphasis High-emphasisand hist. equal.
Homomorphic filtering
• Many times, we want to remove shading effects from an image (i.e., due to uneven illumination)– Enhance high frequencies– Attenuate low frequencies but preserve fine detail.
Homomorphic Filtering (cont’d)
• Consider the following model of image formation:
• In general, the illumination component i(x,y) varies slowlyand affects low frequencies mostly.
• In general, the reflection component r(x,y) varies fasterand affects high frequencies mostly.
i(x,y): illuminationr(x,y): reflection
IDEA: separate low frequencies due to i(x,y) from high frequencies due to r(x,y)
How are frequencies mixed together?
• When applying filtering, it is difficult to handle low/high frequencies separately.
( , ) ( , )* ( , )F u v I u v R u v=
( , ) ( , ) [ ( , )* ( , )] ( , )F u v H u v I u v R u v H u v=
• Low and high frequencies from i(x,y) and r(x,y)are mixed together.
Steps of Homomorphic Filtering (cont’d)
(4) Take Inverse FT:
or
(5) Take exp( ) or ),(),(),( 00 yxryxiyxg =
Example using high-frequency emphasis
2 2 20( )/( , ) ( ) 1 c u v D
H L LH u v eγ γ γ − + = − − +
Attenuate the contribution made by illumination and
amplify the contribution made by reflectance
Attenuate the contribution made by illumination and
amplify the contribution made by reflectance