100% found this document useful (1 vote)
206 views

Digital Image Processing (Chapter 4)

The document discusses frequency domain processing techniques for image enhancement. It begins with an overview of image enhancement and frequency domain processing. It then provides background on Fourier transforms, including continuous and discrete cases for one-dimensional and two-dimensional transforms. It discusses the frequency domain and various frequency domain concepts. Finally, it covers basic filtering concepts and examples of different types of lowpass filters for smoothing images, including ideal lowpass filters, Butterworth lowpass filters, and Gaussian lowpass filters.
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
100% found this document useful (1 vote)
206 views

Digital Image Processing (Chapter 4)

The document discusses frequency domain processing techniques for image enhancement. It begins with an overview of image enhancement and frequency domain processing. It then provides background on Fourier transforms, including continuous and discrete cases for one-dimensional and two-dimensional transforms. It discusses the frequency domain and various frequency domain concepts. Finally, it covers basic filtering concepts and examples of different types of lowpass filters for smoothing images, including ideal lowpass filters, Butterworth lowpass filters, and Gaussian lowpass filters.
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/ 62

4 Image Enhancement in the

Frequency Domain
• Image Enhancement:
– The objective of image enhancement is to process an
image so that the result is more suitable than the
original image for a specific application.
• Frequency domain processing techniques are
based on modifying the Fourier Transform of an
image
• The frequency domain refers to the plane of the
two dimensional discrete Fourier transform of an
image.
Background
• Fourier series
– 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 transform
– 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
• The purpose of the Fourier transform is to represent a
signal as a linear combination of sinusoidal signals of
various frequencies
• Return to the original domain without losing any
information via an inverse process
• Widely used in signal processing field
Background
Fourier Transform-Continuous Case
• The one-dimensional Fourier transform and its inverse
– Fourier transform:

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

f ( x)   F (u )e j 2ux du

• The two-dimensional Fourier transform and its inverse
– Fourier transform:
 
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
 
Fourier Transform-Discrete Case
• The one-dimensional Fourier transform and its inverse
– Fourier transform:
M 1
1
F (u ) 
M
 f ( x )e
x 0
 j 2ux / M
for u  0,1,2,..., M  1

– Inverse Fourier transform:


M 1
f ( x)   F (u )e j 2ux / M for x  0,1,2,..., M  1
u 0
One Dimensional Fourier Transform
and Frequency Domain
• Since e j  cos  j sin then discrete Fourier
transform can be redefined
M 1
1
F (u ) 
M
 f ( x)[cos 2ux / M  j sin 2ux / M ]
x 0
for u  0,1,2,..., M  1
– Frequency (time) domain: the domain (values of u) over
which the values of F(u) range.
– Frequency (time) component: each of the M terms of F(u).
One Dimensional Fourier Transform
• F(u) can be expressed in polar coordinates:
F (u )  F (u ) e j (u )

 
1
where F (u )  R (u )  I (u )
2 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 )
One Dimensional Fourier Transform
Examples
One Dimensional Fourier Transform
Examples
• The transform of a constant function is a DC value only.

• The transform of a delta function is a constant.


One Dimensional 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.
One Dimensional 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.


Fourier Transform-Discrete Case
• The two-dimensional Fourier transform and its inverse
– Fourier transform:
1 M 1 N 1
F (u, v)  
MN x 0 y 0
f ( x , y ) e  j 2 ( ux / M  vy / N )

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


– Inverse Fourier transform:
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
Two Dimensional Fourier Transform
• We define the Fourier spectrum, phase anble, and power
spectrum as follows:

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

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


– I(u,v): the imaginary part of F(u,v)
Fourier Transform
• Some properties of Fourier transform:

 f ( x, y )(1) x y
 M N
 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)
Centering Two Dimensional DFT

shift
Centered Two Dimensional Frequency
Spectrum
Two Dimensional DFT-Rotation

DFT

DFT
Two Dimensional DFT-Linear
Combination
A
DFT

B
DFT

0.25 * A
+ 0.75 * B DFT
Two Dimensional DFT-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.
Two Dimensional DFT Examples

Sine wave Its DFT

Rectangle
Its DFT
Two Dimensional DFT Examples

2D Gaussian Its DFT


function

Impulses
Its DFT
Filtering Concept in the Frequency
Domain
Basic Steps for Filtering
Basic Filter and Its Function
• 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.
Basic Filters

Lowpass filter

Highpass filter
Highpass Filter
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
Ideal Lowpass Filter (ILPF)
• 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
ther frequency rectangle

 
1
D (u , v)  (u  M / 2)  (v  N / 2)
2 2 2
Ideal Lowpass Filter
Ideal Lowpass Filter
Ideal Lowpass Filter Examples
Ideal Lowpass Filter

