0% found this document useful (0 votes)
9 views

DIP05-DFT Domain Image Filtering

This lecture covers image enhancement techniques in the frequency domain, focusing on Fourier transforms, both 1-D and 2-D, and various filtering methods including lowpass and highpass filters. Key concepts include the properties of Fourier transforms, the discrete Fourier transform, and the implementation of Gaussian, Butterworth, and ideal filters for image processing. The lecture emphasizes the mathematical foundations and practical applications of these techniques in enhancing image quality.

Uploaded by

Vu Phan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

DIP05-DFT Domain Image Filtering

This lecture covers image enhancement techniques in the frequency domain, focusing on Fourier transforms, both 1-D and 2-D, and various filtering methods including lowpass and highpass filters. Key concepts include the properties of Fourier transforms, the discrete Fourier transform, and the implementation of Gaussian, Butterworth, and ideal filters for image processing. The lecture emphasizes the mathematical foundations and practical applications of these techniques in enhancing image quality.

Uploaded by

Vu Phan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Lecture 05

Image Enhancement
in Frequency Domain
Contents

In this lecture we will look at image enhancement in


frequency domain:
 1-D and 2-D Fourier transforms
 1-D and 2-D discrete Fourier transform
 Lowpass filters: ideal, Butterworth, Gaussian
 Highpass filters: ideal, Butterworth, Gaussian
 Important properties of Fourier transform

Image Enhancement in Frequency Domain 2


Background

 Any function that periodically repeats itself can be


expressed as the sum of sines and/or cosines of
different frequencies, each multiplied by a different
coefficient (Fourier series).
 Even functions that are not periodic (but whose area
under the curve is finite) can be expressed as the
integral of sines and/or cosines multiplied by a
weighting function (Fourier transform).
 The purpose of the Fourier transform is to represent a
signal as a linear combination of sinusoidal signals of
various frequencies.

Image Enhancement in Frequency Domain 3


Background

Image Enhancement in Frequency Domain 4


Fourier transform

 The one-dimensional Fourier transform and its


inverse
• Fourier transform (continuous case)

F (u )   f ( x)e  j 2ux dx where j   1 e j  cos   j sin 



• Inverse Fourier transform: f ( x)   F (u )e j 2ux du
 The two-dimensional Fourier transform and its inverse
• Fourier transform (continuous case)
 
F (u , v)    f ( x, y )e  j 2 ( ux  vy ) dxdy
 
• Inverse Fourier transform:
 
f ( x, y )    F (u , v)e j 2 ( ux  vy ) dudv
 

Image Enhancement in Frequency Domain 5


Discrete Fourier transform

 The one-dimensional discrete Fourier transform and its


inverse

• Discrete Fourier transform (DFT)

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

• Inverse discrete Fourier transform (IDFT):


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

Image Enhancement in Frequency Domain 6


Fourier transform and frequency domain

 F(u) can be expressed in polar coordinates:


F (u )  F (u ) e j (u )
1
 2
where F (u )  R (u )  I (u ) 2

2 (magnitude or spectrum)
 I (u ) 
 (u )  tan 1   (phase angle or phase spectrum)
 R (u ) 
• R(u): the real part of F(u)
• I(u): the imaginary part of F(u)

 Power spectrum: 2
P(u )  F (u )  R 2 (u )  I 2 (u )

Image Enhancement in Frequency Domain 7


1D- Fourier transform-Example

Image Enhancement in Frequency Domain 8


1D Fourier transform-Examples

 The transform of a constant function is a DC value only.

 The transform of a delta function is a constant.

Image Enhancement in Frequency Domain 9


1D Fourier transform-Examples

 The transform of an infinite train of delta functions spaced


by T is an infinite train of delta functions spaced by 1/T.

 The transform of a cosine function is a positive delta at the


appropriate positive and negative frequency.

Image Enhancement in Frequency Domain 10


1D Fourier transform-Examples

 The transform of a sin function is a negative complex delta


function at the appropriate positive frequency and a
negative complex delta at the appropriate negative
frequency.

 The transform of a square pulse is a sinc function.

Image Enhancement in Frequency Domain 11


2D discrete Fourier transform

 Discrete Fourier transform (2D-DFT)


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

for u  0,1,2,..., M  1, v  0,1,2,..., N  1

 Inverse discrete Fourier transform (2D-IDFT)


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

for x  0,1,2,..., M  1, y  0,1,2,..., N  1


- u, v : the transform or frequency variables
- x, y : the spatial or image variables

Image Enhancement in Frequency Domain 12


Fourier transform-frequency domain

 We define the Fourier spectrum, phase angle, and


power spectrum as follows:
1
 2 2
F (u, v)  R (u , v)  I (u , v) 
2 ( spectrum)
 I (u, v) 
