Вы находитесь на странице: 1из 62

Frequency Domain Filtering

(Chapter 4)

PROF. NARESH PATEL


M.E (CSE)
ASSISTANT PROFESSOR,
ECED, SCET, SURAT.
Frequency Domain Methods

Frequency Domain
Spatial Domain
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
Example

Original signal

Low-pass filtered

High-pass filtered

Band-pass filtered

Band-stop filtered
Low-pass filters
(i.e., smoothing filters)

Preserve low frequencies - useful for noise suppression

frequency domain time domain


High-pass filters
(i.e., sharpening filters)

Preserves high frequencies - useful for edge detection

time
domain
frequency
domain
Band-pass filters

Preserves frequencies within a certain band

frequency time
domain domain
Band-stop filters

How do they look like?

Band-pass Band-stop
Frequency Domain Methods

Case 1: h(x,y) is given in


the spatial domain.

Case 2: H(u,v) is given in


the frequency domain.
Steps

H(u,v) might be specified in the frequency domain


or in the spatial domain (i.e., h(x,y))
How to generate H(u,v) from h(x,y)?
If h(x,y) is given in the spatial domain, here is
how to generate H(u,v):

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)


How to generate h(x,y) from H(u,v)?
We know that G(u,v) = F(u,v) H(u,v)

- Use f(x,y)=(x,y) (i.e., impulse)

- In this case, G(u,v)= 1 x H(u,v) = H(u,v) (i.e., transfer function)

- Take IFT of G(u,v) to find h(x,y) (i.e., impulse response)


Steps (contd)
Steps (contd)
Steps for filtering in Frequency Domain

M N Image, f Padded Image fp Multiplying fp by Spectrum of fp


(-1)x+y

M N Image, f
Centered Gaussian Spectrum of Gp = (-1)x+y * real ( IDFT of HFp )
LPF of size P Q Product HFp
Example
Example

Assume filter H(u,v) that is 0 at the center of the transform


and 1 elsewhere; whats the output image?

zero average intensity


Example: Low-pass and band-reject
Image Smoothing

Edges and other sharp intensity transitions (such as


noise) in an image contribute significantly to the
high frequency content in Fourier transform.
Smoothing( blurring) is achieved in the frequency
domain by high frequency attenuation; that is done
by LPF.
There are three types of LPF
Ideal LPF (ILPF)
Butterworth LPF (BLPF)
Gaussian LPF (GLPF)
Low-pass (LP) filtering

Preserves low frequencies, attenuates high


frequencies.
ideal
in practice

D0: cut-off frequency


Ideal LPF

A 2 D low pass filter that passes without


attenuation all frequencies within a circle D0
from the origin and cuts off all frequencies out
side this circle is called an ideal LPF.

Where D0 is a positive constant and D(u,v) is the distance


between a point (u,v) in frequency domain and the center of
the frequency rectangle.
ILPF
Specifying 2 D LPF

If the DFT has been centered, a circle of radius D0 with origin at


the center of the frequency rectangle encloses percentage of the
power

The summation is taken over values of (u,v) that lie inside circle
or on boundary
Example
Fig (b) indicates severe blurring
that shows most of the sharp detail
information in the picture is
contained in 13 % power removed
by the filter.

As the filter radius increases ,


less and less power is removed,
resulting in less blurring.
Blurring and Ringing
How does D0 control smoothing?

Blurring is controlled by D0
r=78 (99%)

r=8 (90%)
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


Spatial Representation of BLPFs
n=1 n=2 n=5 n=20
Comparison: Ideal LPF and BLPF

Ideal Butterworth

D0=10, 30,
60, 160, n=2
460
Gaussian LP filter (GLPF)

Gaussian Lowpass Filters (GLPF) in two dimensions is given


( u 2 v2 )/2 2
H (u, v) e
By letting D0
( u 2 v2 )/2 D02
H (u, v) e
Gaussian: Frequency Spatial Domains

Let H(u) denote the 1-D frequency domain Gaussian filter


-u 2 /2 2
H (u) Ae

The corresponding filter in the spatial domain


2 2 2 x2
h( x) 2 Ae

frequency
domain spatial
domain
Butterworth LPF
Difference of Gaussians:
Frequency Spatial Domains

Let H (u ) denote the difference of Gaussian filter


-u 2 /212 -u 2 /2 22
H (u) Ae Be
with A B and 1 2

The corresponding filter in the spatial domain


2 212 x2 2 2 22 x2
h( x) 21 Ae 2 2 Ae
Difference of Gaussians:
Frequency Spatial Domains (contd)

spatial
domain

frequency
domain