frequency

Figure 4.13 (a) A frequency-domain


ILPF of radius 5. (b) Corresponding
spatial filter. (c) Five impulses in the
spatial domain, simulating the values spatial
of five pixels. (d) Convolution of (b)
and (c) in the spatial domain.

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

spatial
Butterworth Lowpass Filter (BLPF)

1
H (u , v) 
1  D (u , v) / D0 
2n
Butterworth Lowpass Filter
Examples
Butterworth Lowpass Filter
Spatial Representation

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


Gaussian Lowpass Filter (GLPF)
 D 2 ( u ,v ) / 2 D02
H (u, v)  e
Gaussian Lowpass Filter Example
Gaussian Lowpass Filter Example
Gaussian Lowpass Filter Example
Properties of Gaussian Filters
• 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.
Correspondence between Filtering in
the Spatial and Frequency Domain
• 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.
Correspondence between Filtering in
the Spatial and Frequency Domain
Sharpening Frequency Domain Filter
H hp (u, v)  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
Highpass Filters
Spatial Representationn
Ideal Highpass Filter (IHPF)
0 if D (u , v )  D0
H (u , v )  
1 if D (u , v)  D0
Butterworth Highpass Filter (BHPF)

1
H (u , v) 
1  D0 / D (u , v)
2n
Gaussian Highpass Filter (GHPF)
 D 2 (u ,v ) / 2 D02
H (u, v)  1  e
The Laplacian in the Frequency
Domain
𝑑 𝑛 𝑓(𝑥)
• ℑ = 𝑗𝑢 𝑛 𝐹(𝑢)
𝑑𝑥 𝑛
𝑑 2 𝑓(𝑥,𝑦) 𝑑 2 𝑓(𝑥,𝑦)
• ℑ +
𝑑𝑥 2 𝑑𝑦 2
2
• = 𝑗𝑢 𝐹 𝑢, 𝑣 + Frequency
𝑗𝑣 2 𝐹(𝑢, 𝑣) domain

• = −(𝑢2 + 𝑣 2 )𝐹 𝑢, 𝑣
• The Laplacian filter
H (u, v)  (u 2  v 2 )
• Shift the center:
 M N  Spatial domain
H (u , v)   (u  ) 2  (v  ) 2 
 2 2 
The Laplacian in the Frequency
Domain

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
Implementation
• Periodicity, symmetry, and back-to-back properties

shift
Implementation
• Separability
Implementation
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)


Correspondence between Filtering in
the Spatial and Frequency Domain
• Convolution theorem:
– 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

• Flipping one function about the origin


• Shifting that function with respect to the other by changing the
values of (x, y)
• Compute the sum of products over all values of m and n, for each
displacement.
Correspondence between Filtering in
the Spatial and Frequency Domain
• Convolution theorem:
– 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)
• Expression on the left can be obtained by taking the inverse
Fourier Transform of the expression on the right
– An analogous result
f ( x, y)h( x, y)  F (u, v)  H (u, v)
Correspondence between Filtering in
the Spatial and Frequency Domain
• A ( x  x0 , y  y0 ) :an impulse function of strength A, located at
coordinates (x0,y0)
M 1 N 1

 s( x, y) A ( x  x , y  y )  As( x , y )
x 0 y 0
0 0 0 0

M 1 N 1

 s( x, y) ( x, y)  s(0,0)
x 0 y 0
where  ( x, y): a unit impulse located at the origin
• The Fourier transform of a unit impulse at the origin (Eq. (4.2-
35)) : 1 M 1 N 1 1
F (u , v) 
MN
  ( x
x 0 y 0
, y ) e  j 2 ( ux / M  vy / N )

MN
Correspondence between Filtering in
the Spatial and Frequency Domain
• Let f ( x, y)   ( x, y,)then the convolution (Eq. (4.2-36))
1 M 1 N 1
f ( x, y )  h ( x, y )  
MN m 0 n 0
 (m, n)h( x  m, y  n)

1
 h ( x, y )
MN
• Combine Eqs. (4.2-35) (4.2-36) with Eq. (4.2-31), we obtain
f ( x, y )  h( x, y )  F (u, v) H (u, v)
 ( x, y )  h( x, y )   ( x, y )H (u, v)
1 1
h ( x, y ) H (u, v)
MN MN
h( x, y )  H (u, v)
More on Periodicity
Convolution
f ( x )  h( x ) 
M 1
1
M
 f ( m) h ( x  m)
m 0
extend

extend
Summary of Some Important
Properties of 2-D Fourier Transform
Summary of Some Important
Properties of 2-D Fourier Transform
Summary of Some Important
Properties of 2-D Fourier Transform
Summary of Some Important
Properties of 2-D Fourier Transform

You might also like