1
 (u , v)  tan   (phase angle)
 R (u, v) 
2
P (u,v)  F (u , v)  R 2 (u, v)  I 2 (u , v) (power spectrum)

• R(u,v): the real part of F(u,v)


• I(u,v): the imaginary part of F(u,v)

Image Enhancement in Frequency Domain 13


Amplitude spectrum

Image Enhancement in Frequency Domain 14


2D DFT with different functions

Sine wave Its DFT

Rectangle
Its DFT

Image Enhancement in Frequency Domain 15


2D DFT with Different Functions

2D Gaussian Its DFT


function

Impulses
Its DFT

Image Enhancement in Frequency Domain 16


Properties of Fourier transform

 Some properties of Fourier transform:

M N

 f ( x, y )(1) x y
  F (u  , v  ) (shift)
2 2
M 1 N 1
1
F (0,0) 
MN
 f ( x, y)
x 0 y 0
(average)

F (u, v)  F * (u ,v) (conujgate symmetric)


F (u , v)  F (u,v) (symmetric)

Image Enhancement in Frequency Domain 17


Properties of Fourier transform: Shift

shift
Image Enhancement in Frequency Domain 18
Properties of Fourier transform: Separable

The 2D DFT F(u,v) can be obtained by


1. taking the 1D DFT of every row of image f(x,y), F(u,y),
2. taking the 1D DFT of every column of F(u,y)

(a) f(x,y) (b) F(u,y) (c) F(u,v)

Image Enhancement in Frequency Domain 19


Properties of Fourier transform: Rotation

DFT

DFT

Image Enhancement in Frequency Domain 20


Properties of Fourier transform:
Linear combination

A
DFT

B
DFT

0.25 * A
+ 0.75 * B
DFT

Image Enhancement in Frequency Domain 21


Properties of Fourier transform: Expansion

A
DFT

B DFT

Expanding the original image by a factor of n (n=2), filling


the empty new values with zeros, results in the same DFT.
Image Enhancement in Frequency Domain 22
Filtering in frequency domain

Image Enhancement in Frequency Domain 23


Some Basic Filters

 Multiply all values of F(u,v) by the filter function (notch filter):


 0 if (u , v )  ( M / 2, N / 2)
H (u , v)  
1 otherwise.
• All this filter would do is set F(0,0) to zero (force the average
value of an image to zero) and leave all frequency components of
the Fourier transform untouched.

Image Enhancement in Frequency Domain 24


Some Basic Filters

Lowpass filter

Highpass filter

Image Enhancement in Frequency Domain 25


Filtering in spatial and frequency domain

 The discrete convolution of two functions f(x,y) and


h(x,y) of size MXN is defined as
M 1 N 1
1
f ( x, y )  h ( x, y ) 
MN
 f (m, n)h( x  m, y  n)
m 0 n 0

 Let F(u,v) and H(u,v) denote the Fourier


transforms of f(x,y) and h(x,y), then

f ( x, y )  h( x, y )  F (u , v) H (u , v)
f ( x, y )h( x, y )  F (u , v)  H (u , v)

Image Enhancement in Frequency Domain 26


Gaussian filter

 Let H(u) denote a frequency domain, Gaussian filter


function given the equation
 u 2 / 2 2
H (u )  Ae
where  : the standard deviation of the Gaussian curve.
 The corresponding filter in the spatial domain is
2 2 2 x 2
h( x)  2 Ae

 Note: Both the forward and inverse Fourier transforms of


a Gaussian function are real Gaussian functions.

Image Enhancement in Frequency Domain 27


Gaussian filter

Image Enhancement in Frequency Domain 28


Gaussian filter

 One very useful property of the Gaussian function is that both it and
its Fourier transform are real valued; there are no complex values
associated with them.
 In addition, the values are always positive. So, if we convolve an
image with a Gaussian function, there will never be any negative
output values to deal with.
 There is also an important relationship between the widths of a
Gaussian function and its Fourier transform. If we make the width
of the function smaller, the width of the Fourier transform gets larger.
This is controlled by the variance parameter 2 in the equations.
 These properties make the Gaussian filter very useful for lowpass
filtering an image. The amount of blur is controlled by 2. It can be
implemented in either the spatial or frequency domain.
 Other filters besides lowpass can also be implemented by using two
different sized Gaussian functions.

Image Enhancement in Frequency Domain 29


Smoothing Frequency-Domain Filters

 The basic model for filtering in the frequency domain


G (u , v )  H (u , v) F (u , v)
where F(u,v): the Fourier transform of the image to be
smoothed
H(u,v): a filter transfer function

 Smoothing is fundamentally a lowpass operation in the


frequency domain.
 There are several standard forms of lowpass filters (LPF).
• Ideal lowpass filter
• Butterworth lowpass filter
• Gaussian lowpass filter

