Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 101

Digital Image Processing

Chapter 4
Filtering in the Frequency Domain

4. Filtering in the Frequency Domain


1. Background
2. Preliminary Concepts
3. Sampling and the Fourier Transform of Sampled Functions
4. The Discrete Fourier Transform of One Variable
5. Extension to Functions of Two Variables
6. Some Properties of the 2-D Discrete Fourier Transform
7. The Basics of Filtering in the Frequency Domain
8. Image Smoothing using Frequency Domain Filters
9. Image Sharpening using Frequency Domain Filters
10. Selective Filtering

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


Digital Image Processing

Chapter 4
Filtering in the
Frequency Domain

4.1 Background

Fourier Series and Transform

Jean-Baptiste Fourier (1768)


•Any periodic function can be expressed as a
weighted sum of sines and/or cosines (Fourier
series)
•Other functions can be expressed as an integral
of sines and/or cosines multiplied by a weighing
function (Fourier Transform)
•Functions can be recovered by the inverse
operation with no loss of information
• Applications to Image Enhancement

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


Digital Image Processing

Chapter 4
Filtering in the Frequency Domain

2. Preliminary Concepts

1. Fourier Series
If f(t) is a periodic function of a continuous variable t, with period T

Where:

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


Digital Image Processing

Chapter 4
Filtering in the Frequency Domain

4.2.3 Impulses and their Shifting Property

Unit impulse of a continuous variable t located at t=0 :

and

Shifting property
:

(if f(t) continuous at t=0 )

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


Digital Image Processing

Chapter 4
Filtering in the Frequency Domain

Unit discrete impulse located at x=0 :

Sifting property :

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


Digital Image Processing Chapter 4
Filtering in the Frequency
Domain

Impulse train : sum of infinitely many periodic impulses T units apart:

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


Digital Image Processing

Chapter 4
Filtering in the Frequency Domain

4.2.4 The Fourier Transform of Functions of One Continuous Variable

Fourier Transform of a continuous function f(t) of a continuous variable t :

Inverse Fourier Transform:

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


Digital Image Processing

Chapter 4
Filtering in the Frequency
Domain

Example :

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


Digital Image Processing

Chapter 4
Filtering in the Frequency
Domain

Example 2 : Fourier Transform of a unit impulse located at the origin:

Fourier Transform of a unit impulse located at t = t0 :

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


Digital Image Processing

Chapter 4
Filtering in the Frequency Domain

Example 2 : Fourier Transform S() of an impulse train with period T :


Periodic function with period T =>

Where :

=>

Also an impulse train, with period 1/T

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


Digital Image Processing

Chapter 4
Filtering in the Frequency Domain

4.2.5 Convolution
Convolution of functions f(t) and h(t), of one continuous variable t :

Fourier Transform pairs:

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


Digital Image Processing

Chapter 4
Filtering in the Frequency Domain

4.3 Sampling and the Fourier Transform of Sampled Functions

4.3.1 Sampling

Model of the sampled function:


multiplication of f(t) by a sampling
function equal to a train of impulses T
units apart

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


Digital Image Processing

Chapter 4
Filtering in the Frequency Domain

4.3.2 The Fourier Transform of Sampled Functions

Infinite, periodic sequence of copies of F(), continuous


Separation between copies determined by 1/T

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


Digital Image Processing Chapter 4
Filtering in the
Frequency Domain

4.3.3 The Sampling Theorem

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


Digital Image Processing

Chapter 4
Filtering in the
Frequency Domain

A function f(t) whose Fourier transform is zero


for values of frequencies outside a finite
interval (band) [- max, max] about the origin is
called a band-limited function
Sufficient separation guaranteed if:

Sampling Theorem:
A continuous, band-limited function can be recovered completely
from a set of its samples if the samples are acquired at a rate
exceeding twice the highest frequency content of the function

NB: Sampling at: Nyquist rate

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency
Domain

=> Recover f(t) using the inverse FT:

Example: ideal lowpass filter

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the
Frequency Domain

4.3.4 Aliasing

Effect of under-sampling a function


Transform corrupted by frequencies
from adjacent periods

NB: the effect of aliasing can be reduced


by smoothing the input function to
attenuate its higher frequencies: anti-
aliasing.
Has to be done before the sampling

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.3.4 Aliasing

Illustration: sampling a sine wave of period 2s

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.3.5 Function Reconstruction (Recovery) from Sampled Data

Recovery expressed in the spatial domain:

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4. The Discrete Fourier Transform (DFT) of One Variable

1. Obtaining the DFT from the Continuous Transform of a Sampled Function

fn : discrete function

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4. The Discrete Fourier Transform (DFT) of One Variable

1.Obtaining the DFT from the Continuous Transform of a Sampled Function

