Download as pdf or txt
Download as pdf or txt
You are on page 1of 58

Digital Image

Processing
Image Filtering in the Frequency Domain
• Low Pass Filter
• High Pass Filter
• Band pass Filter
• Blurring
• Sharpening

2/16/2018 2
Frequency Bands
Image Fourier Spectrum

Percentage of image power enclosed in circles


(small to large) :

90, 95, 98, 99, 99.5, 99.9


Blurring - Ideal Low pass Filter
90%
95%

98%
99%

99.5% 99.9%
The Convolution Theorem

g=f*h g = fh

implies implies

G = FH G=F*H
Low pass Filter

spatial domain frequency domain


f(x,y) F(u,v) filter
G(u,v) = F(u,v) • H(u,v)

g(x,y) G(u,v)
f(x,y) F(u,v)

g(x,y) H(u,v)
H(u,v) - Ideal Low Pass Filter
1 D(u,v)  D0
H(u,v) =
0 D(u,v) > D0

D(u,v) =  u2 + v2
D0 = cut off frequency
H(u,v)
H(u,v)

1
v

u 0 D0 D(u,v)
Blurring - Ideal Low pass Filter
Blurring - Ideal Low pass Filter

99.7% 99.37% 98.65%


96.6% 98.0% 99.6%

99.0% 99.4% 99.7%


ILPF Filtering Example
The Ringing Problem
G(u,v) = F(u,v) • H(u,v)
Convolution Theorem

g(x,y) = f(x,y) * h(x,y)

IFFT sinc(x)
H(u,v) h(x,y)

 D0  Ringing radius +  blur


Freq. domain

250

200

150

100

50

0
Spatial domain 0 50 100 150 200 250
The Spatial Representation of ILPF
Butterworth Lowpass Filter (BLPF)
Butterworth Lowpass Filters (BLPF) of order n and
with cutoff frequency D0
1
H (u, v) 
1   D(u, v) / D0 
2n
Butterworth Lowpass Filter (BLPF)
The Spatial Representation of BLPF
Gaussian Lowpass Filter (BLPF)
Gaussian Lowpass Filters (GLPF) in two dimensions is given
 D 2 ( u , v )/2 2
H (u, v)  e

D(u,v) =  u2 + v2
By letting   D0
 D 2 ( u , v )/2 D02
H (u , v)  e

Softer Blurring + no Ringing


Examples of smoothing by GLPF
Examples of smoothing by GLPF
Examples of smoothing by GLPF
Image Sharpening - High Pass Filters
A highpass filter is obtained from a given
lowpass filter using

H HP (u , v)  1  H LP (u , v)

A 2-D ideal highpass filter (IHPL) is defined as


0 if D(u, v)  D0
H (u , v)  
1 if D(u , v)  D0
A 2-D Butterworth highpass filter (BHPL) is defined as
1
H (u, v) 
1   D0 / D(u, v) 
2n

A 2-D Gaussian highpass filter (GHPL) is defined as


 D 2 ( u , v )/2 D02
H (u, v)  1  e
The Spatial Representation of Highpass
Filters
Filtering Results by IHPF
Filtering Results by BHPF
Filtering Results by GHPF
Using Highpass Filtering and Threshold for Image
Enhancement

BHPF
(order 4 with a cutoff
frequency 50)

2/16/2018 34
The Laplacian in the Frequency Domain

H (u , v)  4 2 (u 2  v 2 )

H (u , v)  4 2 (u  P / 2) 2  (v  Q / 2) 2 ) 
 4 2 D 2 (u, v)
The Laplacian image
 2 f ( x, y )  1  H (u , v) F (u , v)

Enhancement is obtained
g ( x, y )  f ( x, y )  c 2 f ( x, y ) c  -1

2/16/2018 35
The Laplacian in the Frequency Domain

The enhanced image


1
g ( x, y )   F (u, v)  H (u, v) F (u, v)
 1 1  H (u, v)  F (u, v)

 
 1 1  4 2 D 2 (u, v)  F (u, v)

2/16/2018 36
The Laplacian in the Frequency Domain

2/16/2018 37
Unsharp Masking, Highboost Filtering and High-
Frequency-Emphasis Fitering

g mask ( x, y )  f ( x, y )  f LP ( x, y )

f LP ( x, y )  1  H LP (u , v) F (u , v) 

Unsharp masking and highboost filtering