High-pass filter!
Filtering in the Spatial and Frequency
Domains: Example

600 x 600

Important to preserve
odd symmetry (i.e., H(u,v)
should be imaginary!)
Sobel
(read details on page
268)
Filtering in the Spatial and Frequency
Domains: Example (contd)
Results
spatial domain frequency domain
filtering filtering
Example: smoothing by GLPF (1)
Examples of smoothing by GLPF (2)

D0=100
D0=80

39 7/7/2017
Image Sharpening using frequency domain filters

Edges and other abrupt changes are associated with high


Frequency components of its Fourier transform.

Image sharpening can be achieved in frequency domain by


High Pass filtering, which attenuates low frequency
component without disturbing high frequency information
in the Fourier transform
High-Pass filtering

A high-pass filter can be obtained from a low-pass filter


using:

H HP (u, v) 1 H LP (u, v)
Ideal HPF

Preserves high frequencies, attenuates low


frequencies.
Butterworth high pass filter (BHPF)

In practice, we use filters that attenuate low


frequencies smoothly (e.g., Butterworth HP
filter) less ringing effect
Gaussian HP filter

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


( u 2 v 2 )/2 D02
H (u, v) 1 e
High pass Filters
Spatial Representation of High-pass Filters
Comparison: Ideal HP and BHPF
D0=30,60,100
Ideal

Butterworth
n=2
Comparison: BHPF and GHPF

Butterworth D0=30,60,100

Gaussian
n=2
Example: High-pass Filtering and
Thresholding
for Fingerprint Image Enhancement

BHPF
(order 4 with a cutoff
frequency 50)
Frequency Domain Analysis of
Unsharp Masking and Highboost
Filtering

Unsharp Masking: gmask ( x, y) f ( x, y) f LP ( x, y)

g ( x, y ) f ( x, y) k * g mask ( x, y)
Highboost filtering: f ( x, y ) k ( f ( x, y) f LP ( x, y))
(variation) (k 1) f ( x, y ) kf LP ( x, y )

Use frequency f LP ( x, y) 1 H LP (u, v) F (u, v)


domain :
Revisit: Unsharp Masking and
Highboost Filtering

g ( x, y) f ( x, y) k ( f ( x, y) f LP ( x, y))


G (u , v) f ( x, y ) k * f ( x, y ) hLP ( x, y ) f ( x, y )

F (u , v) k * F (u , v) H (u , v) F (u , v)
LP

1 k * 1 H (u , v) F (u , v)
LP

1 k * H HP (u , v) F (u , v)

Highboost Filter

so: g(x,y) 1 1 k * H HP (u , v ) F (u , v )
High boost and High-Frequency-Emphasis
Filters
g ( x, y ) 1 1 k * H HP (u, v) F (u, v) g ( x, y ) 1 k1 k2 * H HP (u , v) F (u , v)
k 0 k1 0 and k2 0

The constant k, gives control k1 controls of the offset from the


over the proportion of high origin and k2 controls the
frequencies that influence contribution of high frequencies
the final result
Highboost High-emphasis
k2
k1
k1

H HP (u, v) k1 k2 * H HP (u, v)
Example

GHPF
Gaussian
Filter:
D0=40

High-emphasis High-emphasis
and hist. equal.
High-Frequency
Emphasis filtering
Using Gaussian filter
k1=0.5, k2=0.75
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 (contd)

Consider the following model of image formation:

i(x,y): illumination
r(x,y): reflection

In general, the illumination component i(x,y) varies


slowly and affects low frequencies mostly.
In general, the reflection component r(x,y) varies
faster and affects high frequencies mostly.

IDEA: separate low frequencies due to i(x,y)


from high frequencies due to r(x,y)
How are frequencies mixed together?

Low and high frequencies from i(x,y) and r(x,y)


are mixed together.

F (u, v) I (u, v) * R(u, v)

Difficult to handle low/high frequencies separately.

F (u, v) H (u, v) [ I (u, v)* R(u, v)]H (u, v)


Can we separate them?

Idea:

Take the ln( ) of


Steps of Homomorphic Filtering

(1) Take
(2) Apply FT
or
(3) Apply H(u,v)
Steps of Homomorphic Filtering (contd)

(4) Take Inverse FT:

or

(5) Take exp( ) or


Example: use high-frequency emphasis

H (u, v) ( H L ) 1 e
c ( u 2 v2 )/ D02

L

Attenuate the contribution


made by illumination and
amplify the contribution made
by reflectance
Homomorphic Filtering: Example
Homomorphic Filtering: Example

L 0.25
H 2
c 1
L 0.25
D0 80
H 2
c 1
D0 80

Вам также может понравиться