Given a set {f(x)} of M samples of f(t) the DFT is of f(x) is:

Inverse Discrete Fourier Transform (IDFT):

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4. The Discrete Fourier Transform (DFT) of One Variable

1.Obtaining the DFT from the Continuous Transform of a Sampled Function

Both forward and inverse discrete transforms are infinitely periodic, with period M

Where k is an integer

Discrete equivalent of the convolution:

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.4 The Discrete Fourier Transform (DFT) of One Variable

4.4.2 Relationship between the Sampling and Frequency Intervals

If f(x) consists of M samples of a function f(t) taken T units apart, the duration of
the record comprising the set {f(x)} is:
T = M T

The corresponding spacing in the discrete frequency domain is:


u = 1 / (M T) = 1/T
The entire frequency range spanned by the M components in the DFT is:
M u = 1/ T

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

5. Extension to Function of Two Variables

1.The 2-D impulse and its Sifting Property

Impulse of two continuous variables t and z :

Impulse of two continuous variables t and z :

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

5. Extension to Function of Two Variables

1.The 2-D impulse and its Sifting Property

Sifting property:

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

5. Extension to Function of Two Variables

1.The 2-D impulse and its Sifting Property 2-

D discrete impulse:

Sifting property:

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.5 Extension to Function of Two Variables

4.5.2 The 2-D Continuous Fourier Transform Pair

f(t,z) continuous function of two continuous variables t and z, the 2-D continuous
Fourier transform pair is given by:

and

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency Domain

Example: Obtaining the 2-D Fourier transform of a simple function

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.5.3 Two-Dimensional Sampling and the 2-D Sampling Theorem

Sampling in 2-D can be modeled using the sampling function (2-D impulse train):

Multiplying f(t,z) by yields the sampled function

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

f(t,z) is said to be band-limited if its Fourier transform is 0 outside of a rectangle


[- max, max] and [- max, max]
2-D sampling theorem:
A continuous, band-limited function f(t,z) can be recovered with no error from a
set of its sample if the sampling intervals are

and

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.5.4 Aliasing in Images


Example: sampling checkerboards whose squares are of size 16x6 pixels

Effects of aliasing can be reduced by slightly defocusing the scene to be digitized (attenuation of
high frequencies), before the image is sampled : anti-aliasing

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency Domain

Effects of aliasing generally are worsened when the size of a digital image is reduced

Scaling: 50% Blurring prior to Scaling: 50%

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

Moiré patterns
In optics: beat patterns produced between two gratings of approximately equal spacing

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.5.5 The 2-D Discrete Fourier Transform and its Inverse

2-D Discrete Fourier Transform (DFT) of a digital image f(x,y) of size MxN:

Inverse Discrete Fourier Transform (IDFT):

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

6. Some Properties of the 2-D Discrete Fourier Transform

1. Relationships between Spatial and Frequency Domains

If T and Z are the separations between samples, the separations between the
corresponding discrete, frequency domain variables are:
and

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.6.2 Translation and Rotation

Translation:

and

Rotation (polar coordinates):

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.6.3 Periodicity

The 2-D Fourier Transform and its inverse are infinitely periodic in both directions:

and

where k1 and k2 are integers

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the
Frequency Domain

4.6.3 Periodicity

1-D Spectrum

Shift the data so that the origin,


F(0), is located at u0

If u0 = M/2

F(0) at the centre of the interval [0, M-1]

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.6.3 Periodicity

2-D Spectrum

Shift the data so that the origin, F(0,0), is


at the centre of the frequency rectangle
defined by [0, M-1] and [0, N-1]

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency
Domain

FT Spectrum

Centered
FT Spectrum

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency
Domain

(Reminder)

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.6.4 Symmetry Properties

Example:
If f(x,y) is a real function,
its Fourier transform is
conjugate symmetric:

If f(x,y) is a imaginary, its Fourier transform is conjugate antisymmetric:

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency Domain

4.6.4 Symmetry Properties

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.6.5 Fourier Spectrum and Phase Angle

The 2-D DFT can be expressed in polar form:

Where the magnitude

is called the Fourier (or frequency) spectrum, and

is the phase angle

Power spectrum:

NB: R and I are the real and imaginary parts of F(u,v)

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.6.5 Fourier Spectrum and Phase Angle

and

=>

Where denotes
the average value of f

MN usually large => |F(0,0)| typically is the largest component of the spectrum

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency
Domain

FT Spectrum

FT Spectrum
(centered)
FT Spectrum
(centered + log)

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency
Domain
Original Image FT Spectrum
Spectrum is insensitive to
translation
But rotates by the same
angle
as the rotated image

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency
Domain

Phase angle images:

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency
Domain

