0% found this document useful (0 votes)
24 views30 pages

CH 6 Fourier Transform III

The document discusses the design and application of Finite Impulse Response (FIR) filters in digital image processing, focusing on filtering techniques for noise removal and feature enhancement. It details the McClellan-Park filter design method, which is a scalable approach for FIR filter design, and includes practical examples using MATLAB. The chapter concludes with exercises for implementing the discussed filters.

Uploaded by

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

CH 6 Fourier Transform III

The document discusses the design and application of Finite Impulse Response (FIR) filters in digital image processing, focusing on filtering techniques for noise removal and feature enhancement. It details the McClellan-Park filter design method, which is a scalable approach for FIR filter design, and includes practical examples using MATLAB. The chapter concludes with exercises for implementing the discussed filters.

Uploaded by

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

Introduction to Digital Image

Processing

Ho Dinh Duan
HCMC – 2020/22
Ch 6

Fourier Transform III


Contents

• Filter design issues and the Finite


Impulse Response (FIR) filters
• The McClellan-Park filter design
method
Filter design and Impulse
Response
Filters in signal processing
• The migrating from analog to digital in signal
processing (data communications, audio, image
and video systems etc.) has made tremendous
use of filtering techniques
• Filters play the role of “powering engines” during
the processing of data
• A simple intuitive description is
Filtering as a noise-removal or feature-
enhancement technique
• Filtering arose naturally from signal processing, for
example, as a remedy for noisy inputs. If noises came
in a relatively separate frequency, a cut-off of some
portion of unwanted frequencies will do, and it is a
simple way of filtering noise.
• The other prospect could be image enhancement: in
the transform domain, the desired featues are usually
more localized, as the transform has been designed
specifically
• Other phenomenons may occur in reality, which
requires more subtle method of filtering.
Filter and Impulse response
• In signal processing, an impulse response or IR is the
output of a system when we feed an impulse as the
input signal
• An impulse is any short duration signal; we typically
use a Dirac Delta function for analog/continuous
systems and Kronecker Delta for discrete-time/digital
systems

or in 2D
The FFT of an impulse
• Let’s see what the Fourier transform of a simple impulse in two
dimensions looks like, here simulated by the Fourier transform

0.8

0.6

0.4

0.2

0
15

10 15
10
5
5
0 0

A single impulse (valued 1) at the center of


background 16x16 (valued 0)
1.0000000000001

1.00000000000005

0.99999999999995

0.9999999999999

15

10 15
10
5
5
0 0

Its response, the magnitude of the FFT, is an


array of 1’s (like “white nose”)
1.5

0.5

-0.5

-1
15

10 15
10
5
5
0 0

3D plot of the real part of the FFT (left), and its 2D image (right)
1.5

0.5

-0.5

-1
15

10 15
10
5
5
0 0

3D plot of the imaginary part of the FFT (left), and its 2D image (right)
Filtering as a neighborhood operation

• In image processing, filtering is basically a


neighborhood operation, i.e it involves a set of
neighboring input pixels for calculation of an output
pixel
• Window-based filter (running correlation) is an
example
• The order of (sequential) inputs is important
• One class of frequently used filters is the Finite
Impulse Response (FIR) filters
Finite impulse response (FIR) filter

• A (one-dimensional) finite impulse response (FIR) filter is


a filter whose response to any finite length input is
of finite duration, because it settles to zero in finite time.
• A finite length input is often expressed in terms of a weighted
sum of Kronecker delta (∂(x)=1 when x=0, and zero
elsewhere).
• Finite impulse response (FIR) filter is a finite extent frequency
response to a set of single points, or impulses. The counterpart
is IIR (Infinite impulse response, which includes feedbacks),
but we often use the FIR thanks to its many advantages.
FIR cont’d
• An exactly linear phase-response can be achieved with FIR,
with the result that they can be used in the reconstruction of
signals without phase distortion. Under most practical
situations, FIR filters of high orders can be implemented
efficiently by indirect design approaches
• One of the major advantages of FIR filters is that near-optimal
multidimensional FIR filters can be designed easily starting
from one-dimensional (1-D) prototypes and using spectral
transformations to extend to two dimensions. This is similar to
what we have used before: moving window filtering, or
convolution.
Convolution and FIR
• As convolution (with finite kernel) is a form of FIR, it is
better described via the Convolution theorem in Fourier
transform context. Therefore, the Sinc function (and its
2D extension) is a good simulation for the response in
frequency domain.

0.8

0.6

0.4

0.2

-0.2

-0.4
-8 -6 -4 -2 0 2 4 6 8

Sinc() plot in 2D Sinc() plot in 3D


