Sunteți pe pagina 1din 45

Digital Image

Processing
Lecture 11 Dr. Basit Mughal
drmughal75@gmail.com

1
Lowpass Filtering in the
Frequency Domain
Three types of low pass filters:

1. Ideal filters
2. Butterworth filters (parameter: filter
order)
3. Gaussian filters
Ideal Filter (Lowpass)
A 2-D ideal low-pass filter:

1 if D (u , v) ≤ D0
H (u, v) = 
0 if D (u , v) > D0
where D0 is a specified nonnegative quantity and
D(u,v) is the distance from point (u,v) to the center of
the frequency rectangle.

• Center of frequency rectangle: (u,v)=(M/2,N/2)


• Distance from any point to the center (origin) of the
Fourier Transform:

D(u , v) = (u − M / 2) + (v − N / 2) )
2 2 1/ 2
Ideal Low pass filter
Ideal Low pass filter:

all frequencies inside a circle of radius D0


are passed with no attenuation

all frequencies outside this circle are


completely attenuated.
Ideal Filter (Lowpass)
Cutoff-frequency: the point of transition between
H(u,v)=1 and H(u,v)=0 (D0)

To establish cutoff frequency loci, we typically compute


circles that enclose specified amounts of total image
power PT.
M −1 N −1
PT = ∑∑ P (u , v)
u =0 v =0
2
where P (u , v) = F (u, v)
Fourier Spectrum with different radii
8%
power removed

5.4% 3.6%
power removed power removed

2% 0.5%
power removed power removed
H(u,v) of radius 5 h(x,y) charactersitics

The centre components


are responsible for blurring
and concentric components
are responsible for ringing
characteristic of ideal filters

h(x,y)

Both the radius of the centre


component
and the number of circles per
unit distance from the origin are
inversely proportion to the value
of cut off frequency of the ideal
filters.
Blurring with little or no
ringing
Butterworth low pass filter
(BLPF)

Gaussian low pass filter


(GLPF)
The transfer function of a Buterworth low pass filter (BLPF) of
order n, and with cutoff frequency at a distance D0 from the origin,
is
1
H (u , v) = 2n
 D(u, v) 
1+  
where
 D0 

D(u , v) = (u − M / 2) + (v − N / 2) )
2 2 1/ 2
Sharp Discontinuity

Does not have sharp Discontinuity


Butterworth Filter
(Lowpass)
To define a cutoff frequency locus: at points
for which H(u,v) is down to a certain fraction
of its maximum value.

When D(u,v) = D0, H(u,v) = 0.5

i.e. down 50% from its maximum value of 1.


Smooth transition of blurring as a function of increasing
cutoff frequency for n=2 and D0= 5, 15, 30, 80, 320

ILPF results BLPF results with n=2


n=1 n=2 n=5 n = 20

A Butterworth filter of order 1 has no ringing. Ringing generally is


imperceptible in filter of order 2 , but can become a significant factor
in filter of higher order. (with cutoff frequency of 5 pixels)
Summary of BLPF
BLPF of order 1 has no ringing at all.
BLPF of order 2 shows mild ringing but
small as compared to ILPF.
BLPF of higher order have significant
ringing effect.
BLPF of order 20 = ILPF

BLPF of order 2 is a good compromise


between effective low pass filtering and
acceptable ringing characteristics.
Gaussian Low Pass Filter
Gaussian low pass filters (GLPFs) in two dimensions is
D 2 ( u ,v )

H (u, v) = e 2σ 2

D(u,v) is the distance from the origin of the Fourier Transform

where sigma is a measure of the spread of the Gaussian curve . Let


sigma = D0, then
D 2 ( u ,v )

2 D0 2
H (u , v) = e
When D(u,v) = D0 , the filter is down to 0.607 of its maximum value
Gaussian Low Pass Filters
Comparison of GLPF with
BLPF
Smooth transition in blurring as a function of
increasing cutoff frequency.
GLPF did not achieve as much smoothing as
the BLPF of order 2 for the same value of
cutoff frequency because the profile of GLPF is
not as tight as that of BLPF.
It is assumed that no ringing in GLPF.
BLPF is a suitable choice where tight control of
the transition between low and high
frequencies about the cutoff frequency are
needed.
The price of this additional control over the
filter profile is the possibility of ringing
Example from machine
perception GLPF with D0=80
(Application to Character Recognition )

Fax transmission
Duplicate material
Historical records
Example 2 from printing and
publishing industry GLPF
D0 = 100 D0 = 80