Phase angle

Reconstruction
using phase angle only

Reconstruction using Reconstruction using:


spectrum only • Right Spectrum
• Wrong Phase

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.6.6 The 2-D Convolution Theorem

2-D circular convolution :

2-D convolution theorem :

and conversely:

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency
Domain

Data from adjacent periods produce


wraparound error
=> Need to append zeros to both
functions

In 2-D, padd the two images array


of size
MxN by zeros
Padded images of size PxQ, with:
P  2M-1
and
Q  2N-1

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency Domain

4.6.7 Summary of 2-D Discrete Fourier Transform Properties

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency Domain

4.6.7 Summary of 2-D Discrete Fourier Transform Properties

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency Domain

4.6.7 Summary of 2-D Discrete Fourier Transform Properties

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency Domain

4.6.7 Summary of 2-D Discrete Fourier Transform Properties

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

7. The Basics of Filtering in the Frequency Domain

1. Additional Characteristics of the Frequency Domain

FT Spectrum

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.7.2 Frequency Domain Filtering Fundamentals

Given a digital image f(x,y) of size MxN, the basic filtering equation is:

NB: product = array


multiplication
Filtered (output) image Filter function DFT if the input image
(or filter transfer
function)

NB: For simplification, use functions H(u,v)


that are centered symmetric about their
centre
+ centre F(u,v) multiplying f(x,y) by (-1)x+y

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency
Domain

Lowpass filter highpass filter

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency
Domain

Gaussian lowpass filter Gaussian lowpass filter


Without padding With padding

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency
Domain

Periodicity Periodicity
without padding without padding

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

3. Steps for Filtering in the Frequency Domain

1. Given an input image f(x,y) of size MxN, obtain padding parameters P and
Q. Typically, P=2M and Q=2N.
2. Form a padded image fp(x,y) of size PxQ by appending the necessary number
of zeros to f(x,y).
3. Multiply fp(x,y) by (-1)x+y to centre 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 PxQ with centre at
coordinates (P/2,Q/2). Form the product G(u,v)=H(u,v)F(u,v) using array
multiplication.
6. Obtain the processed image:
7. Obtain the final processed result, g(x,y), by extracting the MxN region from
the top, left quadrant of gp(x,y)

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency
Domain
4.7.3 Steps for Filtering in the Frequency Domain
2) Padding 3) (-1)x+y

1)

4) DFT

5) Filter H

6) Filtered
image (IDFT) 7) Final
Result
© 1992–2008 R. C. Gonzalez & R. E. Woods
Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

8. Image Smoothing using Frequency Domain Filters


NB: all filter functions are assumed to be discrete functions of size PxQ

1. Ideal Lowpass Filters


Ideal Lowpass Filter (ILPF) = 2-D lowpass filter that passes without attenuation all
frequencies within a circle of radius D0 from the origin and “cuts off” all frequencies
outside this circle

Where:
And D(u,v) is the distance between a point (u,v) and the centre of the frequency rectangle:

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.8.1 Ideal Lowpass Filters

The point of transition between H(u,v) = 1 and H(u,v) = 0 is called the cutoff
frequency

NB: an ILPF cannot be realized with real electronic components

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency
Domain
r = 10

4.8.1 Ideal Lowpass Filters

Example:
r = 30

r = 60

r = 160 r = 460

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency
Domain

Explaining the blurring and “ringing” properties of ILPFs

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.8.2 Butterworth Lowpass Filters

Transfer function of a Butterworth lowpass filter (BLPF) of order n and with


cutoff frequency at a distance D0 from the origin:

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency Domain

4.8.2 Butterworth Lowpass Filters

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency Domain

4.8.2 Butterworth Lowpass Filters

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.8.3 Gaussian Lowpass Filters

Gaussian Lowpass Filters (GLPFs) in two-dimensions:

( = measure of spread about the centre)

(D0 = cutoff frequency)

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency Domain

4.8.3 Gaussian Lowpass Filters

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency
Domain

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.8.4 Additional Examples of Lowpass Filtering

Character recognition (machine perception):

Blurring to fill “visual gaps” => help reading broken characters

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

Printing and publishing industry: “cosmetic” processing

GLPF
(Do=80)
Original
Image
GLPF
(Do=100)

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.9 Image Sharpening using Frequency Domain Filters

Highpass filtering: attenuation of the high-frequency components of the Fourier


transform of the image
As before :
• Radially symmetric filters
• All filter functions are assumed to be discrete functions of size PxQ

A highpass HHP filter can be obtained from a given lowpass HLP filter by:

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.9.1 Ideal Highpass Filters

A 2-D Ideal Highpass Filter (IHPF) is defined as:

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency
Domain