FIR filter design methods
There are various FIR filter design commonly used in
image processing:
 Moving window (convolution) method;
 Frequency sampling;
 The McClellan-Park method (also known as the equiripple,
optimal, or minimax method);
 etc.
Note that non-linear filters (like the Median filter) are also FIRs,
but they are usually difficult to analyze, despite the fact that they
in some cases can give better results than the linear ones.
The McClellan-Park design

• One of the most well-known filter design


methods
• It is a scalable approach for designing
FIR filters
• Useful for attacking the coefficient
quantization problem
The McClellan-Park method
• This filter works in the frequency domain
• For simplicity, we consider the one-dimensional
signal x(n), the filter h(k), and the output signal
y(n); the corresponding frequency function is

• The basic step is to derive a mathematical


representation of the filter using the so called
minimax approximation ([0, ]).

The following materials are credited to a


work by Silviu Filip, Universite de Lyon, 2015
• The most common representation for Finite
Impulse Response filter is the cosine series, which
possess a lot of desirable properties

• Let x be a new variable, x=cos(w), then cos(wk) is


a polynomial of x
• And we are interested in finding H(w) on a closed
set such that it would best approximate a given
continuous function D(w), with some weight
distribution W(w), i.e

is minimal.
Solution: the so called Alternation Theorem

(we will not fall into this mathematical result, credited to McClellan, Park and
Remez, as it demands a lot of preparatory works, just focus on its application)
McClellan-Park flowchart

Source: Silviu Filip


McClellan-Park implementation with Matlab
Matlab implements the McClellan-Park algorithm with the function
firpm(N,F,A) that returns the desired filter of length N+1;
H=firpm(N,F,A)
F is a vector of frequency band edges in pairs, in ascending order
between 0 and 1;
A is a real vector the same size as F which specifies the desired
amplitude of the frequency response of the resultant filter H;
Matlab example 1.5

The McClellan-Park method 1

Inputs: N=10, F=[0 .4 .5 1], A=[1 1 0 0];


0.5

Apply the McClellan-Park filter:


0

b=firpm(N,F,A) 0 0.5 1 1.5

(0.0595 -0.0980 -0.1174 0.0372 0.3079 0.4460 0.3079 0.0372


-0.1174 -0.0980 0.0595)

The FIR 1-d response


0.5

0.4

0.3

0.2

0.1

-0.1

-0.2
1 2 3 4 5 6 7 8 9 10 11
Plot of the frequency response

[H,w] = freqz(b,1,64,'whole');
colormap(jet(64));
plot(w/pi-1,fftshift(abs(H)));
h = ftrans2(b);
figure, freqz2(h,[32 32])

1.2

1.2
1
1

0.8

Magnitude
0.8
0.6

0.6 0.4

0.2
0.4
0
1

0.2 0.5 1
0 0.5
0
-0.5
-0.5
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 Fy -1 -1 Fx
The FFT of the same impulse response

1.2

0.8
20 0.6

0.4
40
0.2

60 0
60
20 40 60 40 60
40
20
20
0 0
The Frequency sampling method

20
40 Build a shape defining matrix (for example, a 128 x
60
80 128 matrix of zeros except a square at its center with
100
120
ones)
20 60 100

10-3
6

4
Using function fsamp2(), we get a filter of
2
frequency response
0
100
100
50 50
0 0

20
40
60
80
The resulted filter (a complex valued matrix)
100
120
20 60 100
Example of lowpass trapezoid filter

2D Impulse size (square) 51

10 Plot of the 2D impulse response using Matlab


20
30
fsamp2() with a meshgrid of size 51, disk1 size
40 D0=0.2, disk 2 D1=0.55 (normalized)
50
10 20 30 40 50
Impulse (3D mesh)

0.8

0.6

3D plot of the response


0.4

0.2

0
60
60
40
40
20
20
0 0
Trapezoid normalized D0=0.2, D1=0.55

1.2

0.8
Magnitude

0.6

0.4

0.2 The result of using freqz2()


0
1
0.5 1
0 0.5
0
-0.5
-0.5
Fy -1 -1 Fx
Exercises with Matlab
1. Build a Park-McClellan filter of your own; show its
pass band and stop band; apply it to filter an image.
2. Build a trapezoid filter with pass band (normalized)
0.1 and stop band at 0.3, in between is the “slant”
face.
Homework 5b.1
5b.1.1 Build a McClellan-Park filter of your own; show its
pass band and stop band; apply it to filter an image.
5b.1.2. Build a trapezoid filter with pass band (normalized)
0.1 and stop band at 0.3, in between is the “slant” face.
End of Chapter

You might also like