Smooth images look quite soft and pleasing


Example 3 from processing
satellite and aerial images
GLPF
D0 = 30 D0 = 10
Sharpening frequency domain
filters
• Image can be blurred by attenuating the high frequency components
• Edges and other abrupt changes in gray levels are associated with high
frequency components
• Image can be sharpened by attenuating low frequency components i.e. HP
filtering

H hp (u , v ) = 1 − H lp (u , v )
Transfer function of LP filter
When LP filters attenuates frequencies HP filter passes them and vice versa

Three types of High Pass Filters:


1.Ideal High Pass Filters (IHPF)
2.Butterworth filter (BHPF)
3.Gaussian filter (GHPF)
BHPF represents a transition between the sharpness
of the ideal filter and the total smoothness of the
Gaussian filter
filters
Sharpening frequency domain
Spatial Representation of a
frequency domain filter
Multiply H(u,v) by (-1)u+v for centering
Computing the inverse DFT
Multiplying the real part of inverse DFT by
(-1)x+y
Ideal Filter (Highpass)
A 2-D ideal low-pass filter:
0 if D (u , v) ≤ D0
H (u, v) = 
1 if D (u , v) > D0
where D0 is a specified nonnegative quantity and
D(u,v) is the distance from point (u,v) to the center
of the frequency rectangle.

• Center of frequency rectangle: (u,v)=(M/2,N/2)


• Distance from any point to the center (origin) of
the FT:
D(u , v) = (u − M / 2) 2 + (v − N / 2) 2 )1/ 2
Same ringing properties as ILPF
IHPF with D0=15, 30, 80
Butterworth Filter
(Highpass)
This filter does not have a sharp
discontinuity establishing a clear cutoff
between passed and filtered frequencies.

1
H (u , v) =
1 + [ D0 / D(u , v)]2n
BHPF with D0=15, 30, 80
• BHPF behave smoother than IHPF
• The boundaries are less distorted than the result of IHPF even for smallest
value of cutoff frequency
• The transition into higher values of cutoff frequencies is mush smoother
with BHPF
Gaussian High Pass Filter
D 2 ( u ,v )

H (u , v) = 1 − e 2σ 2

Where sigma is a measure of the spread of the Gaussian curve .


Let sigma = D0, then

2
D ( u ,v )
− 2
H (u , v) = 1 − e 2 D0
GHPF

Better results than IHPF and BHPF, even the filtering of the smaller
objects and thin bars is cleaner with the Gaussian filter
D0 = 15 D0 = 30 D0 = 80
The Laplacian in Frequency
Domain

If the centre of the filter function is shifted to (M/2, N/2)


The Laplacian filtered image in the spatial domain is obtained by
computing the inverse Fourier transform of

In Fourier Transform pair notation


The Laplacian in the frequency domain
We form an enhanced image g(x,y) by subtracting the Laplacian
from the original image

As in the spatial domain, where we obtained the enhanced image


with a single mask, it is possible to perform the entire operation in
the frequency domain with only one filter

G (u, v) = F (u , v) +  (u − M / 2)2 + (v − N / 2)2  F (u , v)

{ }
G (u, v) = 1 +  (u − M / 2)2 + (v − N / 2)2  F (u , v)

{{ }
g ( x, y ) = ℑ−1 1 −  (u − M / 2)2 + (v − N / 2)2  F (u , v) }
Scaled image
Operated in Operated in
frequency domain spatial domain
High boost filtering
In high pass filters average background intensity reduced to near
black because of zero frequency component elimination
g mask ( x , y ) = f (x , y ) − f lp (x , y )
High boost filtering generalized this by multiplying f(x,y) by a constant A ≥ 1

f hb ( x, y ) = Af ( x, y ) − f lp ( x, y )

f hb ( x, y ) = ( A − 1) f ( x, y ) + f ( x, y ) − f lp ( x, y )

f hb ( x, y ) = ( A − 1) f ( x, y ) + f hp ( x, y )

H hp (u , v) = 1 − H lp (u , v)

H hb (u, v) = (A − 1) + Hhp (u, v)


Highboost filtering in the frequency domain

Original Image High pass filtered(Laplacian)

A = 2.7
A=2

f hb ( x, y ) = ( A − 1) f ( x, y ) + f hp ( x, y )
End Chapter 4

?
MATLAB
MATLAB functions

44
Questions /comments

drmughal75@gmail.com

45

S-ar putea să vă placă și