g ( x, y )  f ( x, y )  k * g mask ( x, y )

 
g ( x, y )  1 1  k * 1  H LP (u , v)  F (u , v)
 1 1  k * H HP (u, v)  F (u, v)

2/16/2018 38
Unsharp Masking, Highboost Filtering and High-
Frequency-Emphasis Fitering

1
g ( x, y )    k
1  k2 * H HP (u , v)  F (u , v)
k1  0 and k2  0

2/16/2018 39
High Pass Filtering

Original High Pass Filtered


High Frequency Emphasis
Original High Pass Filtered

+
Original High Frequency Emphasis
Original High Frequency Emphasis
Gaussian Filter
D0=40

High-Frequency-Emphasis Filtering
Gaussian Filter
K1=0.5, k2=0.75

2/16/2018 45
Homomorphic Filtering

f ( x, y )  i ( x, y ) r ( x, y )
  f ( x, y )  =  i ( x, y )    r ( x, y )  ?

z ( x, y )  ln f ( x, y )  ln i ( x, y )  ln r ( x, y )

 z ( x, y )  ln f ( x, y )  ln i ( x, y )  ln r ( x, y )

Z (u , v)  Fi (u , v)  Fr (u , v)

2/16/2018 46
Homomorphic Filtering

S (u , v)  H (u, v) Z (u, v)
 H (u , v) Fi (u , v)  H (u , v) Fr (u , v)
s ( x, y )  1 S (u , v)
 1  H (u, v) Fi (u , v)  H (u, v) Fr (u , v)
 1  H (u, v) Fi (u , v)  1 H (u , v) Fr (u , v)
 i '( x, y )  r '( x, y )

g ( x, y )  e s ( x , y )  ei '( x , y ) e r '( x , y )  i0 ( x, y )r0 ( x, y )

2/16/2018 47
Homomorphic Filtering

The illumination component of an image generally is


characterized by slow spatial variations, while the reflectance
component tends to vary abruptly

These characteristics lead to associating the low frequencies of


the Fourier transform of the logarithm of an image with
illumination the high frequencies with reflectance.

2/16/2018 48
Homomorphic Filtering


H (u , v)  ( H   L ) 1  e
 c  D 2 ( u , v )/ D02 
   
  L

Attenuate the contribution


made by illumination and
amplify the contribution made
by reflectance

2/16/2018 49
 L  0.25
Homomorphic Filtering
H  2
c 1
D0  80

2/16/2018 50
Homomorphic Filtering

2/16/2018 51
Selective Filtering

Non-Selective Filters:
operate over the entire frequency rectangle

Selective Filters
operate over some part, not entire frequency rectangle
• bandreject or bandpass: process specific bands
• notch filters: process small regions of the frequency rectangle

2/16/2018 52
Selective Filtering:
Bandreject and Bandpass Filters

H BP (u , v)  1  H BR (u, v)

2/16/2018 53
Selective Filtering:
Bandreject and Bandpass Filters

2/16/2018 54
Selective Filtering:
Notch Filters
Zero-phase-shift filters must be symmetric about the origin.
A notch with center at (u0, v0) must have a corresponding notch
at location (-u0,-v0).

Notch reject filters are constructed as products of highpass filters


whose centers have been translated to the centers of the
notches.
Q
H NR (u, v)   H k (u, v) H  k (u, v)
k 1

where H k (u, v) and H - k (u, v) are highpass filters whose centers are
at (uk , vk ) and (-uk , -vk ), respectively.
2/16/2018 55
Selective Filtering:
Notch Filters
Q
H NR (u, v)   H k (u, v) H  k (u, v)
k 1

where H k (u, v) and H - k (u, v) are highpass filters whose centers are
at (uk , vk ) and (-uk , -vk ), respectively.

A Butterworth notch reject filter of order n


3  1  1 
H NR (u , v)    2n   2n 
k 1 1   D0 k / Dk (u , v )   1   D0 k / D k (u , v )  
  
2 1/2
Dk (u , v)  (u  M / 2  uk )  (v  N / 2  vk ) 
2

2 1/2
D k (u , v)  (u  M / 2  uk )  (v  N / 2  vk ) 
2

2/16/2018 56
Examples:
Notch Filters
(1)

A Butterworth notch
reject filter D 0 =3
and n=4 for all
notch pairs

2/16/2018 57
Examples:
Notch Filters (2)

2/16/2018 58
2/16/2018 59

You might also like