Ideal Highpass Filter:

Butterworth Highpass Filter:

Gaussian Highpass Filter:

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency
Domain

Ideal Butterworth Gaussian


Highpass Filter Highpass Filter Highpass Filter

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.9.1 Ideal Highpass Filters

Do = 30 Do = 60 Do = 160

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.9.2 Butterworth Highpass Filters

A 2-D Butterworth Highpass Filter (BHPF) of order n and cutoff frequency D0 is


defined as:

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.9.2 Butterworth Highpass Filters

Do = 30 Do = 60 Do = 160

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.9.3 Gaussian Highpass Filters

The transfer function of the Gaussian Highpass Filter (GHPF) with cutoff frequency
locus at a distance D0 from the centre of the frequency rectangle is defined as:

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.9.3 Gaussian Highpass Filters

Do = 30 Do = 60 Do = 160

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency
Domain

0
1

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency
Domain

Example: using highpass filtering and thresholding for image enhancement

Highpass filtering

Thresholding

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.9.4 The Laplacian in the Frequency Domain

Or, with respect to the centre of the frequency rectangle:

The Laplacian image is obtained by:

Enchancement of the image is achieved using (H(u,v) negative):

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.9.4 The Laplacian in the Frequency Domain

 Introduction of large scaling factors


 Practical solution: normalize f(x,y) to the range [0,1] before computing the DFT,
and divide by its maximum value

© 1992–2008 R. C. Gonzal ez & R. E. Woods


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.9.5 Unsharp Masking, Highboost Filtering and High-Frequency-Emphasis Filtering

with

Smoothed image Lowpass Filter

output image: • k=1 => unsharp masking


• k>1 => highboost filtering

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.9.5 Unsharp Masking, Highboost Filtering and High-Frequency-Emphasis Filtering

Expressed in terms of frequency domain computations:

Lowpass filter:

Highpass filter:
High-frequency-
emphasis filter

More general formulation:

Where: gives controls of the offset from the origin


controls the contribution of high frequencies

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.9.5 Unsharp Masking, Highboost Filtering and High-Frequency-Emphasis Filtering

Gaussian highpass
filtering

High-frequency Histogram
emphasis filtering Equalisation

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

10. Selective Filtering


1. Bandreject and Bandpass Filters

A bandpass filter is obtained from a bandreject filter as:

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.10.1 Bandreject and Bandpass Filters


Example: Bandreject Gaussian filter

Bandreject Bandpass

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.10.2 Notch Filters

Reject (or pass) frequencies in a predefined neighbourhood about the centre of the
frequency rectangle
Constructed as products of highpass filters whose centres have been translated to
the centres of the notches

centre at centre at

=> Distances computations:

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.10.2 Notch Filters

Example: Butterworth notch reject filter of order n, containing 3 notch pairs:

A Notch Pass filter (NP) is obtained from a Notch Reject filter (NR) using:

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency
Domain

Newspaper image FT Spectrum

Butterworth notch
reject filter Filtered image
multiplied by FT

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


T. Peynot

Digital Image Processing Chapter 4


Filtering in the Frequency
Domain

FT Spectrum

Vertical
notch reject
filter

Filtered image
© 1992–2008 R. C. Gonzalez & R. E. Woods
Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

11. Implementation
1. Separability of the 2-D DFT

The 2-D DFT is separable into 1-D transforms:

Where:

= 1-DFT of a row of f(x,y)

The 2-D DFT of f(x,y) can be obtained by computing the 1-D transform of each row of
f(x,y) and then computig the 1-D transform along each column of the result

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.11 Implementation
4.11.2 Computing the IDFT Using a DFT Algorithm

=> = DFT of

 To compute the IDFT :


Compute the 2-D forward DFT of
Take the complex conjugate and multiply the result by 1/MN

NB: when f(x,y) is real :

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.11.3 The Fast Fourier Transform (FFT)

where:

M assumed to be =>

=>

=>

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

4.11.3 The Fast Fourier Transform (FFT)

• Direct implementation: on the order of (MN)2 summations and additions required


• FFT implementation: order of (MN log2 MN )

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


Digital Image Processing
T. Peynot

Chapter 4
Filtering in the Frequency Domain

Glossary

• FT = Fourier Transform
• DFT = Discrete Fourier Transform
• IDFT = Inverse Discrete Fourier Transform
• FFT = Fast Fourier Transform
• ILPF (IHPF) = Ideal Lowpass (Highpass) Filter
• BLPF (BHPF) = Butterworth Lowpass (Highpass) Filter
• GLPF (GHPF) = Gaussian Lowpass (Highpass) Filter
• BP = Bandpass
• BR = Bandreject
• NP = Notch Pass
• NR = Notch Reject

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

You might also like