You are on page 1of 51

Digital Image Processing, 3rd ed.

Gonzalez & Woods


www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

  j 2  t
F ( )   f (t ) e dt


 j 2  t
f (t )   F ( ) e d


Fourier transform pair

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

sin(  W )
F (  )  AW
(  W )
Sinc(0)=1, & sinc(m)=0, for all other values of m

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

DISCRETE FOURIER TRANSFORM PAIR OF ONE VARIABLE:

M 1
F (u )   f ( x )e  j 2  ux / M u  0 ,1,.... M  1
x0

M 1
1
f (x)   F ( u ) e j 2  ux / M x  0 ,1,......, M  1
M u 0

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

2 D impulse and its sifting property:


The impulse, δ(t,z) of two continuous variables, t and z is defined as,

 if t=z=0  
 (t , z )  
   (t , z ) dtdz  1
0 otherwise   

For discrete variables x and y, the 2D discrete impulse is defined as


 
If x=y=0
1
 ( x, y )     f (x, y) ( x  x , y  y )  f ( x , y )
0 0 0 0
0 otherwise x y 

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

An example for 2-D continuous Fourier Transform Pair f(t,z) And F(µ,v)

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

2-D sampling theorem: The 2-D sampling theorem states that a


continuous, bandlimited function f(t,z) can be recovered with no error
from a set of its samples if the sampling intervals are,

1 1
T  Z 
2 µ max 2 v max

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

Aliasing in Images: There are two principal manifestations of aliasing in images: spatial
aliasing and temporal aliasing. Spatial aliasing is due to under sampling.
Temporal aliasing is related to time intervals between images in a sequence of images. Common
example is “wagon wheel effect”, in which wheels with spokes in a sequence of images appear
to be rotating back ward, because frame rate being too low w.r.t othe speed of wheel rotation in a
sequence

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

2 D DFT PAIR:
M 1 N 1  j 2  ( ux / M  vy / N )
F (u , v )   x  0  y 0
f ( x, y ) e

1 M 1 N 1 j 2 ( ux / M  vy / N )
f ( x, y ) 
MN
 u 0 v0 F (u, v) e
2 D DFT IN POLAR FORM:
j ( u ,v ) 1 M 1 N 1
F (u, v)  F (u, v) e F (0,0)  MN x0 y 0
f ( x, y)
MN
DC component of the transform = MN * average value of f(x,y).
x y
To center the spreaded spectrum, we multiply, ‘f’ with 1
f (x, y)(1)x y  F(u  M / 2, v  N / 2)
© 1992–2008 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

Phase is the measure of the


displacement of various sinusoids
w.r.to their origin.
Magnitude of DFT determines
the intensities in image,
corresponding phase is array of
angles that carry much info about
location of objects in the image.

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

2D Discrete Fourier Transform properties:

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

BASICS OF FILTERING IN FREQUENCY DOMAIN:


We can define relationship between the components of the Fourier transform and spatial features of an
image. Because frequency is directly related to spatial rates of change. We can associate frequency with
the intensity patterns of an image. Low freq. corresponds to slowly varying intensities in image.

We note two features: strong edges that run approximately at ± 450 and two white oxide protrusions.
The spectrum shows prominent components along ± 450 directions that correspond to edges . When
observing along vertical axis, we see a vertical component that is off-axis slightly to the left, caused
by the edge of the oxide protrusion.
© 1992–2008 R. C. Gonzalez & R. E. Woods
Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

FREQUENCY DOMAIN FILTERING FUNDAMENTALS:


•Filtering in frequency domain consists of modifying the Fourier transform of an
image and then computing the inv. transform to obtain the processed result.
•Thus a given digital image, f(x,y) of size M*N, the basic filtering equation in which
we are interested has the form:

g(x, y)  F1[H(u, v)F(u, v)]


•H(u,v) is a filter function, g(x,y) is the filtered output image.

© 1992–2008 R. C. Gonzalez & R. E. Woods


•Pass the spectrum of above image through a filter, that remove the dc term.
•So it will reduce the avg. Intensity [F(0,0)] of output image to zero. As result, the image gets
much darker.
•Low freq. in transform are related to slowly varying intensity components of image, while
high freq. are caused by sharp transitions in intensity.
•Low pass filter: passes low freq., would blur an image
•High pass filter: passes high freq., would enhance sharp detail, but reduced contrast in image.
SUMMARY OF STEPS FOR FILTERING IN THE FREQUENCY DOMAIN:
1) Given an input image f(x,y) of size M x N, obtain the padding parameters P ≥2M-1,
Q ≥2N-1.

2) Form a padded image, f p


( x, y ), of size P x Q by appending the necessary no. of zeros
to f(x,y)
x y
3) Multiply f p
( x, y ), by 1 to center its transform.

4) Compute the DFT, F(u,v) of the image from step 3

5) Generate a real, symmetric filter function, H(u,v) of size P x Q with center at


coordinates (P/2,Q/2). From the product G(u,v)=H(u,v)F(u,v) using array
multiplication.