Image Enhancement in Frequency Domain 30


Ideal lowpass filters (ILPFs)

 The simplest lowpass filter is a filter that “cuts off” all


high-frequency components of the Fourier transform
that are at a distance greater than a specified
distance D0 from the origin of the transform.
 The transfer function of an ideal lowpass filter
1 if D (u , v)  D0
H (u , v)  
0 if D(u , v)  D0
where D(u,v) : the distance from point (u,v) to the
center of their frequency rectangle
1

D(u , v)  (u  M / 2) 2  (v  N / 2) 
2 2

Image Enhancement in Frequency Domain 31


Ideal lowpass filters (ILPFs)

Image Enhancement in Frequency Domain 32


Ideal lowpass filters (ILPFs)

Image Enhancement in Frequency Domain 33


Ideal Lowpass Filters

• As the filter radius


increases, less and less
power is removed, resulting
in less severe blurring.

• Ring is evident even the


image in which only 2% of
the total power was
removed.

Image Enhancement in Frequency Domain 34


Butterworth lowpass filters (BLPFs) with
order n
1
H (u , v) 
1  D(u , v) / D0 
2n

• The filter’s smooth transition between low and high frequencies


• No ringing visible in any of the image processed with BLPFs

Image Enhancement in Frequency Domain 35


Butterworth lowpass
filters

Butterworth lowpass
filters (BLPFs)

n=2
D0=5,15,30,80,and 230

• No ringing visible in any


of the image processed
with BLPFs

Image Enhancement in Frequency Domain 36


Gaussian lowpass filters (GLPFs)
 D 2 ( u , v ) / 2 D02
H (u , v)  e

• The GLPFs did not achieve as much smoothing as the BLPFs.


• No ringing for the GLPFs.

Image Enhancement in Frequency Domain 37


Gaussian lowpass
filters (FLPFs)

Gaussian Lowpass
Filters (FLPFs)

D0=5,15,30,80, and 230

• No ringing for the


GLPFs.

Image Enhancement in Frequency Domain 38


Additional examples of lowpass filtering

Image Enhancement in Frequency Domain 39


Sharpening frequency domain filter

H hp (u , v)  1  H lp (u , v)
Ideal highpass filter
0 if D (u , v )  D0
H (u , v)  
1 if D (u , v)  D0

Butterworth highpass filter


1
H (u , v ) 
1  D0 / D (u , v)
2n

Gaussian highpass filter


 D 2 ( u ,v ) / 2 D02
H (u , v )  1  e

Image Enhancement in Frequency Domain 40


Highpass Filters Spatial Representations

Image Enhancement in Frequency Domain 41


Ideal highpass filters

0 if D (u , v)  D0
H (u , v)  
1 if D (u , v)  D0

• Ringing problems are evident in (a) and (b)

Image Enhancement in Frequency Domain 42


Butterworth highpass filters
1
H (u , v) 
1  D0 / D(u , v)
2n

Image Enhancement in Frequency Domain 43


Gaussian highpass filters

 D 2 ( u ,v ) / 2 D02
H (u , v)  1  e

Image Enhancement in Frequency Domain 44


Laplacian in Frequency Domain

 The Laplacian filter


H (u , v)  (u 2  v 2 )
 Shift the center: Frequency
domain
 M N 
H (u , v )   (u  ) 2  (v  ) 2 
 2 2 

Spatial domain

Image Enhancement in Frequency Domain 45


g ( x, y )  f ( x, y )   2 f ( x, y )
where
 2 f ( x, y ) : the Laplacian - filtered
image in the spatial domain

For display
purposes only

Image Enhancement in Frequency Domain 46


Additional properties of 2D Fourier
transform

 Periodicity, symmetry, and back-to-back properties

shift

Image Enhancement in Frequency Domain 47


Additional properties of 2D Fourier
Transform

 Separability

Image Enhancement in Frequency Domain 48


Implementation More on Periodicity

Convolution
f ( x )  h( x ) 
M 1
1
M
 f ( m) h( x  m)
m 0

Image Enhancement in Frequency Domain 49


extend

extend

Image Enhancement in Frequency Domain 50


Important Properties of 2-D Fourier
Transform

Image Enhancement in Frequency Domain 51


Important Properties of 2-D Fourier
Transform

Image Enhancement in Frequency Domain 52


Important Properties of 2-D Fourier
Transform

Image Enhancement in Frequency Domain 53


Important Properties of 2-D Fourier
Transform

Image Enhancement in Frequency Domain 54


Summary

We have looked at Fourier transform and its applications


in image enhancement:
 Fourier transform and discrete Fourier transform for
image.
 Ideal, Butterworth and Gaussian filters.
 Image filtering in frequency domain.

Image Enhancement in Frequency Domain 55

You might also like