6) Obtain the processed image


1 x y
g p
( x , y )  { real [ F [ G ( u , v ))]]} (  1)
7) Obtain the final processed result, g(x,y), by extractingthe M x N region from the top,
left quadrant of g p ( x, y )
Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


CORRESPONDENCE BETWEEN FILTERING IN SPATIAL AND FREQUENCY DOMAINS:

 The link between filtering in the spatial and frequency domains is the convolution.
 Taking the advantage of properties of both domains is to specify a filter in
frequency domain, compute its IDFT, and then use the resulting , full size spatial filter
as a guide for constructing smaller spatial filter masks.
u2 / 2 2
Let H(u) denote the 1-D frequency domain Gaussian filter, H(u)  Ae
Where σ is the standard deviation of the gaussian curve. The corresponding filter in
spatial domain is
2 2 2 x 2
h( x)  2 Ae
They are Fourier transform pair, both components of which are Gaussian and real. We
do not have to be considered with complex numbers. Gaussian curves are easy to
manipulate. The functions behave reciprocally.
When H(u) has broad profile, h(x) has narrow profile and vice versa.
Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


IMAGE SMOOTHING USING FREQUENCY DOMAIN FILTERS:

Smoothing is achieved in the frequency domain by high freq. attenuation. i.e. Low pass
filtering.
Here we consider 3 types of LPFs: ideal, Butterwoth and Gaussian. These three categories
cover the range from very sharp(ideal) to very smooth (Gaussian) filtering. The Butter worth
filter has a parameter called the filter order.

•For higher order, it approaches ideal filter.


•For lower order values, it is more like a Gaussian filter.

Ideal Low Pass filters: A 2-D low pass filter that passes without attenuation all frequencies
within a circle of radius Do from the origin and cuts off all frequencies outside this circle is
called ideal LPF.
1 if D(u,v) ≤ Do
H(u, v)  
0 if D(u,v) > Do

Where Do is a positive constant and D(u,v) is the distance between a point(u,v) in the
frequency domain and the center of the frequency rectangle; that is,
D (u, v)  [(u  P / 2) 2  (v  Q / 2) 2 ]1/ 2
Where as P, Q are padded sizes. Point of transition between 1 to 0 is cutoff frequency.
•The sharp cutoff frequencies of an ILPF cannot be realized with electronic
components, although they certainly can be simulated in a computer.
•We study the LPFs behaviour as a function of same cutoff frequencies.
•We establish set of standard cutoff frequency loci to compute circles that enclose
specified amounts of total image power PT. Power spectrum of padded images at
each point(u,v).i.e,

P 1 Q 1
PT   
u0 v0
P (u , v )
Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

If DFT has been centered, a circle of radius Do with origin at the center of frequency rectangle
encloses α percent of power and summation is taken over values of (u,v) that lie inside the circle or on
boundary
  100 [   P ( u , v ) / PT ]
u v

© 1992–2008 R. C. Gonzalez & R. E. Woods


Butterworth low pass filters:
The transfer function of a Butterworth LPF of order n, and with cutoff frequency
at a distance Do from the origin is defined as
1
H (u, v) 
1 [D(u, v) / D0 ]2n
Gaussian Low pass filters:  D 2 ( u ,v ) / 2 2
H (u, v)  e
As before, σ is a measure of spread about the center. By letting σ = Do, we can express the
filter using the notation of the other filters in this section,
 D 2 ( u ,v ) / 2 D0 2
H (u, v)  e
Where Do is the cutoff frequency. When D(u,v)=Do , the GLPF is down to 0.607 of its max.
Value.
Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

IMAGE SHARPENING USING FREQUENCY DOMAIN FILTERS:

A high pass filter is obtained from a given LPF using the equation

HHP(u, v) 1 HLP(u, v)


Ideal High Pass Filters: A 2-D IHPF is defined as

0 if D(u,v) ≤ Do
H(u, v)  
1 if D(u,v) > Do

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

 Collect information about


 The Laplacian in frequency domain
 Unsharp masking, highboost filtering, high frequency emphasis filtering
 Homomorphic filtering

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

SELECTIVE FILTEREING:

 Bandreject or Bandpass Filters


 Notch filters

HBP(u, v) 1 HBR(u, v)

© 1992–2008 R. C. Gonzalez & R. E. Woods


Digital Image Processing, 3rd ed.
Gonzalez & Woods
www.ImageProcessingPlace.com

Chapter 4
Filtering in the Frequency Domain

DIFFERENT BAND REJECT FILTERS:

Notch Filters:
A notch filter rejects or passes frequencies in a predefined neighborhood about the center of the
frequency rectangle . Notch reject filter is constructed as
Q
H NR (u , v )   H k (u , v ) H  k (u , v )
k 1

Hk(u,v) and H-k(u,v) are high pass filters whose centers are at (uk ,vk) and (-uk ,-vk) respectively

H NP (u, v)  1  H NR (u, v)

© 1992–2008 R. C. Gonzalez & R. E. Woods

You might also like