0% found this document useful (0 votes)
18 views113 pages

Buku Gonzales-Halaman

This document discusses filtering in the frequency domain, starting with the historical context of the Fourier transform and its significance in image processing. It covers fundamental concepts such as function sampling, aliasing, and the computational advantages of frequency-domain filtering compared to spatial filtering, particularly through the use of the fast Fourier transform (FFT). The chapter aims to equip readers with an understanding of frequency domain filtering techniques and their applications in image enhancement and processing.

Uploaded by

Salsa Bila
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)
18 views113 pages

Buku Gonzales-Halaman

This document discusses filtering in the frequency domain, starting with the historical context of the Fourier transform and its significance in image processing. It covers fundamental concepts such as function sampling, aliasing, and the computational advantages of frequency-domain filtering compared to spatial filtering, particularly through the use of the fast Fourier transform (FFT). The chapter aims to equip readers with an understanding of frequency domain filtering techniques and their applications in image enhancement and processing.

Uploaded by

Salsa Bila
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/ 113

4

Filtering in the Frequency


Domain
Filter: A device or material for suppressing or minimizing waves or
oscillations of certain frequencies.
Frequency: The number of times that a periodic function repeats
the same sequence of values during a unit variation of the
independent variable.
Webster’s New Collegiate Dictionary

Preview
After a brief historical introduction to the Fourier transform and its importance in image processing, we
start from basic principles of function sampling, and proceed step-by-step to derive the one- and two-
dimensional discrete Fourier transforms. Together with convolution, the Fourier transform is a staple of
frequency-domain processing. During this development, we also touch upon several important aspects
of sampling, such as aliasing, whose treatment requires an understanding of the frequency domain and
thus are best covered in this chapter. This material is followed by a formulation of filtering in the fre-
quency domain, paralleling the spatial filtering techniques discussed in Chapter 3. We conclude the
chapter with a derivation of the equations underlying the fast Fourier transform (FFT), and discuss its
computational advantages. These advantages make frequency-domain filtering practical and, in many
instances, superior to filtering in the spatial domain.

Upon completion of this chapter, readers should:


Understand the meaning of frequency domain Understand why image padding is important.
filtering, and how it differs from filtering in the Know the steps required to perform filtering
spatial domain. in the frequency domain.
Be familiar with the concepts of sampling, func- Understand when frequency domain filtering
tion reconstruction, and aliasing. is superior to filtering in the spatial domain.
Understand convolution in the frequency Be familiar with other filtering techniques in
domain, and how it is related to filtering. the frequency domain, such as unsharp mask-
Know how to obtain frequency domain filter ing and homomorphic filtering.
functions from spatial kernels, and vice versa. Understand the origin and mechanics of the
Be able to construct filter transfer functions fast Fourier transform, and how to use it effec-
directly in the frequency domain. tively in image processing.

203

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 203 6/16/2017 2:04:18 PM


204 Chapter 4 Filtering in the Frequency Domain

4.1 BACKGROUND
4.1

We begin the discussion with a brief outline of the origins of the Fourier transform
and its impact on countless branches of mathematics, science, and engineering.

A BRIEF HISTORY OF THE FOURIER SERIES AND TRANSFORM


The French mathematician Jean Baptiste Joseph Fourier was born in 1768 in the
town of Auxerre, about midway between Paris and Dijon. The contribution for
which he is most remembered was outlined in a memoir in 1807, and later pub-
lished in 1822 in his book, La Théorie Analitique de la Chaleur (The Analytic Theory
of Heat). This book was translated into English 55 years later by Freeman (see
Freeman [1878]). Basically, Fourier’s contribution in this field states that any peri-
odic function can be expressed as the sum of sines and/or cosines of different fre-
quencies, each multiplied by a different coefficient (we now call this sum a Fourier
series). It does not matter how complicated the function is; if it is periodic and satis-
fies some mild mathematical conditions, it can be represented by such a sum. This
is taken for granted now but, at the time it first appeared, the concept that compli-
cated functions could be represented as a sum of simple sines and cosines was not
at all intuitive (see Fig. 4.1). Thus, it is not surprising that Fourier’s ideas were met
initially with skepticism.
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 formulation in this case is the Fourier transform, and its utility is even greater
than the Fourier series in many theoretical and applied disciplines. Both representa-
tions share the important characteristic that a function, expressed in either a Fourier
series or transform, can be reconstructed (recovered) completely via an inverse pro-
cess, with no loss of information. This is one of the most important characteristics of
these representations because it allows us to work in the Fourier domain (generally
called the frequency domain) and then return to the original domain of the function
without losing any information. Ultimately, it is the utility of the Fourier series and
transform in solving practical problems that makes them widely studied and used as
fundamental tools.
The initial application of Fourier’s ideas was in the field of heat diffusion, where
they allowed formulation of differential equations representing heat flow in such
a way that solutions could be obtained for the first time. During the past century,
and especially in the past 60 years, entire industries and academic disciplines have
flourished as a result of Fourier’s initial ideas. The advent of digital computers and
the “discovery” of a fast Fourier transform (FFT) algorithm in the early 1960s revo-
lutionized the field of signal processing. These two core technologies allowed for the
first time practical processing of a host of signals of exceptional importance, ranging
from medical monitors and scanners to modern electronic communications.
As you learned in Section 3.4, it takes on the order of MNmn operations (multi-
plications and additions) to filter an M × N image with a kernel of size m × n ele-
ments. If the kernel is separable, the number of operations is reduced to MN (m + n).
In Section 4.11, you will learn that it takes on the order of 2 MN log 2 MN operations
to perform the equivalent filtering process in the frequency domain, where the 2 in
front arises from the fact that we have to compute a forward and an inverse FFT.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 204 6/16/2017 2:04:18 PM


4.1 Background 205

FIGURE 4.1
The function at
the bottom is the
sum of the four
functions above it.
Fourier’s idea in
1807 that periodic
functions could be
represented as a
weighted sum of
sines and cosines
was met with
skepticism.

To get an idea of the relative computational advantages of filtering in the frequency


versus the spatial domain, consider square images and kernels, of sizes M × M and
m × m, respectively. The computational advantage (as a function of kernel size) of
filtering one such image with the FFT as opposed to using a nonseparable kernel is
defined as

M 2 m2
Cn (m) =
2 M 2 log 2 M 2
(4-1)
m2
=
4 log 2 M
If the kernel is separable, the advantage becomes

2M 2 m
Cs (m) =
2 M 2 log 2 M 2
(4-2)
m
=
2 log 2 M

In either case, when C(m) > 1 the advantage (in terms of fewer computations)
belongs to the FFT approach; otherwise the advantage favors spatial filtering.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 205 6/16/2017 2:04:18 PM


206 Chapter 4 Filtering in the Frequency Domain

a b 25 5
m Cn(m) m Cs(m)
FIGURE 4.2
(a) Computational 3 0.2 4 3 0.1
20
advantage of the 7 1.1 7 0.3
FFT over non-

3
11 2.8 11 0.5

Cn(m)  10

Cs(m)  10
separable spatial 15 3
15 5.1 15 0.7
kernels. 21 10.0 21 0.9
(b) Advantage over 10 27 16.6 2 27 1.2
separable kernels.
101 232 101 4.6
The numbers for
C(m) in the inset 5 201 918 1 201 9.1
tables are not to be M = 2048 M = 2048
multiplied by the
factors of 10 shown 3 255 511 767 1023 3 255 511 767 1023
for the curves. m m

The computational
Figure 4.2(a) shows a plot of Cn (m) as a function of m for an image of intermedi-
advantages given by Eqs. ate size (M = 2048). The inset table shows a more detailed look for smaller kernel
(4-1) and (4-2) do not
take into account the fact
sizes. As you can see, the FFT has the advantage for kernels of sizes 7 × 7 and larger.
that the FFT performs The advantage grows rapidly as a function of m, being over 200 for m = 101, and
operations between
complex numbers, and
close to 1000 for m = 201. To give you a feel for the meaning of this advantage, if
other secondary (but filtering a bank of images of size 2048 × 2048 takes 1 minute with the FFT, it would
small in comparison) take on the order of 17 hours to filter the same set of images with a nonseparable
computations discussed
later in the chapter. Thus, kernel of size 201 × 201 elements. This is a significant difference, and is a clear indica-
comparisons should be tor of the importance of frequency-domain processing using the FFT.
interpreted only as
guidelines, In the case of separable kernels, the computational advantage is not as dramatic,
but it is still meaningful. The “cross over” point now is around m = 27, and when
m = 101 the difference between frequency- and spatial-domain filtering is still man-
ageable. However, you can see that with m = 201 the advantage of using the FFT
approaches a factor of 10, which begins to be significant. Note in both graphs that
the FFT is an overwhelming favorite for large spatial kernels.
Our focus in the sections that follow is on the Fourier transform and its properties.
As we progress through this chapter, it will become evident that Fourier techniques
are useful in a broad range of image processing applications. We conclude the chap-
ter with a discussion of the FFT.

ABOUT THE EXAMPLES IN THIS CHAPTER


As in Chapter 3, most of the image filtering examples in this chapter deal with image
enhancement. For example, smoothing and sharpening are traditionally associated
with image enhancement, as are techniques for contrast manipulation. By its very
nature, beginners in digital image processing find enhancement to be interesting
and relatively simple to understand. Therefore, using examples from image enhance-
ment in this chapter not only saves having an extra chapter in the book but, more
importantly, is an effective tool for introducing newcomers to filtering techniques in
the frequency domain. We will use frequency domain processing methods for other
applications in Chapters 5, 7, 8, 10, and 11.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 206 6/16/2017 2:04:19 PM


4.2 Preliminary Concepts 207

4.2 PRELIMINARY CONCEPTS


4.2

We pause briefly to introduce several of the basic concepts that underlie the mate-
rial in later sections.

COMPLEX NUMBERS
A complex number, C, is defined as
C = R + jI (4-3)
where R and I are real numbers and j = −1. Here, R denotes the real part of the
complex number and I its imaginary part. Real numbers are a subset of complex
numbers in which I = 0. The conjugate of a complex number C, denoted C * , is
defined as
C * = R − jI (4-4)
Complex numbers can be viewed geometrically as points on a plane (called the com-
plex plane) whose abscissa is the real axis (values of R) and whose ordinate is the
imaginary axis (values of I). That is, the complex number R + jI is point (R, I ) in the
coordinate system of the complex plane.
Sometimes it is useful to represent complex numbers in polar coordinates,

C = C (cos u + j sin u) (4-5)

where C = R 2 + I 2 is the length of the vector extending from the origin of the
complex plane to point (R, I ), and u is the angle between the vector and the real axis.
Drawing a diagram of the real and complex axes with the vector in the first quadrant
will show that tan u = ( I R) or u = arctan( I R). The arctan function returns angles
in the range [ − p 2 , p 2]. But, because I and R can be positive and negative inde-
pendently, we need to be able to obtain angles in the full range [ −p, p]. We do this
by keeping track of the sign of I and R when computing u. Many programming
languages do this automatically via so called four-quadrant arctangent functions. For
example, MATLAB provides the function atan2(Imag, Real) for this purpose.
Using Euler’s formula,

e ju = cos u + j sin u (4-6)

where e = 2.71828 ..., gives the following familiar representation of complex num-
bers in polar coordinates,

C = C e ju (4-7)

where C and u are as defined above. For example, the polar representation of the
complex number 1 + j 2 is 5e ju , where u = 63.4° or 1.1 radians. The preceding equa-
tions are applicable also to complex functions. A complex function, F(u), of a real
variable u, can be expressed as the sum F (u) = R(u) + jI (u), where R(u) and I (u) are
the real and imaginary component functions of F (u). As previously noted, the com-
12
plex conjugate is F * (u) = R(u) − jI (u), the magnitude is F (u) = [ R(u)2 + I (u)2 ] ,

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 207 6/16/2017 2:04:22 PM


208 Chapter 4 Filtering in the Frequency Domain

and the angle is u(u) = arctan[ I (u) R(u)]. We will return to complex functions sev-
eral times in the course of this and the next chapter.

FOURIER SERIES
As indicated in the previous section, a function f (t ) of a continuous variable, t,
that is periodic with a period, T, can be expressed as the sum of sines and cosines
multiplied by appropriate coefficients. This sum, known as a Fourier series, has the
form
 j
2pn
t
f (t ) = ∑ cn e
n = −
T (4-8)

where
T 2 2 pn
1 −j t
cn = f (t ) e T dt for n = 0, ± 1, ± 2, . . . (4-9)
T 2−T 2
are the coefficients. The fact that Eq. (4-8) is an expansion of sines and cosines fol-
lows from Euler’s formula, Eq. (4-6).

IMPULSES AND THEIR SIFTING PROPERTIES


Central to the study of linear systems and the Fourier transform is the concept of an
impulse and its sifting property. A unit impulse of a continuous variable t, located at
An impulse is not a
t = 0, and denoted d(t ), is defined as
function in the usual
sense. A more accurate ⎧ if t = 0
name is a distribution d(t ) = ⎨ (4-10)
or generalized function. ⎩0 if t ≠ 0
However, one often
finds in the literature the and is constrained to satisfy the identity
names impulse function,
delta function, and Dirac 
delta function, despite the
d(t ) dt = 1 (4-11)
misnomer.
2- 
Physically, if we interpret t as time, an impulse may be viewed as a spike of infinity
amplitude and zero duration, having unit area. An impulse has the so-called sifting
property with respect to integration,
To sift means literally to
separate, or to separate 
out, by putting something
f (t ) d(t ) dt = f (0) (4-12)
2-
through a sieve.

provided that f (t ) is continuous at t = 0, a condition typically satisfied in practice.


Sifting simply yields the value of the function f (t ) at the location of the impulse (i.e.,
at t = 0 in the previous equation). A more general statement of the sifting property
involves an impulse located at an arbitrary point, t0 , denoted as, d(t − t0 ). In this case,

f (t ) d(t − t0 ) dt = f (t0 ) (4-13)
2- 

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 208 6/16/2017 2:04:23 PM


4.2 Preliminary Concepts 209

which simply gives the value of the function at the location of the impulse. For
example, if f (t ) = cos(t ), using the impulse d(t − p) in Eq. (4-13) yields the result
f (p) = cos(p) = −1. The power of the sifting concept will become evident shortly.
Of particular interest later in this section is an impulse train, sT (t ), defined as the
sum of infinitely many impulses T units apart:

sT (t ) = ∑ d(t − kT )
k = −
(4-14)

Figure 4.3(a) shows a single impulse located at t = t0 , and Fig. 4.3(b) shows an
impulse train. Impulses for continuous variables are denoted by up-pointing arrows
to simulate infinite height and zero width. For discrete variables the height is finite,
as we will show next.
Let x represent a discrete variable. As you learned in Chapter 3, the unit discrete
impulse, d( x), serves the same purposes in the context of discrete systems as the
impulse d(t ) does when working with continuous variables. It is defined as

⎧1 if x = 0
d( x) = ⎨ (4-15)
⎩0 if x ≠ 0
Clearly, this definition satisfies the discrete equivalent of Eq. (4-11):

∑ d( x) = 1
x = −
(4-16)

The sifting property for discrete variables has the form




x = −
f ( x) d( x) = f (0) (4-17)

a b d(t) sT (t)


c d
d(t  t0)
FIGURE 4.3
(a) Continuous
impulse located ... ...
at t = t0 . (b) An
impulse train
consisting of t t
0 t0 . . . 3T 2T T 0 T 2T 3T . . .
continuous
impulses. (c) Unit
d(x) sX(x)
discrete impulse
located at x = x0 . d(x  x0)
(d) An impulse 1
1
train consisting
of discrete unit
... ...
impulses.

x x
0 x0 . . . 3X 2X X 0 X 2X 3X . . .

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 209 6/16/2017 2:04:25 PM


210 Chapter 4 Filtering in the Frequency Domain

or, more generally using a discrete impulse located at x = x0 (see Eq. 3-33),

∑ f ( x) d( x − x0 ) = f ( x0 )
x = −
(4-18)

As before, we see that the sifting property yields the value of the function at the
location of the impulse. Figure 4.3(c) shows the unit discrete impulse diagrammati-
cally, and Fig. 4.3(d) shows a train of discrete unit impulses, Unlike its continuous
counterpart, the discrete impulse is an ordinary function.

THE FOURIER TRANSFORM OF FUNCTIONS OF ONE CONTINUOUS


VARIABLE
The Fourier transform of a continuous function f (t ) of a continuous variable, t,
denoted ᑣ { f (t )} , is defined by the equation

ᑣ { f (t )} = f (t ) e − j 2pmt dt (4-19)
2-
where m is a continuous variable also.† Because t is integrated out, ᑣ { f (t )} is a func-
tion only of m. That is ᑣ { f (t )} = F (m); therefore, we write the Fourier transform of
f (t ) as

F (m) = f (t ) e − j 2 pmt dt
2- (4-20)

Conversely, given F(m), we can obtain f (t ) back using the inverse Fourier transform,
written as
Equation (4-21) indicates
the important fact men- 
tioned in Section 4.1 that f (t ) = F (m) e j 2 pmt dm (4-21)
a function can be recov-
ered from its transform. 2-
where we made use of the fact that variable m is integrated out in the inverse
transform and wrote simply f (t ), rather than the more cumbersome notation
f (t ) = ᑣ−1 {F (m)} . Equations (4-20) and (4-21) comprise the so-called Fourier
transform pair, often denoted as f (t ) ⇔ F (m). The double arrow indicates that the
expression on the right is obtained by taking the forward Fourier transform of the
expression on the left, while the expression on the left is obtained by taking the
inverse Fourier transform of the expression on the right.
Using Euler’s formula, we can write Eq. (4-20) as
Because t is integrated
out in this equation, the

only variable left is m, F (m) = f (t )[ cos(2pmt ) − j sin(2pmt )] dt (4-22)
which is the frequency of
the sine and cosine terms.
2-

Conditions for the existence of the Fourier transform are complicated to state in general (Champeney [1987]),
but a sufficient condition for its existence is that the integral of the absolute value of f (t ), or the integral of the
square of f (t ), be finite. Existence is seldom an issue in practice, except for idealized signals, such as sinusoids
that extend forever. These are handled using generalized impulses. Our primary interest is in the discrete Fourier
transform pair which, as you will see shortly, is guaranteed to exist for all finite functions.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 210 6/16/2017 2:04:26 PM


4.2 Preliminary Concepts 211

If f (t ) is real, we see that its transform in general is complex. Note that the Fourier
transform is an expansion of f (t ) multiplied by sinusoidal terms whose frequencies
are determined by the values of m. Thus, because the only variable left after integra-
tion is frequency, we say that the domain of the Fourier transform is the frequency
domain. We will discuss the frequency domain and its properties in more detail later
in this chapter. In our discussion, t can represent any continuous variable, and the
units of the frequency variable m depend on the units of t. For example, if t repre-
sents time in seconds, the units of m are cycles/sec or Hertz (Hz). If t represents
distance in meters, then the units of m are cycles/meter, and so on. In other words,
the units of the frequency domain are cycles per unit of the independent variable of
the input function.

EXAMPLE 4.1 : Obtaining the Fourier transform of a simple continuous function.


The Fourier transform of the function in Fig. 4.4(a) follows from Eq. (4-20):
 W 2
F (m) = f (t ) e − j 2 pmt dt = Ae − j 2 pmt dt
2- 2−W 2
−A W 2 −A
= ⎡e − j 2 pmt ⎤ = ⎡e − jpmW − e jpmW ⎤
j 2pm ⎣ ⎦ − W 2 j 2pm ⎣ ⎦
A
= ⎡e jpmW − e − jpmW ⎤
j 2pm ⎣ ⎦
sin(pmW )
= AW
(pmW )

f (t) F ( m) F ( m)

AW AW

1/W 1/W
t m m
W/ 2 0 W/ 2 0 . . . 2/W 0
. . . 2/W 2/W . . . 2/W . . .
1/W 1/W

a b c
FIGURE 4.4 (a) A box function, (b) its Fourier transform, and (c) its spectrum. All functions extend to infinity in both
directions. Note the inverse relationship between the width, W, of the function and the zeros of the transform.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 211 6/16/2017 2:04:27 PM


212 Chapter 4 Filtering in the Frequency Domain

where we used the trigonometric identity sin u = (e ju − e − ju ) 2 j. In this case, the complex terms of the
Fourier transform combined nicely into a real sine function. The result in the last step of the preceding
expression is known as the sinc function, which has the general form

sin(pm)
sinc(m) = (4-23)
(pm)
where sinc(0) = 1 and sinc(m) = 0 for all other integer values of m. Figure 4.4(b) shows a plot of F(m).
In general, the Fourier transform contains complex terms, and it is customary for display purposes to
work with the magnitude of the transform (a real quantity), which is called the Fourier spectrum or the
frequency spectrum:
sin(pmW )
F (m) = AW
(pmW )

Figure 4.4(c) shows a plot of F(m) as a function of frequency. The key properties to note are (1) that
the locations of the zeros of both F(m) and F(m) are inversely proportional to the width,W, of the “box”
function; (2) that the height of the lobes decreases as a function of distance from the origin; and (3) that
the function extends to infinity for both positive and negative values of m. As you will see later, these
properties are quite helpful in interpreting the spectra of two dimensional Fourier transforms of images.

EXAMPLE 4.2 : Fourier transform of an impulse and an impulse train.


The Fourier transform of a unit impulse located at the origin follows from Eq. (4-20):
 
ᑣ {d(t )} = F (m) = d(t ) e − j 2 pmt dt = e − j 2 pmt d(t ) dt = e − j 2 pm
2- 2-
where we used the sifting property from Eq. (4-12). Thus, we see that the Fourier transform of an
impulse located at the origin of the spatial domain is a constant in the frequency domain (we discussed
this briefly in Section 3.4 in connection with Fig. 3.30).
Similarly, the Fourier transform of an impulse located at t = t0 is
 
ᑣ {d(t − t0 )} = F (m) = d(t − t0 ) e − j 2 pmt dt = e − j 2 pmt d(t − t0 ) dt = e − j 2 pmt0
2- 2-
where we used the sifting property from Eq. (4-13). The term e − j 2 pmt0 represents a unit circle centered on
the origin of the complex plane, as you can easily see by using Euler’s formula to expand the exponential
into its sine and cosine components.
In Section 4.3, we will use the Fourier transform of a periodic impulse train. Obtaining this transform
is not as straightforward as we just showed for individual impulses. However, understanding how to
derive the transform of an impulse train is important, so we take the time to derive it here. We start by
noting that the only basic difference in the form of Eqs. (4-20) and (4-21) is the sign of the exponential.
Thus, if a function f (t ) has the Fourier transform F(m), then evaluating this function at t, F (t ), must
have the transform f (−m). Using this symmetry property and given, as we showed above, that the Fou-
rier transform of an impulse d(t − t0 ) is e − j 2 pmt0 , it follows that the function e − j 2 pmt0 has the transform

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 212 6/16/2017 2:04:29 PM


4.2 Preliminary Concepts 213

d(− m − t0 ). By letting −t0 = a, it follows that the transform of e j 2pat is d(− m + a) = d(m − a), where the last
step is true because d is zero unless m = a, which is the same condition for either d(− m + a) or d(m − a).
The impulse train sT (t ) in Eq. (4-14) is periodic with period T, so it can be expressed as a Fourier
series:
 j
2pn
t
sT (t ) = ∑
n = −
cn e T

where
T 2 2 pn
1 −j t
cn = sT (t ) e T dt
T 2−T 2
With reference to Fig. 4.3(b), we see that the integral in the interval [ −T 2 , T 2] encompasses only
the impulse located at the origin. Therefore, the preceding equation becomes
T 2 2 pn
1 −j t 1 0 1
cn = d(t ) e T dt = e =
T 2−T 2 T T

where we used the sifting property of d(t ). The Fourier series then becomes
 2pn
1 j t
sT (t ) =
T
∑e
n = −
T

Our objective is to obtain the Fourier transform of this expression. Because summation is a linear pro-
cess, obtaining the Fourier transform of a sum is the same as obtaining the sum of the transforms of the
individual components of the sum. These components are exponentials, and we established earlier in
this example that
2pn n
ᑣUe j T t V = d Qm − R
T

So, S(m), the Fourier transform of the periodic impulse train, is


  
1 2 pn 1 2 pn 1 n
S(m) = ᑣ {sT (t )} = ᑣ U ∑ e j T t V = ᑣ U ∑ e j T t V = ∑ d Qm − T R
T n = − T n = − T n = −

This fundamental result tells us that the Fourier transform of an impulse train with period T is also
an impulse train, whose period is 1 T . This inverse proportionality between the periods of sT (t ) and
S(m) is analogous to what we found in Fig. 4.4 in connection with a box function and its transform. This
inverse relationship plays a fundamental role in the remainder of this chapter.

As in Section 3.4, the CONVOLUTION


fact that convolution of a
function with an impulse We showed in Section 3.4 that convolution of two functions involves flipping (rotat-
shifts the origin of the
function to the location of ing by 180°) one function about its origin and sliding it past the other. At each dis-
the impulse is also true for placement in the sliding process, we perform a computation, which, for discrete
continuous convolution.
(See Figs. 3.29 and 3.30.) variables, is a sum of products [see Eq. (3-35)]. In the present discussion, we are

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 213 6/16/2017 2:04:31 PM


214 Chapter 4 Filtering in the Frequency Domain

interested in the convolution of two continuous functions, f (t ) and h(t ), of one con-
tinuous variable, t, so we have to use integration instead of a summation. The con-
volution of these two functions, denoted as before by the operator 夹, is defined as

( f 夹 h)(t ) = f (t) h(t − t) dt (4-24)
2-
where the minus sign accounts for the flipping just mentioned, t is the displacement
needed to slide one function past the other, and t is a dummy variable that is inte-
grated out. We assume for now that the functions extend from − to .
We illustrated the basic mechanics of convolution in Section 3.4, and we will do
so again later in this chapter and in Chapter 5. At the moment, we are interested in
finding the Fourier transform of Eq. (4-24). We start with Eq. (4-19):

 ⎡  ⎤
ᑣ {( f 夹 h)(t )} = ⎢ f (t) h(t − t) dt ⎥ e − j 2 pmt dt
2- ⎢⎣ 2- ⎥⎦
 ⎡  ⎤
= f (t) ⎢ h(t − t) e − j 2 pmt dt ⎥ dt
2- ⎢⎣ 2
- ⎥⎦

The term inside the brackets is the Fourier transform of h(t − t). We will show later
in this chapter that ᑣ {h(t − t)} = H (m) e − j 2 pmt , where H(m) is the Fourier transform
of h(t ). Using this in the preceding equation gives us

ᑣ {( f 夹 h)(t )} = f (t) ⎡⎣ H (m) e − j 2 pmt ⎤⎦ dt
Remember, convolution
2- 
is commutative, so the 
order of the functions in
= H (m) f (t) e − j 2 pmt dt
convolution expressions
does not matter. 2- 
= H (m)F (m)
= (H i F )(m)

where “ i ” indicates multiplication. As noted earlier, if we refer to the domain of t


as the spatial domain, and the domain of m as the frequency domain, the preceding
equation tells us that the Fourier transform of the convolution of two functions in
the spatial domain is equal to the product in the frequency domain of the Fourier
transforms of the two functions. Conversely, if we have the product of the two trans-
forms, we can obtain the convolution in the spatial domain by computing the inverse
Fourier transform. In other words, f 夹 h and H i F are a Fourier transform pair. This
result is one-half of the convolution theorem and is written as

( f 夹 h)(t ) ⇔ (H i F )(m) (4-25)

As noted earlier, the double arrow indicates that the expression on the right is
obtained by taking the forward Fourier transform of the expression on the left, while

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 214 6/16/2017 2:04:32 PM


4.3 Sampling and the Fourier Transform of Sampled Functions 215

the expression on the left is obtained by taking the inverse Fourier transform of the
expression on the right.
These two expressions Following a similar development would result in the other half of the convolution
also hold for discrete
variables, with the theorem:
exception that the right
side of Eq. (4-26) is ( f i h)(t ) ⇔ (H 夹 F )(m) (4-26)
multiplied by (1/M),
where M is the number
of discrete samples (see
which states that convolution in the frequency domain is analogous to multiplica-
Problem 4.18). tion in the spatial domain, the two being related by the forward and inverse Fourier
transforms, respectively. As you will see later in this chapter, the convolution theo-
rem is the foundation for filtering in the frequency domain.

4.3 SAMPLING AND THE FOURIER TRANSFORM OF SAMPLED


4.3
FUNCTIONS
In this section, we use the concepts from Section 4.2 to formulate a basis for express-
ing sampling mathematically. Starting from basic principles, this will lead us to the
Fourier transform of sampled functions. That is, the discrete Fourier transform.

SAMPLING
Continuous functions have to be converted into a sequence of discrete values before
they can be processed in a computer. This requires sampling and quantization, as
introduced in Section 2.4. In the following discussion, we examine sampling in more
detail.
Consider a continuous function, f (t ), that we wish to sample at uniform intervals,
T, of the independent variable t (see Fig. 4.5). We assume initially that the function
extends from − to  with respect to t. One way to model sampling is to multiply
f (t ) by a sampling function equal to a train of impulses T units apart. That is,
Taking samples ΔΤ units
apart implies a sampling
rate equal to 1/ΔΤ. If the

units of ΔΤ are seconds,
then the sampling rate is f (t ) = f (t )sT (t ) = ∑ f (t ) d(t − nT ) (4-27)
in samples/s. If the units n = −
of ΔΤ are meters, then
the sampling rate is in
samples/m, and so on. where f (t ) denotes the sampled function. Each component of this summation is an
impulse weighted by the value of f (t ) at the location of the impulse, as Fig. 4.5(c)
shows. The value of each sample is given by the “strength” of the weighted impulse,
which we obtain by integration. That is, the value, fk , of an arbitrary sample in the
sampled sequence is given by

fk = f (t ) d(t − kT ) dt
2- (4-28)
= f (kT )

where we used the sifting property of d in Eq. (4-13). Equation (4-28) holds for any
integer value k = . . . , − 2, − 1, 0, 1, 2, . . . . Figure 4.5(d) shows the result, which con-
sists of equally spaced samples of the original function.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 215 6/16/2017 2:04:33 PM


216 Chapter 4 Filtering in the Frequency Domain

a f (t)
b
c
d
FIGURE 4.5 ...
...
(a) A continuous
function. (b) Train t
of impulses used to 0
model sampling. sT (t)
(c) Sampled
function formed as
the product of (a)
and (b). (d) Sample
values obtained by
... ...
integration and t
using the sifting . . . 2T T 0 T 2T . . .
property of f (t)sT (t)
impulses. (The
dashed line in (c) is
shown for refer-
ence. It is not part ..
of the data.) ..
... ...
. . . 2TT 0 T 2T . . . t

f k  f (kT)

... ...
k
. . . 2 1 0 1 2 ...

THE FOURIER TRANSFORM OF SAMPLED FUNCTIONS


Let F(m) denote the Fourier transform of a continuous function f (t ). As discussed
in the previous section, the corresponding sampled function, f (t ), is the product of
f (t ) and an impulse train. We know from the convolution theorem that the Fourier
transform of the product of two functions in the spatial domain is the convolution
of the transforms of the two functions in the frequency domain. Thus, the Fourier
transform of the sampled function is:

{ }
F (m) = ᑣ f (t ) = ᑣ { f (t )sT (t )}
(4-29)
= (F 夹 S )(m)

where, from Example 4.2,



1 n
S(m) =
T
∑ d Qm − T R
n = −
(4-30)

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 216 6/16/2017 2:04:34 PM


4.3 Sampling and the Fourier Transform of Sampled Functions 217

is the Fourier transform of the impulse train sT (t ). We obtain the convolution of
F(m) and S(m) directly from the 1-D definition of convolution in Eq. (4-24):

F (m) = (F 夹 S )(m) = F (t) S(m − t) dt
2-
 
1 n
= F (t) ∑ d Qm − t − R dt
T 2- n = − T
(4-31)
 
1 n
=
T

n = − 2
F (t) d Qm − t −
T
R dt
-

1  n
= ∑ F Qm − T R
T n = − 

where the final step follows from the sifting property of the impulse, Eq. (4-13).
The summation in the last line of Eq. (4-31) shows that the Fourier transform
 m) of the sampled function f (t ) is an infinite, periodic sequence of copies of the
F(
transform of the original, continuous function. The separation between copies is
determined by the value of 1 T. Observe that although f (t ) is a sampled function,
its transform, F( m), is continuous because it consists of copies of F(m), which is a
continuous function.
Figure 4.6 is a graphical summary of the preceding results.† Figure 4.6(a) is a
sketch of the Fourier transform, F(m), of a function f (t ), and Fig. 4.6(b) shows the
transform, F(  m), of the sampled function, f (t ). As mentioned in the previous sec-
tion, the quantity 1 T is the sampling rate used to generate the sampled function.
So, in Fig. 4.6(b) the sampling rate was high enough to provide sufficient separation
between the periods, and thus preserve the integrity (i.e., perfect copies) of F(m). In
Fig. 4.6(c), the sampling rate was just enough to preserve F(m), but in Fig. 4.6(d), the
sampling rate was below the minimum required to maintain distinct copies of F(m),
and thus failed to preserve the original transform. Figure 4.6(b) is the result of an
over-sampled signal, while Figs. 4.6(c) and (d) are the results of critically sampling
and under-sampling the signal, respectively. These concepts are the basis that will
help you grasp the fundamentals of the sampling theorem, which we discuss next.

THE SAMPLING THEOREM


We introduced the idea of sampling intuitively in Section 2.4. Now we consider sam-
pling formally, and establish the conditions under which a continuous function can
be recovered uniquely from a set of its samples.
A function f (t ) whose Fourier transform is zero for values of frequencies outside
a finite interval (band) [ −mmax , mmax ] about the origin is called a band-limited func-
tion. Figure 4.7(a), which is a magnified section of Fig. 4.6(a), is such a function. Simi-
larly, Fig. 4.7(b) is a more detailed view of the transform of the critically sampled


For the sake of clarity in sketches of Fourier transforms in Fig. 4.6, and other similar figures in this chapter, we
ignore the fact that Fourier transforms typically are complex functions. Our interest here is on concepts.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 217 6/16/2017 2:04:36 PM


218 Chapter 4 Filtering in the Frequency Domain

a F (m)
b
c
d
FIGURE 4.6 ... ...
(a) Illustrative m
sketch of the 0
Fourier transform ~
F (m)
of a band-limited
function.
(b)–(d) Trans-
forms of the
... ...
corresponding
sampled functions m
under the 2/T 1/T 0 1/T 2/T
conditions of ~
F (m)
over-sampling,
critically
sampling, and
under-sampling,
respectively. ... ...
m
2/T 1/T 0 1/T 2/T
~
F (m)

... ...

m
3/T 2/T 1/T 0 1/T 2/T 3/T

function [see Fig. 4.6(c)]. A higher value of T would cause the periods in F(  m) to
merge; a lower value would provide a clean separation between the periods.
We can recover f (t ) from its samples if we can isolate a single copy of F(m) from
the periodic sequence of copies of this function contained in F(  m), the transform of

the sampled function f (t ). Recall from the discussion in the previous section that
 m) is a continuous, periodic function with period 1 T. Therefore, all we need is
F(
one complete period to characterize the entire transform. In other words, we can
recover f (t ) from that single period by taking its inverse Fourier transform.
Extracting from F(  m) a single period that is equal to F(m) is possible if the sepa-
ration between copies is sufficient (see Fig. 4.6). In terms of Fig. 4.7(b), sufficient
separation is guaranteed if 1 2T > mmax or

1
> 2 mmax (4-32)
Remember, the sampling T
rate is the number of
samples taken per unit of
the independent variable. This equation indicates that a continuous, band-limited function can be recovered
completely from a set of its samples if the samples are acquired at a rate exceeding

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 218 6/16/2017 2:04:37 PM


4.3 Sampling and the Fourier Transform of Sampled Functions 219

a F (m)
b
FIGURE 4.7
(a) Illustrative
sketch of the
Fourier
transform of a ... ...
band-limited
function. m
m max 0 m max
(b) Transform ~
resulting from F (m)
critically sampling
that band-limited
function.

... m max m max ...

m
1 0 1 1
––– ––– ––
2T 2T T

twice the highest frequency content of the function. This exceptionally important
result is known as the sampling theorem.† We can say based on this result that no
information is lost if a continuous, band-limited function is represented by samples
acquired at a rate greater than twice the highest frequency content of the function.
Conversely, we can say that the maximum frequency that can be “captured” by sam-
pling a signal at a rate 1 T is mmax = 1 2T . A sampling rate exactly equal to twice
the highest frequency is called the Nyquist rate. Sampling at exactly the Nyquist rate
sometimes is sufficient for perfect function recovery, but there are cases in which
this leads to difficulties, as we will illustrate later in Example 4.3. This is the reason
why the sampling theorem specifies that sampling must exceed the Nyquist rate.
Figure 4.8 illustrates the procedure for recovering F(m) from F( m) when a function
is sampled at a rate higher than the Nyquist rate. The function in Fig. 4.8(b) is defined
by the equation

The ΔΤ in Eq. (4-33) ⎧T − mmax ≤ m ≤ mmax


cancels out the 1/ΔΤ in H (m) = ⎨ (4-33)
Eq. (4-31). ⎩0 otherwise

When multiplied by the periodic sequence in Fig. 4.8(a), this function isolates the
period centered on the origin. Then, as Fig. 4.8(c) shows, we obtain F(m) by multiply-
 m) by H(m) :
ing F(

The sampling theorem is a cornerstone of digital signal processing theory. It was first formulated in 1928 by
Harry Nyquist, a Bell Laboratories scientist and engineer. Claude E. Shannon, also from Bell Labs, proved the
theorem formally in 1949. The renewed interest in the sampling theorem in the late 1940s was motivated by the
emergence of early digital computing systems and modern communications, which created a need for methods
dealing with digital (sampled) data.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 219 6/16/2017 2:04:38 PM


220 Chapter 4 Filtering in the Frequency Domain
~
a F (m)
b
c
FIGURE 4.8 m max m max
(a) Fourier ... ...
transform of a
m
sampled,
2/T 1/T 0 1/T 2/T
band-limited
function.
(b) Ideal lowpass H (m)
filter transfer
function.
(c) The product
of (b) and (a), T
used to extract ... ...
one period of the m
infinitely periodic 0
sequence in (a). ~
F (m)  H (m)F (m)

... ...
m
m max 0 m max

F (m) = H (m)F (m) (4-34)

Once we have F(m), we can recover f (t ) using the inverse Fourier transform:

f (t ) = F (m) e j 2 pmt dm (4-35)
2-
Equations (4-33) through (4-35) prove that, theoretically, it is possible to recover a
band-limited function from samples obtained at a rate exceeding twice the highest
frequency content of the function. As we will discuss in the following section, the
requirement that f (t ) must be band-limited implies in general that f (t ) must extend
from − to , a condition that cannot be met in practice. As you will see shortly,
In Fig. 3.32 we sketched having to limit the duration of a function prevents perfect recovery of the function
the radial cross sections
of filter transfer functions from its samples, except in some special cases.
using only positive fre- Function H(m) is called a lowpass filter because it passes frequencies in the low
quencies, for simplicity.
Now you can see that end of the frequency range, but it eliminates (filters out) higher frequencies. It is
frequency domain filter called also an ideal lowpass filter because of its instantaneous transitions in ampli-
functions encompass
both positive and nega- tude (between 0 and T at location −mmax and the reverse at mmax ), a characteristic
tive frequencies. that cannot be implemented physically in hardware. We can simulate ideal filters
in software, but even then there are limitations (see Section 4.8). Because they are
instrumental in recovering (reconstructing) the original function from its samples,
filters used for the purpose just discussed are also called reconstruction filters.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 220 6/16/2017 2:04:39 PM


4.3 Sampling and the Fourier Transform of Sampled Functions 221

ALIASING
Literally, the word alias means “a false identity.” In the field of signal processing,
aliasing refers to sampling phenomena that cause different signals to become indis-
tinguishable from one another after sampling; or, viewed another way, for one signal
to “masquerade” as another.
Conceptually, the relationship between sampling and aliasing is not difficult to
grasp. The foundation of aliasing phenomena as it relates to sampling is that we
can describe a digitized function only by the values of its samples. This means that
it is possible for two (or more) totally different continuous functions to coincide at
the values of their respective samples, but we would have no way of knowing the
Although we show
characteristics of the functions between those samples. To illustrate, Fig. 4.9 shows
sinusoidal functions for two completely different sine functions sampled at the same rate. As you can see
simplicity, aliasing occurs
between any arbitrary
in Figs. 4.9(a) and (c), there are numerous places where the sampled values are the
signals whose values are same in the two functions, resulting in identical sampled functions, as Figs. 4.9(b)
the same at the sample
points.
and (d) show.
Two continuous functions having the characteristics just described are called an
aliased pair, and such pairs are indistinguishable after sampling. Note that the reason
these functions are aliased is because we used a sampling rate that is too coarse. That
is, the functions were under-sampled. It is intuitively obvious that if sampling were
refined, more and more of the differences between the two continuous functions
would be revealed in the sampled signals. The principal objective of the following
discussion is to answer the question: What is the minimum sampling rate required
to avoid (or reduce) aliasing? This question has both a theoretical and a practical
answer and, in the process of arriving at the answers, we will establish the conditions
under which aliasing occurs.
We can use the tools developed earlier in this section to formally answer the
question we just posed. All we have to do is ask it in a different form: What happens

a b
c d
FIGURE 4.9
The functions in
(a) and (c) are
totally different,
but their digi-
tized versions in
(b) and (d) are
identical. Aliasing
occurs when the
samples of two or
more functions
coincide, but the
functions are dif-
ferent elsewhere.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 221 6/16/2017 2:04:39 PM


222 Chapter 4 Filtering in the Frequency Domain

if a band-limited function is sampled at less than the Nyquist rate (i.e., at less than
twice its highest frequency)? This is precisely the under-sampled situation discussed
earlier in this section and mentioned in the previous paragraph.
Figure 4.10(a) is the same as Fig. 4.6(d); it shows schematically the Fourier trans-
form of an under-sampled, band-limited function. This figure illustrates that the net
effect of lowering the sampling rate below the Nyquist rate is that the periods of the
Fourier transform now overlap, and it becomes impossible to isolate a single period
If we cannot isolate one
of the transform, regardless of the filter used. For instance, using the ideal lowpass
period of the transform, filter in Fig. 4.10(b) would result in a transform that is corrupted by frequencies from
we cannot recover the
signal without aliasing,
adjacent periods, as Fig. 4.10(c) shows. The inverse transform would then yield a
function, fa (t ), different from the original. That is, fa (t ) would be an aliased function
because it would contain frequency components not present in the original. Using
our earlier terminology, fa (t ) would masquerade as a different function. It is pos-
sible for aliased functions to bear no resemblance whatsoever to the functions from
which they originated.
Unfortunately, except in some special cases mentioned below, aliasing is always
present in sampled signals. This is because, even if the original sampled function is
band-limited, infinite frequency components are introduced the moment we limit
the duration of the function, which we always have to do in practice. As an illustra-
tion, suppose that we want to limit the duration of a band-limited function, f (t ), to a
finite interval, say [0, T ]. We can do this by multiplying f (t ) by the function

⎧1 0 ≤ t ≤T
h(t ) = ⎨ (4-36)
⎩0 otherwise

This function has the same basic shape as Fig. 4.4(a), whose Fourier transform, H(m),
has frequency components extending to infinity in both directions, as Fig. 4.4(b) shows.
From the convolution theorem, we know that the transform of the product h(t ) f (t )
is the convolution in the frequency domain of the transforms F(m) and H(m). Even
if F(m) is band-limited, convolving it with H(m) , which involves sliding one function
across the other, will yield a result with frequency components extending to infinity
in both directions (see Problem 4.12). From this we conclude that no function of
finite duration can be band-limited. Conversely, a function that is band-limited must
extend from − to .†
Although aliasing is an inevitable fact of working with sampled records of finite
length, the effects of aliasing can be reduced by smoothing (lowpass filtering) the
input function to attenuate its higher frequencies. This process, called anti-aliasing,
has to be done before the function is sampled because aliasing is a sampling issue
that cannot be “undone after the fact” using computational techniques.

† An important special case is when a function that extends from − to  is band-limited and periodic. In this
case, the function can be truncated and still be band-limited, provided that the truncation encompasses exactly
an integral number of periods. A single truncated period (and thus the function) can be represented by a set of
discrete samples satisfying the sampling theorem, taken over the truncated interval.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 222 6/16/2017 2:04:40 PM


4.3 Sampling and the Fourier Transform of Sampled Functions 223

~
F ( m)

m max m max

... ...

m
3/T 2/T 1/T 0 1/T 2/T 3/T

H (m)

T
... ...
m
0
~
F (m)  H (m) F (m)

... ...
m
m max 0 m max
a
b
c
FIGURE 4.10 (a) Fourier transform of an under-sampled, band-limited function. (Interference between adjacent peri-
ods is shown dashed). (b) The same ideal lowpass filter used in Fig. 4.8. (c) The product of (a) and (b).The interfer-
ence from adjacent periods results in aliasing that prevents perfect recovery of F(m) and, consequently, of f (t ).

EXAMPLE 4.3 : Aliasing.


Figure 4.11 shows a classic illustration of aliasing. A pure sine wave extending infinitely in both direc-
tions has a single frequency so, obviously, it is band-limited. Suppose that the sine wave in the figure
(ignore the large dots for now) has the equation f (t ) = sin(pt ), and that the horizontal axis corresponds
to time, t, in seconds. The function crosses the axis at t = 0, ±1, ± 2, … .
Recall that a function f (t ) is periodic with period P if f (t + P ) = f (t ) for all values of t. The period
is the number (including fractions) of units of the independent variable that it takes for the function
to complete one cycle. The frequency of a periodic function is the number of periods (cycles) that the
function completes in one unit of the independent variable. Thus, the frequency of a periodic function
is the reciprocal of the period. As before, the sampling rate is the number of samples taken per unit of
the independent variable.
In the present example, the independent variable is time, and its units are seconds. The period, P,
of sin(pt ) is 2 s, and its frequency is 1 P , or 1 2 cycles/s. According to the sampling theorem, we can
recover this signal from a set of its samples if the sampling rate exceeds twice the highest frequency
of the signal. This means that a sampling rate greater than 1 sample/s (2 × 1 2 = 1) is required to

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 223 6/16/2017 2:04:41 PM


224 Chapter 4 Filtering in the Frequency Domain

...

... 0 1 2 3 4 5... t

...

T

FIGURE 4.11 Illustration of aliasing. The under-sampled function (dots) looks like a sine wave having a frequency
much lower than the frequency of the continuous signal. The period of the sine wave is 2 s, so the zero crossings of
the horizontal axis occur every second. T is the separation between samples.

recover the signal. Viewed another way, the separation, T, between samples has to be less than 1 s.
Observe that sampling this signal at exactly twice the frequency (1 sample/s), with samples taken at
t = 0, ±1, ± 2, … , results in … sin(−p), sin(0), sin(p) … , all of which are 0. This illustrates the reason
why the sampling theorem requires a sampling rate that exceeds twice the highest frequency of the
function, as mentioned earlier.
The large dots in Fig. 4.11 are samples taken uniformly at a rate below the required 1 sample/s (i.e.,
the samples are taken more than 1 s apart; in fact, the separation between samples exceeds 2 s). The
sampled signal looks like a sine wave, but its frequency is about one-tenth the frequency of the original
function. This sampled signal, having a frequency well below anything present in the original continu-
ous function, is an example of aliasing. If the signal had been sampled at a rate slightly exceeding the
Nyquist rate, the samples would not look like a sine wave at all (see Problem 4.6).
Figure 4.11 also illustrates how aliasing can be extremely problematic in musical recordings by intro-
ducing frequencies not present in the original sound. In order to mitigate this, signals with frequencies
above half the sampling rate must be filtered out to reduce the effect of aliased signals introduced into
digital recordings. This is the reason why digital recording equipment contains lowpass filters specifically
designed to remove frequency components above half the sampling rate used by the equipment.
If we were given just the samples in Fig. 4.11, another issue illustrating the seriousness of aliasing is
that we would have no way of knowing that these samples are not a true representation of the original
function. As you will see later in this chapter, aliasing in images can produce similarly misleading results.

FUNCTION RECONSTRUCTION (RECOVERY) FROM SAMPLED DATA


In this section, we show that reconstructing a function from a set of its samples
reduces in practice to interpolating between the samples. Even the simple act of
displaying an image requires reconstruction of the image from its samples by the dis-
play medium. Therefore, it is important to understand the fundamentals of sampled
data reconstruction. Convolution is central to developing this understanding, dem-
onstrating again the importance of this concept.
The discussion of Fig. 4.8 and Eq. (4-34) outlines the procedure for perfect recov-
ery of a band-limited function from its samples using frequency domain methods.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 224 6/16/2017 2:04:41 PM


4.4 The Discrete Fourier Transform of One Variable 225

Using the convolution theorem, we can obtain the equivalent result in the spatial
domain. From Eq. (4-34), F (m) = H (m)F (m), so it follows that

f (t ) = ᑣ−1 {F (m)}
{
= ᑣ−1 H (m)F (m) } (4-37)
= h(t ) 夹 f (t )

where, as before, f (t ) denotes the sampled function, and the last step follows from
the convolution theorem, Eq. (4-25). It can be shown (see Problem 4.13), that sub-
stituting Eq. (4-27) for f (t ) into Eq. (4-37), and then using Eq. (4-24), leads to the
following spatial domain expression for f (t ):

f (t ) = ∑ f (nT ) sinc [(t − nT ) T ] (4-38)
n = −

where the sinc function is defined in Eq. (4-23). This result is not unexpected because
the inverse Fourier transform of the ideal (box) filter, H(m), is a sinc function (see
Example 4.1). Equation (4-38) shows that the perfectly reconstructed function, f (t ),
is an infinite sum of sinc functions weighted by the sample values. It has the impor-
tant property that the reconstructed function is identically equal to the sample val-
ues at multiple integer increments of T. That is, for any t = kT , where k is an inte-
ger, f (t ) is equal to the kth sample, f (k T ). This follows from Eq. (4-38) because
sinc(0) = 1 and sinc(m) = 0 for any other integer value of m. Between sample points,
See Section 2.4 regard-
values of f (t ) are interpolations formed by the sum of the sinc functions.
ing interpolation. Equation (4-38) requires an infinite number of terms for the interpolations
between samples. In practice, this implies that we have to look for approximations
that are finite interpolations between the samples. As we discussed in Section 2.6, the
principal interpolation approaches used in image processing are nearest-neighbor,
bilinear, and bicubic interpolation. We will discuss the effects of interpolation on
images in Section 4.5.

4.4 THE DISCRETE FOURIER TRANSFORM OF ONE VARIABLE


4.4

One of the principal goals of this chapter is the derivation of the discrete Fourier
transform (DFT) starting from basic principles. The material up to this point may
be viewed as the foundation of those basic principles, so now we have in place the
necessary tools to derive the DFT.

OBTAINING THE DFT FROM THE CONTINUOUS TRANSFORM OF A


SAMPLED FUNCTION
As we discussed in Section 4.3, the Fourier transform of a sampled, band-limited func-
tion extending from − to  is a continuous, periodic function that also extends from
− to . In practice, we work with a finite number of samples, and the objective of
this section is to derive the DFT of such finite sample sets.
Equation (4-31) gives the transform, F(  m), of sampled data in terms of the trans-
 m) in terms
form of the original function, but it does not give us an expression for F(

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 225 6/16/2017 2:04:43 PM


226 Chapter 4 Filtering in the Frequency Domain

of the sampled function f (t ) itself. We find that expression directly from the defini-
tion of the Fourier transform in Eq. (4-19):

F (m) = f (t ) e − j 2 pmt dt (4-39)
2-
By substituting Eq. (4-27) for f (t ), we obtain
  
F (m) = f (t ) e − j 2 pmt dt = ∑ f (t ) d(t − nT ) e − j 2 pmt dt
2- 2- n = −

 
= ∑ f (t ) d(t − nT ) e − j 2 pmt dt (4-40)
n = − 2-

= ∑
n = −
fn e − j 2 pmnT

The last step follows from Eq. (4-28) and the sifting property of the impulse.
 m), is continuous and
Although fn is a discrete function, its Fourier transform, F(
infinitely periodic with period 1 T, as we know from Eq. (4-31). Therefore, all we
need to characterize F( m) is one period, and sampling one period of this function is
the basis for the DFT.
Suppose that we want to obtain M equally spaced samples of F(  m) taken over the
one period interval from m = 0 to m = 1 T (see Fig. 4.8). This is accomplished by
taking the samples at the following frequencies:

m
m= m = 0, 1, 2, … , M − 1 (4-41)
MT

Substituting this result for m into Eq. (4-40) and letting Fm denote the result yields

M −1
Fm = ∑ fn e− j 2pmn M
n=0
m = 0, 1, 2, … , M − 1 (4-42)

This expression is the discrete Fourier transform we are seeking.† Given a set { fm }
consisting of M samples of f (t ), Eq. (4-42) yields a set {Fm } of M complex values
corresponding to the discrete Fourier transform of the input sample set. Conversely,

†  m) covers
Referring back to Fig. 4.6(b), note that the interval [0, 1 T ] over which we sampled one period of F(
two adjacent half periods of the transform (but with the lowest half of period appearing at higher frequencies).
This means that the data in Fm requires re-ordering to obtain samples that are ordered from the lowest to the
highest frequency of the period. This is the price paid for the notational convenience of taking the samples at
m = 0, 1 , 2, … , M − 1, instead of using samples on either side of the origin, which would require the use of nega-
tive notation. The procedure used to order the transform data will be discussed in Section 4.6.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 226 6/16/2017 2:04:45 PM


4.4 The Discrete Fourier Transform of One Variable 227

given {Fm }, we can recover the sample set { fm } by using the inverse discrete Fourier
transform (IDFT)

1 M −1
fn = ∑ Fm e j 2pmn M n = 0, 1, 2, …, M − 1
M m=0
(4-43)

It is not difficult to show (see Problem 4.15) that substituting Eq. (4-43) for fn into
Eq. (4-42) gives the identity Fm ≡ Fm . Similarly, substituting Eq. (4-42) into Eq. (4-43)
for Fm yields fn ≡ fn . This implies that Eqs. (4-42) and (4-43) constitute a discrete
Fourier transform pair. Furthermore, these identities indicate that the forward and
inverse Fourier transforms exist for any set of samples whose values are finite. Note
that neither expression depends explicitly on the sampling interval T, nor on the
frequency intervals of Eq. (4-41). Therefore, the DFT pair is applicable to any finite
set of discrete samples taken uniformly.
We used m and n in the preceding development to denote discrete variables
because it is typical to do so for derivations. However, it is more intuitive, especially
in two dimensions, to use the notation x and y for image coordinate variables and
u and v for frequency variables, where these are understood to be integers.† Then,
Eqs. (4-42) and (4-43) become
M −1
F (u ) = ∑
x=0
f ( x) e − j 2 pux M u = 0, 1, 2, … , M − 1 (4-44)

and

1 M −1
f ( x) = ∑ F (u) e j 2pux M
M u=0
x = 0, 1, 2, … , M − 1 (4-45)

where we used functional notation instead of subscripts for simplicity. Comparing


Eqs. (4-42) through (4-45), you can see that F (u) ≡ Fm and f ( x) ≡ fn . From this point
on, we use Eqs. (4-44) and (4-45) to denote the 1-D DFT pair. As in the continuous
case, we often refer to Eq. (4-44) as the forward DFT of f ( x), and to Eq. (4-45) as
the inverse DFT of F (u). As before, we use the notation f ( x) ⇔ F (u) to denote a
Fourier transform pair. Sometimes you will encounter in the literature the 1 M term
in front of Eq. (4-44) instead. That does not affect the proof that the two equations
form a Fourier transform pair (see Problem 4.15).
Knowledge that f ( x) and F (u) are a transform pair is useful in proving relation-
ships between functions and their transforms. For example, you are asked in Prob-
lem 4.17 to show that f ( x − x0 ) ⇔ F (u) e − j 2 pux0 M is a Fourier transform pair. That is,
you have to show that the DFT of f ( x − x0 ) is F (u) e − j 2 pux0 M and, conversely, that
the inverse DFT of F (u) e − j 2 pux0 M is f ( x − x0 ). Because this is done by substituting


We have been careful in using t for continuous spatial variables and m for the corresponding continuous fre-
quency variables. From this point on, we will use x and u to denote 1-D discrete spatial and frequency variables,
respectively. When working in 2-D, we will use (t , z) , and (m, n), to denote continuous spatial and frequency
domain variables, respectively. Similarly, we will use ( x, y) and (u, v) to denote their discrete counterparts.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 227 6/16/2017 2:04:47 PM


228 Chapter 4 Filtering in the Frequency Domain

directly into Eqs. (4-44) and (4-45), and you will have proved already that these two
equations constitute a Fourier transform pair (Problem 4.15), if you prove that one
side of “⇔” is the DFT (IDFT) of the other, then it must be true the other side is the
IDFT (DFT) of the side you just proved. It turns out that having the option to prove
one side or the other often simplifies proofs significantly. This is true also of the 1-D
continuous and 2-D continuous and discrete Fourier transform pairs.
It can be shown (see Problem 4.16) that both the forward and inverse discrete
transforms are infinitely periodic, with period M. That is,

F (u) = F (u + kM ) (4-46)

and

f ( x) = f ( x + kM ) (4-47)

where k is an integer.
The discrete equivalent of the 1-D convolution in Eq. (4-24) is

M −1
f ( x) 夹 h( x) = ∑ f (m)h( x − m)
m=0
x = 0, 1, 2, … , M − 1 (4-48)

Because in the preceding formulations the functions are periodic, their convolu-
tion also is periodic. Equation (4-48) gives one period of the periodic convolution.
For this reason, this equation often is referred to as circular convolution. This is a
direct result of the periodicity of the DFT and its inverse. This is in contrast with the
convolution you studied in Section 3.4, in which values of the displacement, x, were
determined by the requirement of sliding one function completely past the other,
and were not fixed to the range [0, M − 1] as in circular convolution. We will discuss
this difference and its significance in Section 4.6 and in Fig. 4.27.
Finally, we point out that the convolution theorem given in Eqs. (4-25) and (4-26)
is applicable also to discrete variables, with the exception that the right side of
Eq. (4-26) is multiplied by 1 M (Problem 4.18).

RELATIONSHIP BETWEEN THE SAMPLING AND FREQUENCY


INTERVALS
If f ( x) consists of M samples of a function f (t ) taken T units apart, the length of
the record comprising the set { f ( x)} , x = 0, 1, 2, … , M − 1, is

T = MT (4-49)

The corresponding spacing, u, in the frequency domain follows from Eq. (4-41):

1 1
u = = (4-50)
MT T

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 228 6/16/2017 2:04:48 PM


4.4 The Discrete Fourier Transform of One Variable 229

The entire frequency range spanned by the M components of the DFT is then

1
R = Mu = (4-51)
T
Thus, we see from Eqs. (4-50) and (4-51) that the resolution in frequency, u, of
the DFT depends inversely on the length (duration, if t is time) of the record, T,
over which the continuous function, f (t ), is sampled; and the range of frequencies
spanned by the DFT depends on the sampling interval T. Keep in mind these
inverse relationships between u and T.

EXAMPLE 4.4 : The mechanics of computing the DFT.


Figure 4.12(a) shows four samples of a continuous function, f (t ), taken T units apart. Figure 4.12(b)
shows the samples in the x-domain. The values of x are 0, 1, 2, and 3, which refer to the number of the
samples in sequence, counting up from 0. For example, f (2) = f (t0 + 2T ), the third sample of f (t ).
From Eq. (4-44), the first value of F (u) [i.e., F(0)] is
3
F (0) = ∑ f ( x) = [ f (0) + f (1) + f (2) + f (3)] = 1 + 2 + 4 + 4 = 11
x=0

The next value of F (u) is


3
F (1) = ∑
x=0
f ( x) e − j 2 p(1)x 4 = 1e 0 + 2e − j p 2 + 4e − jp + 4e − j 3p 2 = − 3 + 2 j

Similarly, F (2) = −(1 + 0 j ) and F (3) = −(3 + 2 j ). Observe that all values of f ( x) are used in computing
each value of F (u).
If we were given F (u) instead, and were asked to compute its inverse, we would proceed in the same
manner, but using the inverse Fourier transform. For instance,

1 3 1 3 1 1
f (0) = ∑ F (u) e j 2 pu( 0 ) = ∑ F (u) = [11 − 3 + 2 j − 1 − 3 − 2 j ] = [4] = 1
4 u=0 4 u=0 4 4

which agrees with Fig. 4.12(b). The other values of f ( x) are obtained in a similar manner.

a b f (t) f (x)

FIGURE 4.12 5 5
(a) A continuous
4 4
function sampled
T units apart. 3 3
(b) Samples in the
2 2
x-domain.
Variable t is 1 1
continuous, while 0 t 0 x
x is discrete. 0 t0 t0 T t0 2T t0 3T 0 1 2 3

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 229 6/16/2017 2:04:50 PM


230 Chapter 4 Filtering in the Frequency Domain

4.5 EXTENSIONS TO FUNCTIONS OF TWO VARIABLES


4.5

In the following discussion we extend to two variables the concepts introduced in


the previous sections of this chapter.

THE 2-D IMPULSE AND ITS SIFTING PROPERTY


The impulse, d(t , z), of two continuous variables, t and z, is defined as before:

⎧1 if t = z = 0
d(t , z) = ⎨ (4-52)
⎩0 otherwise

and
 
d(t , z) dtdz = 1 (4-53)
2-  2- 
As in the 1-D case, the 2-D impulse exhibits the sifting property under integration,

 
f (t , z) d(t , z) dtdz = f (0, 0) (4-54)
2- 2-
or. more generally for an impulse located at (t0 , z0 ),
 
f (t , z) d(t − t0 , z − z0 ) dtdz = f (t0 , z0 ) (4-55)
2- 2-
As before, we see that the sifting property yields the value of the function at the
location of the impulse.
For discrete variables x and y, the 2-D discrete unit impulse is defined as

⎧1 if x = y = 0
d( x, y) = ⎨ (4-56)
⎩0 otherwise

and its sifting property is


 
∑ ∑ f ( x, y) d( x, y) = f (0, 0)
x = − y = −
(4-57)

where f ( x, y) is a function of discrete variables x and y. For an impulse located at


coordinates ( x0 , y0 ) (see Fig. 4.13) the sifting property is
 
∑ ∑ f ( x, y) d( x − x0 , y − y0 ) = f ( x0 , y0 )
x = − y = −
(4-58)

When working with an image of finite dimensions, the limits in the two preceding
equations are replaced by the dimensions of the image.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 230 6/16/2017 2:04:51 PM


4.5 Extensions to Functions of Two Variables 231

FIGURE 4.13 d
2-D unit discrete
impulse. Variables
x and y are d (x  x0, y  y0)
discrete, and d is 1
zero everywhere
except at
coordinates
( x0 , y0 ), where its
x0
value is 1. x y0 y

THE 2-D CONTINUOUS FOURIER TRANSFORM PAIR


Let f (t , z) be a continuous function of two continuous variables, t and z. The two-
dimensional, continuous Fourier transform pair is given by the expressions
 
F (m, n) = f (t , z) e − j 2 p( mt + nz) dt dz (4-59)
2- 2-
and
 
f (t , z) = F (m, n) e j 2 p( mt + nz) dm dn (4-60)
2- 2-
where m and n are the frequency variables. When referring to images, t and z are
interpreted to be continuous spatial variables. As in the 1-D case, the domain of the
variables m and n defines the continuous frequency domain.

EXAMPLE 4.5 : Obtaining the Fourier transform of a 2-D box function.


Figure 4.14(a) shows the 2-D equivalent of the 1-D box function in Example 4.1. Following a procedure
similar to the one used in that example gives the result
  T 2 Z2
F (m, n) = f (t , z) e − j 2 p( mt + nz) dt dz = Ae − j 2 p( mt + nz) dt dz
2- 2- 2−T 2 2−Z 2
⎡ sin(pmT ) ⎤ ⎡ sin(pnZ ) ⎤
= ATZ ⎢ ⎥⎢ ⎥
⎣ (pmT ) ⎦ ⎣ (pnZ ) ⎦

Figure 4.14(b) shows a portion of the spectrum about the origin. As in the 1-D case, the locations of the
zeros in the spectrum are inversely proportional to the values of T and Z. In this example, T is larger
than Z, so the spectrum is the more “contracted” along the m-axis.

2-D SAMPLING AND THE 2-D SAMPLING THEOREM


In a manner similar to the 1-D case, sampling in two dimensions can be modeled
using a sampling function (i.e., a 2-D impulse train):

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 231 6/16/2017 2:04:52 PM


232 Chapter 4 Filtering in the Frequency Domain

a b F ( m, n)
f (t, z)
FIGURE 4.14 ATZ
(a) A 2-D function
and (b) a section
of its spectrum. T Z
The box is longer A
along the t-axis,
so the spectrum is
more contracted t T/ 2 Z/ 2 z m n
along the m-axis.

 
sT Z (t , z) = ∑ ∑ d(t − mT , z − nZ)
m = − n = −
(4-61)

where T and Z are the separations between samples along the t- and z-axis of
the continuous function f (t , z). Equation (4-61) describes a set of periodic impulses
extending infinitely along the two axes (see Fig. 4.15). As in the 1-D case illustrated
in Fig. 4.5, multiplying f (t , z) by sT Z (t , z) yields the sampled function.
Function f (t , z) is said to be band limited if its Fourier transform is 0 outside a
rectangle established in the frequency domain by the intervals [ − mmax , mmax ] and
[ − nmax , nmax ]; that is,
F(m, n) = 0 for m ≥ mmax and n ≥ nmax (4-62)

The two-dimensional sampling theorem states that a continuous, band-limited func-


tion f (t , z) can be recovered with no error from a set of its samples if the sampling
intervals are
1
T < (4-63)
2mmax
and
1
Z < (4-64)
2nmax

or, expressed in terms of the sampling rate, if

FIGURE 4.15 sTZ (t, z)


2-D impulse train.

... ...

t z
... Z T ...

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 232 6/16/2017 2:04:57 PM


4.5 Extensions to Functions of Two Variables 233

a b
Footprint of a
FIGURE 4.16 2-D ideal lowpass
Two-dimensional (box) filter
Fourier
transforms of (a) an
over-sampled, and v v
(b) an under-sam-
pled, band-limited
function. m max vmax

m m

1
> 2 mmax (4-65)
T
and
1
> 2nmax (4-66)
Z
Stated another way, we say that no information is lost if a 2-D, band-limited, con-
tinuous function is represented by samples acquired at rates greater than twice the
highest frequency content of the function in both the m- and n-directions.
Figure 4.16 shows the 2-D equivalents of Figs. 4.6(b) and (d). A 2-D ideal fil-
ter transfer function has the form illustrated in Fig. 4.14(a) (but in the frequency
domain). The dashed portion of Fig. 4.16(a) shows the location of the filter function
to achieve the necessary isolation of a single period of the transform for recon-
struction of a band-limited function from its samples, as in Fig. 4.8. From Fig 4.10,
we know that if the function is under-sampled, the periods overlap, and it becomes
impossible to isolate a single period, as Fig. 4.16(b) shows. Aliasing would result
under such conditions.

ALIASING IN IMAGES
In this section, we extend the concept of aliasing to images, and discuss in detail sev-
eral aspects of aliasing related to image sampling and resampling.

Extensions from 1-D Aliasing


As in the 1-D case, a continuous function f (t , z) of two continuous variables, t and z,
can be band-limited in general only if it extends infinitely in both coordinate direc-
tions. The very act of limiting the spatial duration of the function (e.g., by multiply-
ing it by a box function) introduces corrupting frequency components extending to
infinity in the frequency domain, as explained in Section 4.3 (see also Problem 4.12).
Because we cannot sample a function infinitely, aliasing is always present in digital
images, just as it is present in sampled 1-D functions. There are two principal mani-
festations of aliasing in images: spatial aliasing and temporal aliasing. Spatial aliasing
is caused by under-sampling, as discussed in Section 4.3, and tends to be more visible

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 233 6/16/2017 2:04:58 PM


234 Chapter 4 Filtering in the Frequency Domain

(and objectionable) in images with repetitive patterns. Temporal aliasing is related


to time intervals between images of a sequence of dynamic images. One of the most
common examples of temporal aliasing is the “wagon wheel” effect, in which wheels
with spokes in a sequence of images (for example, in a movie) appear to be rotating
backwards. This is caused by the frame rate being too low with respect to the speed
of wheel rotation in the sequence, and is similar to the phenomenon described in
Fig. 4.11, in which under sampling produced a signal that appeared to be of much
lower frequency than the original.
Our focus in this chapter is on spatial aliasing. The key concerns with spatial alias-
ing in images are the introduction of artifacts such as jaggedness in line features, spu-
rious highlights, and the appearance of frequency patterns not present in the original
image. Just as we used Fig. 4.9 to explain aliasing in 1-D functions, we can develop
an intuitive grasp of the nature of aliasing in images using some simple graphics. The
sampling grid in the center section of Fig. 4.17 is a 2-D representation of the impulse
train in Fig. 4.15. In the grid, the little white squares correspond to the location of the
impulses (where the image is sampled) and black represents the separation between
samples. Superimposing the sampling grid on an image is analogous to multiplying
the image by an impulse train, so the same sampling concepts we discussed in con-
nection with the impulse train in Fig. 4.15 are applicable here. The focus now is to
analyze graphically the interaction between sampling rate (the separation of the
sampling points in the grid) and the frequency of the 2-D signals being sampled.
Figure 4.17 shows a sampling grid partially overlapping three 2-D signals (regions
of an image) of low, mid, and high spatial frequencies (relative to the separation
between sampling cells in the grid). Note that the level of spatial “detail” in the
regions is proportional to frequency (i.e., higher-frequency signals contain more
bars). The sections of the regions inside the sampling grip are rough manifestations
of how they would appear after sampling. As expected, all three digitized regions

FIGURE 4.17
Various aliasing
effects resulting
from the
interaction
between the
frequency of 2-D
signals and the
sampling rate
used to digitize
them. The regions
Low frequency High frequency
outside the
sampling grid are
continuous and
free of aliasing.

Sampling grid

Mid frequency

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 234 6/16/2017 2:04:58 PM


4.5 Extensions to Functions of Two Variables 235

exhibit aliasing to some degree, but the effects are dramatically different, worsening
as the discrepancy between detail (frequency) and sampling rate increases. The low-
frequency region is rendered reasonably well, with some mild jaggedness around
the edges. The jaggedness increases as the frequency of the region increases to the
mid-range because the sampling rate is the same. This edge distortion (appropriately
called jaggies) is common in images with strong line and/or edge content.
The digitized high-frequency region in the top right of Fig. 4.17 exhibits totally
different and somewhat surprising behavior. Additional stripes (of lower frequen-
cy) appear in the digitized section, and these stripes are rotated significantly with
respect to the direction of the stripes in the continuous region. These stripes are an
alias of a totally different signal. As the following example shows, this type of behav-
ior can result in images that appear “normal” and yet bear no relation to the original.

EXAMPLE 4.6 : Aliasing in images.


Consider an imaging system that is perfect, in the sense that it is noiseless and produces an exact digi-
tal image of what it sees, but the number of samples it can take is fixed at 96 × 96 pixels. For simplicity,
assume that pixels are little squares of unit width and length. We want to use this system to digitize
checkerboard images of alternating black and white squares. Checkerboard images can be interpreted
as periodic, extending infinitely in both dimensions, where one period is equal to adjacent black/white
pairs. If we specify “valid” digitized images as being those extracted from an infinite sequence in such
a way that the image contains an integer multiple of periods, then, based on our earlier comments, we
know that properly sampled periodic images will be free of aliasing. In the present example, this means
that the sizes of the squares must be such that dividing 96 by the size yields an even number. This will
give an integer number of periods (pairs of black/white squares). The smallest size of squares under the
stated conditions is 1 pixel.
The principal objective of this example is to examine what happens when checkerboard images with
squares of sizes less than 1 pixel on the side are presented to the system. This will correspond to the
undersampled case discussed earlier, which will result in aliasing. A horizontal or vertical scan line of the
checkerboard images results in a 1-D square wave, so we can focus the analysis on 1-D signals.
To understand the capabilities of our imaging system in terms of sampling, recall from the discussion
of the 1-D sampling theorem that, given the sampling rate, the maximum frequency allowed before
aliasing occurs in the sampled signal has to be less than one-half the sampling rate. Our sampling rate is
fixed, at one sample per unit of the independent variable (the units are pixels). Therefore, the maximum
frequency our signal can have in order to avoid aliasing is 1/2 cycle/pixel.
We can arrive at the same conclusion by noting that the most demanding image our system can
handle is when the squares are 1 unit (pixel) wide, in which case the period (cycle) is two pixels. The
frequency is the reciprocal of the period, or 1/2 cycle/pixel, as in the previous paragraph.
Figures 4.18(a) and (b) show the result of sampling checkerboard images whose squares are of sizes
16 × 16 and 6 × 6 pixels, respectively. The frequencies of scan lines in either direction of these two images
are 1/32 and 1/6 cycles/pixel. These are well below the 1/2 cycles/pixel allowed for our system. Because, as
mentioned earlier, the images are perfectly registered in the field of view of the system, the results are free
of aliasing, as expected.
When the size of the squares is reduced to slightly less than one pixel, a severely aliased image results,
as Fig. 4.18(c) shows (the squares used were approximately of size 0.95 × 0.95 pixels). Finally, reducing

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 235 6/16/2017 2:04:58 PM


236 Chapter 4 Filtering in the Frequency Domain

a b
c d
FIGURE 4.18
Aliasing. In (a) and
(b) the squares are
of sizes 16 and 6
pixels on the side.
In (c) and (d) the
squares are of sizes
0.95 and 0.48 pixels,
respectively. Each
small square in (c)
is one pixel. Both
(c) and (d) are
aliased. Note how
(d) masquerades as
a “normal” image.

the size of the squares to slightly less than 0.5 pixels on the side yielded the image in Fig. 4.18(d). In
this case, the aliased result looks like a normal checkerboard pattern. In fact, this image would result
from sampling a checkerboard image whose squares are 12 pixels on the side. This last image is a good
reminder that aliasing can create results that may be visually quite misleading.

The effects of aliasing can be reduced by slightly defocusing the image to be digi-
tized so that high frequencies are attenuated. As explained in Section 4.3, anti-alias-
ing filtering has to be done at the “front-end,” before the image is sampled. There
are no such things as after-the-fact software anti-aliasing filters that can be used to
reduce the effects of aliasing caused by violations of the sampling theorem. Most
commercial digital image manipulation packages do have a feature called “anti-
aliasing.” However, as illustrated in Example 4.8 below, this term is related to blur-
ring a digital image to reduce additional aliasing artifacts caused by resampling. The
term does not apply to reducing aliasing in the original sampled image. A significant
number of commercial digital cameras have true anti-aliasing filtering built in, either
in the lens or on the surface of the sensor itself. Even nature uses this approach to
reduce the effects of aliasing in the human eye, as the following example shows.

EXAMPLE 4.7 : Nature obeys the limits of the sampling theorem.


When discussing Figs. 2.1 and 2.2, we mentioned that cones are the sensors responsible for sharp vision.
Cones are concentrated in the fovea, in line with the visual axis of the lens, and their concentration is
measured in degrees off that axis. A standard test of visual acuity (the ability to resolve fine detail) in
humans is to place a pattern of alternating black and white stripes in one degree of the visual field. If the
total number of stripes exceeds 120 (i.e., a frequency of 60 cycles/degree), experimental evidence shows
that the observer will perceive the image as a single gray mass. That is, the lens in the eye automatically
lowpass filters spatial frequencies higher than 60 cycles/degree. Sampling in the eye is done by the cones,
so, based on the sampling theorem, we would expect the eye to have on the order of 120 cones/degree
in order to avoid the effects of aliasing. As it turns out, that is exactly what we have!

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 236 6/16/2017 2:04:59 PM


4.5 Extensions to Functions of Two Variables 237

Image Resampling and Interpolation


As in the 1-D case, perfect reconstruction of a band-limited image function from a set
of its samples requires 2-D convolution in the spatial domain with a sinc function. As
explained in Section 4.3, this theoretically perfect reconstruction requires interpola-
tion using infinite summations which, in practice, forces us to look for approximate
interpolation methods. One of the most common applications of 2-D interpolation
in image processing is in image resizing (zooming and shrinking). Zooming may
be viewed as over-sampling, while shrinking may be viewed as under-sampling. The
key difference between these two operations and the sampling concepts discussed
in previous sections is that we are applying zooming and shrinking to digital images.
We introduced interpolation in Section 2.4. Our interest there was to illustrate the
performance of nearest neighbor, bilinear, and bicubic interpolation. In this section,
the focus is on sampling and anti-aliasing issues. Aliasing generally is introduced
when an image is scaled, either by zooming or by shrinking. For example, a special
case of nearest neighbor interpolation is zooming by pixel replication, which we use
to increase the size of an image an integer number of times. To double the size of
an image, we duplicate each column. This doubles the image size in the horizontal
direction. Then, we duplicate each row of the enlarged image to double the size in
the vertical direction. The same procedure is used to enlarge the image any integer
number of times. The intensity level assignment of each pixel is predetermined by
the fact that new locations are exact duplicates of old locations. In this crude method
of enlargement, one of the principal aliasing effects is the introduction of jaggies
on straight lines that are not horizontal or vertical. The effects of aliasing in image
enlargement often are reduced significantly by using more sophisticated interpola-
tion, as we discussed in Section 2.4. We show in the following example that aliasing
can also be a serious problem in image shrinking.

EXAMPLE 4.8 : Illustration of aliasing in resampled natural images.


The effects of aliasing generally are worsened when the size of a digital image is reduced. Figure 4.19(a)
is an image containing regions purposely selected to illustrate the effects of aliasing (note the thinly
spaced parallel lines in all garments worn by the subject). There are no objectionable aliasing artifacts
in Fig. 4.19(a), indicating that the sampling rate used initially was sufficient to mitigate visible aliasing.
In Fig. 4.19(b), the image was reduced to 33% of its original size using row/column deletion. The
effects of aliasing are quite visible in this image (see, for example, the areas around scarf and the sub-
ject’s knees). Images (a) and (b) are shown in the same size because the reduced image was brought
back to its original size by pixel replication (the replication did not alter appreciably the effects of alias-
ing just discussed.
The digital “equivalent” of the defocusing of continuous images mentioned earlier for reducing alias-
ing, is to attenuate the high frequencies of a digital image by smoothing it with a lowpass filter before
resampling. Figure 4.19(c) was processed in the same manner as Fig. 4.19(b), but the original image was
smoothed using a 5 × 5 spatial averaging filter (see Section 3.5) before reducing its size. The improve-
ment over Fig. 4.19(b) is evident. The image is slightly more blurred than (a) and (b), but aliasing is no
longer objectionable.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 237 6/16/2017 2:04:59 PM


238 Chapter 4 Filtering in the Frequency Domain

a b c
FIGURE 4.19 Illustration of aliasing on resampled natural images. (a) A digital image of size 772 × 548 pixels with visu-
ally negligible aliasing. (b) Result of resizing the image to 33% of its original size by pixel deletion and then restor-
ing it to its original size by pixel replication. Aliasing is clearly visible. (c) Result of blurring the image in (a) with an
averaging filter prior to resizing. The image is slightly more blurred than (b), but aliasing is not longer objectionable.
(Original image courtesy of the Signal Compression Laboratory, University of California, Santa Barbara.)

The term moiré is a Aliasing and Moiré Patterns


French word (not the
name of a person) that In optics, a moiré pattern is a secondary, visual phenomenon produced, for example,
appears to have
originated with weavers, by superimposing two gratings of approximately equal spacing. These patterns are
who first noticed what
appeared to be interfer-
common, everyday occurrences. For instance, we see them in overlapping insect win-
ence patterns visible on dow screens and on the interference between TV raster lines and striped or high-
some fabrics. The root
of the word is from the
ly textured materials in the background, or worn by individuals. In digital image
word mohair, a cloth processing, moiré-like patterns arise routinely when sampling media print, such as
made from Angora goat
hairs. newspapers and magazines, or in images with periodic components whose spacing
is comparable to the spacing between samples. It is important to note that moiré
patterns are more general than sampling artifacts. For instance, Fig. 4.20 shows the
moiré effect using vector drawings that have not been digitized. Separately, the pat-
terns are clean and void of interference. However, the simple acts of superimposing
one pattern on the other creates a pattern with frequencies not present in either of
the original patterns. Note in particular the moiré effect produced by two patterns
of dots, as this is the effect of interest in the following discussion.

EXAMPLE 4.9 : Sampling printed media.


Newspapers and other printed materials use so called halftone dots, which are black dots or ellipses
whose sizes and various grouping schemes are used to simulate gray tones. As a rule, the following num-
bers are typical: newspapers are printed using 75 halftone dots per inch (dpi), magazines use 133 dpi, and

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 238 6/16/2017 2:04:59 PM


4.5 Extensions to Functions of Two Variables 239

a b c
d e f
FIGURE 4.20
Examples of the
moiré effect.
These are vector
drawings, not
digitized patterns.
Superimposing
one pattern on the
other is analogous
to multiplying the
patterns.

high-quality brochures use 175 dpi. Figure 4.21 shows what happens when a newspaper image is (under)
sampled at 75 dpi. The sampling lattice (which is oriented vertically and horizontally) and dot patterns
on the newspaper image (oriented at ± 45° ) interact to create a uniform moiré-like pattern that makes
the image look blotchy. (We will discuss a technique in Section 4.10 for reducing the effects of moiré
patterns in under-sampled print media.)

FIGURE 4.21
A newspaper
image digitized at
75 dpi. Note the
moiré-like pattern
resulting from
the interaction
between the ± 45°
orientation of the
half-tone dots and
the north-south
orientation of the
sampling elements
used to digitized
the image.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 239 6/16/2017 2:04:59 PM


240 Chapter 4 Filtering in the Frequency Domain

THE 2-D DISCRETE FOURIER TRANSFORM AND ITS INVERSE


A development similar to the material in Sections 4.3 and 4.4 would yield the follow-
ing 2-D discrete Fourier transform (DFT):

M −1 N −1
F (u, v) = ∑ ∑ f ( x, y) e− j 2p(ux M + vy N )
x=0 y=0
(4-67)

where f ( x, y) is a digital image of size M × N . As in the 1-D case, Eq. (4-67) must be
evaluated for values of the discrete variables u and v in the ranges u = 0, 1, 2, … , M − 1
and v = 0, 1, 2, … , N − 1. †
Given the transform F(u, v), we can obtain f ( x, y) by using the inverse discrete
Sometimes you will find
Fourier transform (IDFT):
in the literature the
1兾MN constant in front M −1 N −1
1
of the DFT instead of
the IDFT. At times,
f ( x, y) =
MN
∑ ∑
u=0 v=0
F (u, v) e j 2 p(ux M + vy N ) (4-68)
the square root of this
constant is included in
front of the forward
and inverse transforms, for x = 0, 1, 2, … , M − 1 and y = 0, 1, 2, … , N − 1. As in the 1-D case, [Eqs. (4-44)
thus creating a more and (4-45)], Eqs. (4-67) and (4-68) constitute a 2-D discrete Fourier transform pair,
symmetrical pair. Any
of these formulations is f ( x, y) ⇔ F (u, v). (The proof is a straightforward extension of the 1-D case in Prob-
correct, provided they lem 4.15.) The rest of this chapter is based on properties of these two equations and
are used consistently.
their use for image filtering in the frequency domain. The comments made in con-
nection with Eqs. (4-44) and (4-45) are applicable to Eqs. (4-67) and (4-68); that is,
knowing that f ( x, y) and F(u, v) are a Fourier transform pair can be quite useful in
proving relationships between functions and their transforms.

4.6 SOME PROPERTIES OF THE 2-D DFT AND IDFT


4.6

In this section, we introduce several properties of the 2-D discrete Fourier transform
and its inverse.

RELATIONSHIPS BETWEEN SPATIAL AND FREQUENCY INTERVALS


The relationships between spatial sampling and the corresponding frequency
domain intervals are as explained in Section 4.4. Suppose that a continuous func-
tion f (t , z) is sampled to form a digital image, f ( x, y), consisting of M × N samples
taken in the t- and z-directions, respectively. Let T and Z denote the separations
between samples (see Fig. 4.15). Then, the separations between the corresponding
discrete, frequency domain variables are given by

1
u = (4-69)
MT


As mentioned in Section 4.4, keep in mind that in this chapter we use (t , z) and (m, n) to denote 2-D continuous
spatial and frequency-domain variables. In the 2-D discrete case, we use ( x, y) for spatial variables and (u, v) for
frequency-domain variables, all of which are discrete.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 240 6/16/2017 2:05:01 PM


4.6 Some Properties of the 2-D DFT and IDFT 241

and
1
v = (4-70)
N Z
respectively. Note the important property that the separations between samples in
the frequency domain are inversely proportional both to the spacing between spa-
tial samples and to the number of samples.

TRANSLATION AND ROTATION


The validity of the following Fourier transform pairs can be demonstrated by direct
substitution into Eqs. (4-67) and (4-68) (see Problem 4.27):

Recall that we use the


f ( x, y) e j 2 p( u0 x M + v0 y N )
⇔ F (u − u0 , v − v0 ) (4-71)
symbol “⇔” to denote
Fourier transform pairs. and
That is, the term on the
right is the transform f ( x − x0 , y − y0 ) ⇔ F (u, v) e − j 2 p( x0 u M + y0 v N )
(4-72)
of the term on the left,
and the term on the left
is the inverse Fourier That is, multiplying f ( x, y) by the exponential shown shifts the origin of the DFT to
transform of the term on
the right. (u0 , v0 ) and, conversely, multiplying F(u, v) by the negative of that exponential shifts
the origin of f ( x, y) to ( x0 , y0 ). As we illustrate in Example 4.13, translation has no
effect on the magnitude (spectrum) of F(u, v).
Using the polar coordinates

x = r cos u y = r sin u u = v cos w v = v sin w

results in the following transform pair:

f (r, u + u0 ) ⇔ F (v, w + u0 ) (4-73)

which indicates that rotating f ( x, y) by an angle u0 rotates F(u, v) by the same angle.
Conversely, rotating F(u, v) rotates f ( x, y) by the same angle.

PERIODICITY
As in the 1-D case, the 2-D Fourier transform and its inverse are infinitely periodic
in the u and v directions; that is,

F (u, v) = F (u + k1 M , v) = F (u, v + k2 N ) = F (u + k1 M , v + k2 N ) (4-74)


and
f ( x, y) = f ( x + k1 M , y) = f ( x, y + k2 N ) = f ( x + k1 M , y + k2 N ) (4-75)

where k1 and k2 are integers.


The periodicities of the transform and its inverse are important issues in the
implementation of DFT-based algorithms. Consider the 1-D spectrum in Fig. 4.22(a).
As explained in Section 4.4 [see the footnote to Eq. (4-42)], the transform data in the
interval from 0 to M − 1 consists of two half periods meeting at point M 2, but with

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 241 6/16/2017 2:05:03 PM


242 Chapter 4 Filtering in the Frequency Domain

a F (u)
b
c d
FIGURE 4.22 Two adjacent half
Centering the periods meet here.
Fourier transform.
(a) A 1-D DFT u
showing an infinite M/ 2 0 M/2  1 M/ 2 M
number of peri- M1
ods. (b) Shifted F (u)
DFT obtained
by multiplying
f ( x) by (−1)x Two adjacent half
before computing periods meet here.
F (u). (c) A 2-D
DFT showing an
infinite number of u
0 M/2 M1
periods. The area One period (M samples)
within the dashed
rectangle is the
data array, F(u, v),
obtained with
Eq. (4-67) with
an image f ( x, y) (0, 0) N/ 2 N1 (0, 0) N/ 2 N1
as the input. This v v
array consists of F (0, 0)
four quarter peri- M/ 2 M/2
ods. (d) Shifted
array obtained
by multiplying M1 M1
f ( x, y) by (−1)x + y
before computing
F(u, v). The data u u
now contains one Four adjacent quarter
complete, centered periods meet here
period, as in (b).
 M  N data array computed by the DFT with f ( x, y) as input
 M  N data array computed by the DFT with f ( x, y)(−1)x + y as input
= Periods of the DFT

the lower part of the period appearing at higher frequencies. For display and filter-
ing purposes, it is more convenient to have in this interval a complete period of the
transform in which the data are contiguous and ordered properly, as in Fig. 4.22(b).
It follows from Eq. (4-71) that

f ( x) e j 2 p(u0 x M)
⇔ F (u − u0 )

In other words, multiplying f ( x) by the exponential term shown shifts the transform
data so that the origin, F(0), is moved to u0 . If we let u0 = M 2, the exponential
term becomes e jpx , which is equal to (−1)x because x is an integer. In this case,

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 242 6/16/2017 2:05:05 PM


4.6 Some Properties of the 2-D DFT and IDFT 243

f ( x)(−1)x ⇔ F (u − M / 2)

That is, multiplying f ( x) by (−1)x shifts the data so that F (u) is centered on the inter-
val [0, M − 1], which corresponds to Fig. 4.22(b), as desired.
In 2-D the situation is more difficult to graph, but the principle is the same, as
Fig. 4.22(c) shows. Instead of two half periods, there are now four quarter periods
meeting at the point (M 2 , N 2). As in the 1-D case, we want to shift the data so
that F(0, 0) is at (M 2 , N 2). Letting (u0 , v0 ) = (M 2 , N 2) in Eq. (4-71) results in
the expression

f ( x, y)(−1)x + y ⇔ F (u − M 2 , v − N 2) (4-76)

Using this equation shifts the data so that F(0, 0) is moved to the center of
the frequency rectangle (i.e., the rectangle defined by the intervals [0, M − 1] and
[0, N − 1] in the frequency domain). Figure 4.22(d) shows the result.
Keep in mind that in all our discussions, coordinate values in both the spatial and
frequency domains are integers. As we explained in Section 2.4 (see Fig. 2.19) if, as
in our case), the origin of an M × N image or transform is at (0, 0), then the center of
that image or transform is at ( floor(M 2), floor( N 2)) . This expression is applicable
to both even and odd values of M and N. For example, the center of an array of size
20 × 15 is at point (10, 7). Because we start counting from 0, these are the 11th and
8th points in the first and second coordinate axes of the array, respectively.

SYMMETRY PROPERTIES
An important result from functional analysis is that any real or complex function,
w( x, y), can be expressed as the sum of an even and an odd part, each of which can
be real or complex:

w( x, y) = we ( x, y) + wo ( x, y) (4-77)

where the even and odd parts are defined as


w( x, y) + w(− x, − y)
we ( x, y)  (4-78)
2
and
w( x, y) − w(− x, − y)
wo ( x, y)  (4-79)
2
for all valid values of x and y. Substituting Eqs. (4-78) and (4-79) into Eq. (4-77) gives
the identity w( x, y) ≡ w( x, y), thus proving the validity of the latter equation. It fol-
lows from the preceding definitions that

we ( x, y) = we (− x, − y) (4-80)

and

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 243 6/16/2017 2:05:07 PM


244 Chapter 4 Filtering in the Frequency Domain

wo ( x, y) = −wo (− x, − y) (4-81)

Even functions are said to be symmetric and odd functions antisymmetric. Because
In the context of this dis- all indices in the DFT and IDFT are nonnegative integers, when we talk about sym-
cussion, the locations of
elements in a sequence metry (antisymmetry) we are referring to symmetry (antisymmetry) about the cen-
are denoted by integers. ter point of a sequence, in which case the definitions of even and odd become:
Therefore, the same
observations made a few
paragraphs back about we ( x, y) = we (M − x, N − y) (4-82)
the centers of arrays of
even and odd sizes are
applicable to sequences. and
But, do not confuse the
concepts of even/odd
numbers and even/odd wo ( x, y) = −wo (M − x, N − y) (4-83)
functions.

for x = 0, 1, 2, … , M − 1 and y = 0, 1, 2, … , N − 1. As usual, M and N are the number


of rows and columns of a 2-D array.
We know from elementary mathematical analysis that the product of two even or
two odd functions is even, and that the product of an even and an odd function is
odd. In addition, the only way that a discrete function can be odd is if all its samples
To convince yourself that
the samples of an odd
sum to zero. These properties lead to the important result that
function sum to zero,
M −1 N −1
∑ ∑ we ( x, y)wo ( x, y) = 0
sketch one period of
a 1-D sine wave about (4-84)
the origin or any other x=0 y=0
interval spanning one
period.
for any two discrete even and odd functions we and wo . In other words, because the
argument of Eq. (4-84) is odd, the result of the summations is 0. The functions can
be real or complex.

EXAMPLE 4.10 : Even and odd functions.


Although evenness and oddness are visualized easily for continuous functions, these concepts are not as
intuitive when dealing with discrete sequences. The following illustrations will help clarify the preceding
ideas. Consider the 1-D sequence

f = { f (0), f (1), f (2), f (3)} = {2, 1, 1, 1}

in which M = 4. To test for evenness, the condition f ( x) = f (4 − x) must be satisfied for x = 0, 1, 2, 3.


That is, we require that

f (0) = f (4), f (1) = f (3), f (2) = f (2), f (3) = f (1)

Because f (4) is outside the range being examined and can be any value, the value of f (0) is immaterial
in the test for evenness. We see that the next three conditions are satisfied by the values in the array, so
the sequence is even. In fact, we conclude that any 4-point even sequence has to have the form
{a, b, c, b}
That is, only the second and last points must be equal in a 4-point even sequence. In general, when M
is an even number, a 1-D even sequence has the property that the points at locations 0 and M 2 have

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 244 6/16/2017 2:05:08 PM


4.6 Some Properties of the 2-D DFT and IDFT 245

arbitrary values. When M is odd, the first point of an even sequence is still arbitrary, but the others form
pairs with equal values.
Odd sequences have the interesting property that their first term, wo (0, 0), is always 0, a fact that fol-
lows directly from Eq. (4-79). Consider the 1-D sequence

g = { g(0), g(1), g(2), g(3)} = {0, − 1, 0, 1}

We can confirm that this is an odd sequence by noting that the terms in the sequence satisfy the condi-
tion g( x) = − g(4 − x) for x = 1, 2, 3. All we have to do for x = 0 is to check that g(0) = 0. We check the
other terms using the definition. For example, g(1) = − g(3). Any 4-point odd sequence has the form

{0, − b, 0, b}
In general, when M is an even number, a 1-D odd sequence has the property that the points at locations
0 and M 2 are always zero. When M is odd, the first term still has to be 0, but the remaining terms form
pairs with equal value but opposite signs.
The preceding discussion indicates that evenness and oddness of sequences depend also on the length
of the sequences. For example, we showed already that the sequence {0, − 1, 0, 1} is odd. However, the
sequence {0, − 1, 0, 1, 0} is neither odd nor even, although the “basic” structure appears to be odd. This
is an important issue in interpreting DFT results. We will show later in this section that the DFTs of even
and odd functions have some very important characteristics. Thus, it often is the case that understanding
when a function is odd or even plays a key role in our ability to interpret image results based on DFTs.
The same basic considerations hold in 2-D. For example, the 6 × 6 2-D array with center at location
(3, 3), shown bold in the figure [remember, we start counting at (0, 0)],

0 0 0 0 0 0
0 0 0 0 0 0
0 0 −1 0 1 0
0 0 −2 0 2 0
0 0 −1 0 1 0
0 0 0 0 0 0

is odd, as you can prove using Eq. (4-83). However, adding another row or column of 0’s would give
a result that is neither odd nor even. In general, inserting a 2-D array of even dimensions into a larger
array of zeros, also of even dimensions, preserves the symmetry of the smaller array, provided that the
centers coincide. Similarly, a 2-D array of odd dimensions can be inserted into a larger array of zeros of
odd dimensions without affecting the symmetry. Note that the inner structure of the preceding array is
a Sobel kernel (see Fig. 3.50). We return to this kernel in Example 4.15, where we embed it in a larger
array of zeros for filtering purposes.

Conjugate symmetry
is also called hermitian Armed with the preceding concepts, we can establish a number of important sym-
symmetry. The term metry properties of the DFT and its inverse. A property used frequently is that the
antihermitian is used
sometimes to refer to Fourier transform of a real function, f ( x, y), is conjugate symmetric:
conjugate antisymmetry.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 245 6/16/2017 2:05:09 PM


246 Chapter 4 Filtering in the Frequency Domain

F * (u, v) = F (− u, −v) (4-85)

We show the validity of this equation as follows:


*
⎡ M −1 N −1 ⎤
F * (u, v) = ⎢ ∑ ∑ f ( x, y) e − j 2p(ux M + vy N)

⎢⎣ x = 0 y = 0 ⎥⎦
M −1 N −1
= ∑ ∑
x=0 y=0
f * ( x, y) e j 2 p(ux M + vy N )

M −1 N −1
= ∑ ∑
x=0 y=0
f ( x, y) e − j 2 p([ − u ] x M + [ − v ] y N )

= F (−u, −v)
where the third step follows from the fact that f ( x, y) is real. A similar approach
can be used to prove that, if f ( x, y) is imaginary, its Fourier transform is conjugate
antisymmetric; that is, F * (− u, −v) = − F (u, v).
Table 4.1 lists symmetries and related properties of the DFT that are useful in
digital image processing. Recall that the double arrows indicate Fourier transform
pairs; that is, for any row in the table, the properties on the right are satisfied by the
Fourier transform of the function having the properties listed on the left, and vice
versa. For example, entry 5 reads: The DFT of a real function f ( x, y), in which ( x, y)

TABLE 4.1
Spatial Domain† Frequency Domain†
Some symmetry
properties of the 1) f ( x, y) real ⇔ F * (u, v) = F (− u, − v)
2-D DFT and its
inverse. R(u, v) 2) f ( x, y) imaginary ⇔ F * (− u, − v) = − F (u, v)
and I(u, v) are
the real and 3) f ( x, y) real ⇔ R(u, v) even; I (u, v) odd
imaginary parts of 4) f ( x, y) imaginary ⇔ R(u, v) odd; I (u, v) even
F(u, v),
respectively. 5) f (− x, − y) real ⇔ F * (u, v) complex
Use of the word
complex indicates 6) f (− x, − y) complex ⇔ F(− u, − v) complex
that a function
has nonzero real 7) *
f ( x, y) complex ⇔ F * (− u, − v) complex
and imaginary
parts. 8) f ( x, y) real and even ⇔ F(u, v) real and even
9) f ( x, y) real and odd ⇔ F(u, v) imaginary and odd
10) f ( x, y) imaginary and even ⇔ F(u, v) imaginary and even
11) f ( x, y) imaginary and odd ⇔ F(u, v) real and odd
12) f ( x, y) complex and even ⇔ F(u, v) complex and even
13) f ( x, y) complex and odd ⇔ F(u, v) complex and odd

Recall that x, y, u, and v are discrete (integer) variables, with x and u in the range [0, M − 1], and y and v in
the range [0, N − 1]. To say that a complex function is even means that its real and imaginary parts are even, and
similarly for an odd complex function. As before, “⇔” indicates a Fourier transform pair.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 246 6/16/2017 2:05:13 PM


4.6 Some Properties of the 2-D DFT and IDFT 247

is replaced by (− x, − y), is F * (u, v), the complex conjugate of the DFT of f ( x, y).
Conversely, the IDFT of F * (u, v) is f (− x, − y).

EXAMPLE 4.11 : 1-D illustrations of the properties in Table 4.1.


The 1-D sequences (functions) and their transforms in Table 4.2 are short examples of the properties
listed in Table 4.1. For example, in property 3 we see that a real function with elements {1, 2, 3, 4} has a
Fourier transform whose real part, {10, − 2, − 2, − 2} , is even and whose imaginary part, {0, 2, 0, − 2} , is
odd. Property 8 tells us that a real even function has a transform that is real and even also. Property 12
shows that an even complex function has a transform that is also complex and even. The other listings
in the table are analyzed in a similar manner.

EXAMPLE 4.12 : Proving some of the DFT symmetry properties from Table 4.1.
In this example, we prove several of the properties in Table 4.1 to help you develop familiarity with
manipulating these important properties, and to establish a basis for solving some of the problems at
the end of the chapter. We prove only the properties on the right given the properties on the left. The
converse is proved in a manner similar to the proofs we give here.
Consider property 3, which reads: If f ( x, y) is a real function, the real part of its DFT is even and the
imaginary part is odd.We prove this property as follows: F(u, v) is complex in general, so it can be expressed
as the sum of a real and an imaginary part: F (u, v) = R(u, v) + jI (u, v). Then, F * (u, v) = R(u, v) − jI (u, v).
Also, F (− u, −v) = R(− u, −v) + jI (− u, −v). But, as we proved earlier for Eq. (4-85), if f ( x, y) is real then
F * (u, v) = F (− u, −v), which, based on the preceding two equations, means that R(u, v) = R(− u, −v) and
I (u, v) = − I (− u, −v). In view of the definitions in Eqs. (4-80) and (4-81), this proves that R is an even
function and that I is an odd function.
Next, we prove property 8. If f ( x, y) is real, we know from property 3 that the real part of F(u, v) is
even, so to prove property 8 all we have to do is show that if f ( x, y) is real and even then the imaginary
part of F(u, v) is 0 (i.e., F is real). The steps are as follows:

TABLE 4.2
Property f(x) F(u)
1-D examples of
some of the prop-
erties in Table 4.1.
3 {1, 2, 3, 4} ⇔ {(10 + 0 j ) , ( −2 + 2 j ) , ( −2 + 0 j ) , ( −2 − 2 j )}
4 {1 j, 2 j, 3 j, 4 j} ⇔ {( 0 + 2.5 j ) , (.5 − .5 j ) , ( 0 − .5 j ) , ( −.5 − .5 j )}
8 {2, 1, 1, 1} ⇔ {5, 1, 1, 1}
9 {0, − 1, 0, 1} ⇔ {( 0 + 0 j ) , ( 0 + 2 j ) , ( 0 + 0 j ) , ( 0 − 2 j )}
10 {2 j , 1 j , 1 j , 1 j } ⇔ {5 j, j, j, j }
11 {0 j , − 1 j , 0 j , 1 j } ⇔ {0, − 2, 0, 2}
12 {( 4 + 4 j ) , ( 3 + 2 j ) , ( 0 + 2 j ) , ( 3 + 2 j )} ⇔ {(10 + 10 j ) , ( 4 + 2 j ) , ( −2 + 2 j ) , ( 4 + 2 j )}
13 {( 0 + 0 j ) , (1 + 1 j ) , ( 0 + 0 j ) , ( − 1 − j )} ⇔ {( 0 + 0 j ) , ( 2 − 2 j ) , ( 0 + 0 j ) , ( −2 + 2 j )}

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 247 6/16/2017 2:05:22 PM


248 Chapter 4 Filtering in the Frequency Domain

M −1 N −1
ᑣ { f ( x, y)} = F (u, v) = ∑ ∑ f ( x, y) e− j 2p(ux M + vy N )
x =0 y= 0
M −1 N −1
= ∑ ∑ [ fr ( x, y)] e− j 2p(ux M + vy N )
x=0 y=0
M −1 N −1
= ∑ ∑ [ fr ( x, y)] e− j 2p(ux M ) e− j 2p(vy N )
x=0 y=0

We can expand the last line of this expression in terms of even and odd parts
M −1 N −1
F (u, v) = ∑ ∑ [even ][even − jodd ][even − jodd ]
x=0 y=0
M −1 N −1
= ∑ ∑ [even ][even ⋅ even − 2 jeven ⋅ odd − odd ⋅ odd ]
x=0 y=0
M −1 N −1 M −1 N −1 M −1 N −1
= ∑ ∑ [even ⋅ even ] − 2 j x∑= 0 y∑= 0 [even ⋅ odd ] − x∑= 0 y∑= 0 [even ⋅ even ]
x=0 y=0

= real.

The first step follows from Euler’s equation, and the fact that the cos and sin are even and odd functions,
respectively. We also know from property 8 that, in addition to being real, f ( x, y) is an even function.
The only term in the penultimate line containing imaginary components is the second term, which is 0
according to Eq. (4-84). Therefore, if f ( x, y) is real and even, then F(u, v) is real. As noted earlier, F(u, v)
is even also because f ( x, y) is real. This concludes the proof.
Finally, we demonstrate the validity of property 6. From the definition of the DFT,
M −1 N −1
ℑ{ f (− x, − y)} = ∑ ∑ f (− x, − y) e − j 2p(ux M + vy N )
x=0 y=0

We are not making a change of variable here. We are evaluating the DFT of f (− x, − y), so we sim-
ply insert this function into the equation, as we would any other function. Because of periodicity,
f (− x, − y) = f (M − x, N − y). If we now define m = M − x and n = N − y, then
M −1 N −1
ℑ{ f (− x, − y)} = ∑ ∑ f (m, n) e − j 2p(u[ M − m] M + v[ N − n] N )
m=0 n=0

To convince yourself that the summations are correct, try a 1-D transform and expand a few terms by
hand. Because exp[ − j2p(integer)] = 1, it follows that
M −1 N −1
ℑ{ f (− x, − y)} = ∑ ∑ f (m, n) e j 2p( mu M +vn N ) = F (−u, −v)
m= 0 n = 0

This concludes the proof.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 248 6/16/2017 2:05:23 PM


4.6 Some Properties of the 2-D DFT and IDFT 249

FOURIER SPECTRUM AND PHASE ANGLE


Because the 2-D DFT is complex in general, it can be expressed in polar form:

F (u, v) = R(u, v) + jI (u, v)


(4-86)
= F (u, v) e jf(u,v )
where the magnitude

1/ 2
F (u, v) = ⎡⎣ R 2 (u, v) + I 2 (u, v)⎤⎦ (4-87)

is called the Fourier (or frequency) spectrum, and

⎡ I (u, v) ⎤
f(u, v) = arctan ⎢ ⎥ (4-88)
⎣ R(u, v) ⎦
is the phase angle or phase spectrum. Recall from the discussion in Section 4.2 that
the arctan must be computed using a four-quadrant arctangent function, such as
MATLAB’s atan2(Imag, Real) function.
Finally, the power spectrum is defined as
2
P(u, v) = F (u, v)
(4-89)
= R 2 (u, v) + I 2 (u, v)
As before, R and I are the real and imaginary parts of F(u, v), and all computations
are carried out for the discrete variables u = 0, 1, 2, … , M − 1 and v = 0, 1, 2, … , N − 1.
Therefore, F(u, v) , f(u, v), and P(u, v) are arrays of size M × N .
The Fourier transform of a real function is conjugate symmetric [see Eq. (4-85)],
which implies that the spectrum has even symmetry about the origin:

F (u, v) = F (−u, −v) (4-90)

The phase angle exhibits odd symmetry about the origin:

f(u, v) = − f(−u, −v) (4-91)

It follows from Eq. (4-67) that


M −1 N −1
F (0, 0) = ∑ ∑ f ( x, y)
x=0 y=0

which indicates that the zero-frequency term of the DFT is proportional to the aver-
age of f ( x, y). That is,
M −1 N −1
1
F (0, 0) = MN
MN
∑ ∑ f ( x, y)
x=0 y=0 (4-92)
= MNf

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 249 6/16/2017 2:05:25 PM


250 Chapter 4 Filtering in the Frequency Domain

where f (a scalar) denotes the average value of f ( x, y). Then,

F (0, 0) = MN f (4-93)

Because the proportionality constant MN usually is large, F(0, 0) typically is the


largest component of the spectrum by a factor that can be several orders of magni-
tude larger than other terms. Because frequency components u and v are zero at the
origin, F(0, 0) sometimes is called the dc component of the transform. This terminol-
ogy is from electrical engineering, where “dc” signifies direct current (i.e., current of
zero frequency).

EXAMPLE 4.13 : The spectrum of a rectangle.


Figure 4.23(a) shows an image of a rectangle and Fig. 4.23(b) shows its spectrum, whose values were
scaled to the range [0, 255] and displayed in image form. The origins of both the spatial and frequency
domains are at the top left. This is the right-handed coordinate system convention we defined in Fig. 2.19.
Two things are apparent in Fig. 4.23(b). As expected, the area around the origin of the transform con-
tains the highest values (and thus appears brighter in the image). However, note that the four corners

a b y v
c d
FIGURE 4.23
(a) Image.
(b) Spectrum,
showing small,
bright areas in the
four corners (you
have to look care-
fully to see them).
(c) Centered
spectrum.
(d) Result after a
log transformation.
The zero crossings x u
of the spectrum v v
are closer in the
vertical direction
because the rectan-
gle in (a) is longer
in that direction.
The right-handed
coordinate
convention used in
the book places the
origin of the spatial
and frequency
domains at the top
left (see Fig. 2.19).
u u

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 250 6/16/2017 2:05:26 PM


4.6 Some Properties of the 2-D DFT and IDFT 251

a b
c d
FIGURE 4.24
(a) The rectangle
in Fig. 4.23(a)
translated.
(b) Corresponding
spectrum.
(c) Rotated
rectangle.
(d) Corresponding
spectrum.
The spectrum of
the translated
rectangle is
identical to the
spectrum of the
original image in
Fig. 4.23(a).

of the spectrum contain similarly high values. The reason is the periodicity property discussed in the
previous section. To center the spectrum, we simply multiply the image in (a) by (−1)x + y before comput-
ing the DFT, as indicated in Eq. (4-76). Figure 4.23(c) shows the result, which clearly is much easier to
visualize (note the symmetry about the center point). Because the dc term dominates the values of the
spectrum, the dynamic range of other intensities in the displayed image are compressed. To bring out
those details, we used the log transformation defined in Eq. (3-4) with c = 1. Figure 4.23(d) shows the
display of log(1 + F (u, v) ). The increased rendition of detail is evident. Most spectra shown in this and
subsequent chapters are scaled in this manner.
It follows from Eqs. (4-72) and (4-73) that the spectrum is insensitive to image translation (the abso-
lute value of the exponential term is 1), but it rotates by the same angle of a rotated image. Figure
4.24 illustrates these properties. The spectrum in Fig. 4.24(b) is identical to the spectrum in Fig. 4.23(d).

a b c
FIGURE 4.25
Phase angle
images of
(a) centered,
(b) translated,
and (c) rotated
rectangles.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 251 6/16/2017 2:05:26 PM


252 Chapter 4 Filtering in the Frequency Domain

Clearly, the images in Figs. 4.23(a) and 4.24(a) are different so, if their Fourier spectra are the same,
then, based on Eq. (4-86), their phase angles must be different. Figure 4.25 confirms this. Figures 4.25(a)
and (b) are the phase angle arrays (shown as images) of the DFTs of Figs. 4.23(a) and 4.24(a). Note the
lack of similarity between the phase images, in spite of the fact that the only differences between their
corresponding images is simple translation. In general, visual analysis of phase angle images yields little
intuitive information. For instance, because of its 45° orientation, one would expect intuitively that the
phase angle in Fig. 4.25(a) should correspond to the rotated image in Fig. 4.24(c), rather than to the
image in Fig. 4.23(a). In fact, as Fig. 4.25(c) shows, the phase angle of the rotated image has a strong
orientation that is much less than 45°.

The components of the spectrum of the DFT determine the amplitudes of the
sinusoids that combine to form an image. At any given frequency in the DFT of
an image, a large amplitude implies a greater prominence of a sinusoid of that fre-
quency in the image. Conversely, a small amplitude implies that less of that sinu-
soid is present in the image. Although, as Fig. 4.25 shows, the contribution of the
phase components is less intuitive, it is just as important. The phase is a measure of
displacement of the various sinusoids with respect to their origin. Thus, while the
magnitude of the 2-D DFT is an array whose components determine the intensities
in the image, the corresponding phase is an array of angles that carry much of the
information about where discernible objects are located in the image. The following
example illustrates these ideas in more detail.

EXAMPLE 4.14 : Contributions of the spectrum and phase angle to image formation.
Figure 4.26(b) shows as an image the phase-angle array, f(u, v), of the DFT of Fig. 4.26(a), computed
using Eq. (4-88). Although there is no detail in this array that would lead us by visual analysis to associ-
ate it with the structure of its corresponding image, the information in this array is crucial in determin-
ing shape features of the image. To illustrate this, we reconstructed the boy’s image using only its phase
angle. The reconstruction consisted of computing the inverse DFT of Eq. (4-86) using f(u, v), but setting
F(u, v) = 1. Figure Fig. 4.26(c) shows the result (the original result had much less contrast than is shown;
to bring out details important in this discussion, we scaled the result using Eqs. (2-31) and (2-32), and
then enhanced it using histogram equalization). However, even after enhancement, it is evident that
much of the intensity information has been lost (remember, that information is carried by the spectrum,
which we did not use in the reconstruction). However, the shape features in 4.26(c) are unmistakably
from Fig. 4.26(a). This illustrates vividly the importance of the phase angle in determining shape char-
acteristics in an image.
Figure 4.26(d) was obtained by computing the inverse DFT Eq. (4-86), but using only the spectrum.
This means setting the exponential term to 1, which in turn implies setting the phase angle to 0. The
result is not unexpected. It contains only intensity information, with the dc term being the most domi-
nant. There is no shape information in the image because the phase was set to zero.
Finally, Figs. 4.26(e) and (f) show yet again the dominance of the phase in determining the spatial
feature content of an image. Figure 4.26(e) was obtained by computing the inverse DFT of Eq. (4-86)
using the spectrum of the rectangle from Fig. 4.23(a) and the phase angle from the boy’s image. The
boy’s features clearly dominate this result. Conversely, the rectangle dominates Fig. 4.26(f), which was
computed using the spectrum of the boy’s image and the phase angle of the rectangle.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 252 6/16/2017 2:05:27 PM


4.6 Some Properties of the 2-D DFT and IDFT 253

a b c
d e f
FIGURE 4.26 (a) Boy image. (b) Phase angle. (c) Boy image reconstructed using only its phase angle (all shape features
are there, but the intensity information is missing because the spectrum was not used in the reconstruction). (d) Boy
image reconstructed using only its spectrum. (e) Boy image reconstructed using its phase angle and the spectrum of
the rectangle in Fig. 4.23(a). (f) Rectangle image reconstructed using its phase and the spectrum of the boy’s image.

THE 2-D DISCRETE CONVOLUTION THEOREM

You will find it helpful


Extending Eq. (4-48) to two variables results in the following expression for 2-D
to review Eq. (4-48), circular convolution:
and the comments made M −1 N −1
there regarding circular
convolution, as opposed
( f 夹 h)( x, y) = ∑ ∑ f (m, n)h( x − m, y − n)
m=0 n=0
(4-94)
to the convolution we
studied in Section 3.4.
for x = 0, 1, 2, … , M − 1 and y = 0, 1, 2, … , N − 1. As in Eq. (4-48), Eq. (4-94) gives
one period of a 2-D periodic sequence. The 2-D convolution theorem is give by

( f 夹 h)( x, y) ⇔ (F i H )(u, v) (4-95)

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 253 6/16/2017 2:05:28 PM


254 Chapter 4 Filtering in the Frequency Domain

and, conversely,
1
( f i h)( x, y) ⇔ (F 夹 H )(u, v) (4-96)
MN
The function products
where F and H are the Fourier transforms of f and h, respectively, obtained using
are elementwise products, Eq. (4-67). As before, the double arrow is used to indicate that the left and right sides
as defined in Section 2.6. of the expressions constitute a Fourier transform pair. Our interest in the remainder
of this chapter is in Eq. (4-95), which states that the Fourier transform of the spatial
convolution of f and h, is the product of their transforms. Similarly, the inverse DFT
of the product (F i H )(u, v) yields ( f 夹 h)( x, y).
Equation (4-95) is the foundation of linear filtering in the frequency domain and,
as we will explain in Section 4.7, is the basis for all the filtering techniques discussed
in this chapter. As you will recall from Chapter 3, spatial convolution is the foun-
dation for spatial filtering, so Eq. (4-95) is the tie that establishes the equivalence
between spatial and frequency-domain filtering, as we have mentioned several times
before.
Ultimately, we are interested in the results of convolution in the spatial domain,
where we analyze images. However, the convolution theorem tell us that we have
two ways of computing the spatial convolution of two functions. We can do it directly
in the spatial domain with Eq. (3-35), using the approach described in Section 3.4
or, according to Eq. (4-95), we can compute the Fourier transform of each function,
multiply the transforms, and compute the inverse Fourier transform. Because we are
dealing with discrete quantities, computation of the Fourier transforms is carried
We will discuss efficient
out using a DFT algorithm. This automatically implies periodicity, which means that
ways for computing the when we take the inverse Fourier transform of the product of the two transforms we
DFT in Section 4.11.
would get a circular (i.e., periodic) convolution, one period of which is given by Eq.
(4-94). The question is: under what conditions will the direct spatial approach and
the inverse Fourier transform method yield the same result? We arrive at the answer
by looking at a 1-D example first, and then extending the results to two variables.
The left column of Fig. 4.27 implements convolution of two functions, f and h,
using the 1-D equivalent of Eq. (3-35), which, because the two functions are of same
size, is written as
399
( f 夹 h)( x) = ∑ f ( x) h( x − m)
m=0

Recall from our explanation of Figs. 3.29 and 3.30 that the procedure consists of (1)
rotating (flipping) h by 180°, [see Fig. 4.27(c)], (2) translating the resulting function
by an amount x [Fig. 4.27(d)], and (3) for each value x of translation, computing the
entire sum of products in the right side of the equation. In terms of Fig. 4.27, this
means multiplying the function in Fig. 4.27(a) by the function in Fig. 4.27(d) for each
value of x. The displacement x ranges over all values required to completely slide h
across f. Figure 4.27(e) shows the convolution of these two functions. As you know,
convolution is a function of the displacement variable, x, and the range of x required
in this example to completely slide h past f is from 0 to 799.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 254 6/16/2017 2:05:29 PM


4.6 Some Properties of the 2-D DFT and IDFT 255
f (m) f (m)
a f
b g
c h 3 3
d i
e j
FIGURE 4.27 m m
Left column: 0 200 400 0 200 400
Spatial h(m) h (m)
convolution
computed with
Eq. (3-35), using
2 2
the approach
discussed in
m m
Section 3.4.
0 200 400 0 200 400
Right column:
h(m) h(m)
Circular
convolution. The
solid line in (j)
is the result we
would obtain
using the DFT, m m
or, equivalently, 0 200 400 0 200 400
Eq. (4-48). This h(x  m) h (x  m)
erroneous result
can be remedied
by using zero x x
padding.
m m
0 200 400 0 200 400
( f 夹 g )( x) ( f 夹 g )( x)

1200 1200

600 600
x x
0 200 400 600 800 0 200 400
Range of
Fourier transform
computation

If we use the DFT and the convolution theorem to try to obtain the same result
as in the left column of Fig. 4.27, we must take into account the periodicity inher-
ent in the expression for the DFT. This is equivalent to convolving the two periodic
functions in Figs. 4.27(f) and (g) (i.e., as Eqs. (4-46) and (4-47) indicate, the func-
tions their transforms have implied periodicity). The convolution procedure is the
same as we just discussed, but the two functions now are periodic. Proceeding with
these two functions as in the previous paragraph would yield the result in Fig. 4.27(j),
which obviously is incorrect. Because we are convolving two periodic functions, the
convolution itself is periodic. The closeness of the periods in Fig. 4.27 is such that

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 255 6/16/2017 2:05:29 PM


256 Chapter 4 Filtering in the Frequency Domain

they interfere with each other to cause what is commonly referred to as wraparound
error. According to the convolution theorem, if we had computed the DFT of the
two 400-point functions, f and h, multiplied the two transforms, and then computed
the inverse DFT, we would have obtained the erroneous 400-point segment of the
periodic convolution shown as a solid line in Fig. 4.27(j) (remember the limits of the
1-D DFT are u = 0, 1, 2, … , M − 1). This is also the result we would obtain if we used
Eq. (4-48) [the 1-D equivalent of Eq. (4-94)] to compute one period of the circular
convolution.
Fortunately, the solution to the wraparound error problem is simple. Consider
two functions, f ( x) and h( x) composed of A and B samples, respectively. It can be
shown (Brigham [1988]) that if we append zeros to both functions so that they have
the same length, denoted by P, then wraparound is avoided by choosing

P≥ A+B−1 (4-97)

In our example, each function has 400 points, so the minimum value we could use is
The padding zeros could
P = 799, which implies that we would append 399 zeros to the trailing edge of each
be appended also at function. This procedure is called zero padding, as we discussed in Section 3.4. As
the beginning of the an exercise, you should convince yourself that if the periods of the functions in Figs.
functions, or they could
be divided between the 4.27(f) and (g) were lengthened by appending to each period at least 399 zeros, the
beginning and end of the result would be a periodic convolution in which each period is identical to the cor-
functions. It is simpler to
append them at the end. rect result in Fig. 4.27(e). Using the DFT via the convolution theorem would result
in a 799-point spatial function identical to Fig. 4.27(e). The conclusion, then, is that
to obtain the same convolution result between the “straight” representation of the
convolution equation approach in Chapter 3, and the DFT approach, functions in
the latter must be padded prior to computing their transforms.
Visualizing a similar example in 2-D is more difficult, but we would arrive at the
same conclusion regarding wraparound error and the need for appending zeros to
the functions. Let f ( x, y) and h( x, y) be two image arrays of sizes A × B and C × D
pixels, respectively. Wraparound error in their circular convolution can be avoided
We use zero-padding
by padding these functions with zeros, as follows:
here for simplicity. Recall
from the discussion of
⎧ f ( x, y) 0 ≤ x ≤ A − 1 and 0 ≤ y ≤ B − 1
Fig. 3.39 that replicate f p ( x, y) = ⎨ (4-98)
and mirror padding
⎩0 A ≤ x ≤ P or B ≤ y ≤ Q
generally yield better
results.
and

⎧ h( x, y) 0 ≤ x ≤ C − 1 and 0 ≤ y ≤ D − 1
hp ( x, y) = ⎨ (4-99)
⎩0 C ≤ x ≤ P or D ≤ y ≤ Q

with

P ≥ A+C −1 (4-100)

and

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 256 6/16/2017 2:05:30 PM


4.6 Some Properties of the 2-D DFT and IDFT 257

Q≥B+D−1 (4-101)

The resulting padded images are of size P × Q. If both arrays are of the same size,
M × N , then we require that P ≥ 2 M − 1 and Q ≥ 2 N − 1. As a rule, DFT algorithms
tend to execute faster with arrays of even size, so it is good practice to select P and
Q as the smallest even integers that satisfy the preceding equations. If the two arrays
are of the same size, this means that P and Q are selected as:

P = 2M (4-102)

and

Q = 2N (4-103)

Figure 4.31 in the next section illustrates the effects of wraparound error on images.
The two functions in Figs. 4.27(a) and (b) conveniently become zero before the
end of the sampling interval. If one or both of the functions were not zero at the end
of the interval, then a discontinuity would be created when zeros were appended
to the function to eliminate wraparound error. This is analogous to multiplying a
function by a box, which in the frequency domain would imply convolution of the
original transform with a sinc function (see Example 4.1). This, in turn, would create
so-called frequency leakage, caused by the high-frequency components of the sinc
function. Leakage produces a blocky effect on images. Although leakage can never
be totally eliminated, it can be reduced significantly by multiplying the sampled
function by another function that tapers smoothly to near zero at both ends of the
sampled record. This idea is to dampen the sharp transitions (and thus the high fre-
A simple apodizing
quency components) of the box. This approach, called windowing or apodizing, is an
function is a triangle, cen- important consideration when fidelity in image reconstruction (as in high-definition
tered on the data record, graphics) is desired.
which tapers to 0 at both
ends of the record. This is
called a Bartlett window.
Other common windows SUMMARY OF 2-D DISCRETE FOURIER TRANSFORM PROPERTIES
are the Gaussian, the
Hamming and the Hann Table 4.3 summarizes the principal DFT definitions introduced in this chapter. We
windows.
will discuss the separability property in Section 4.11, where we also show how to
obtain the inverse DFT using a forward transform algorithm. Correlation will be
discussed in detail Chapter 12.
Table 4.4 summarizes some important DFT pairs. Although our focus is on dis-
crete functions, the last two entries in the table are Fourier transform pairs that can
be derived only for continuous variables (note the use of continuous variable nota-
tion).We include them here because, with proper interpretation, they are quite use-
ful in digital image processing. The differentiation pair can be used to derive the fre-
quency-domain equivalent of the Laplacian defined in Eq. (3-50) (see Problem 4.52).
The Gaussian pair is discussed in Section 4.7. Tables 4.1, 4.3 and 4.4 provide a sum-
mary of properties useful when working with the DFT. Many of these properties
are key elements in the development of the material in the rest of this chapter, and
some are used in subsequent chapters.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 257 6/16/2017 2:05:31 PM


258 Chapter 4 Filtering in the Frequency Domain

TABLE 4.3
Summary of DFT Name Expression(s)
definitions and 1) Discrete Fourier M −1 N −1
corresponding transform (DFT) of F (u, v) = ∑ ∑ f ( x, y) e− j 2p(ux M +vy N )
x=0 y=0
expressions. f ( x, y)
2) Inverse discrete 1 M −1 N −1
Fourier transform f ( x, y) = ∑ ∑ F (u, v) e j 2p(ux M +vy
MN u = 0 v = 0
N)

(IDFT) of F(u, v)
12
3) Spectrum F (u, v) = ⎡⎣ R 2 (u, v) + I 2 (u, v)⎤⎦ R = Real(F ); I = Imag(F )

⎡ I (u, v) ⎤
4) Phase angle f(u, v) = tan −1 ⎢ ⎥
⎣ R(u, v) ⎦

5) Polar representation F (u, v) = F (u, v) e jf( u,v )

2
6) Power spectrum P(u, v) = F (u, v)

1 M −1 N −1 1
7) Average value f = ∑ ∑ f ( x, y) = MN F (0, 0)
MN x = 0 y = 0

8) Periodicity (k1 and F (u, v) = F (u + k1 M , v) = F (u, v + k2 N )


k2 are integers) = F (u + k1 , v + k2 N )
f ( x, y) = f ( x + k1 M , y) = f ( x, y + k2 N )
= f ( x + k1 M , y + k2 N )

M −1 N −1
9) Convolution ( f 夹 h)( x, y) = ∑ ∑ f (m, n)h( x − m, y − n)
m=0 n=0

M −1 N −1
10) Correlation ( f 夽 h)( x, y) = ∑ ∑ f * (m, n)h( x + m, y + n)
m=0 n=0

11) Separability The 2-D DFT can be computed by computing 1-D DFT
transforms along the rows (columns) of the image, followed
by 1-D transforms along the columns (rows) of the result.
See Section 4.11.

M −1 N −1
12) Obtaining the IDFT MNf * ( x, y) = ∑ ∑ F * (u, v) e − j 2p(ux M +vy N )
using a DFT u=0 v=0
algorithm This equation indicates that inputting F * (u, v) into an
algorithm that computes the forward transform (right side
of above equation) yields MNf * ( x, y). Taking the complex
conjugate and dividing by MN gives the desired inverse. See
Section 4.11.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 258 6/16/2017 2:05:32 PM


4.6 Some Properties of the 2-D DFT and IDFT 259

TABLE 4.4 Name DFT Pairs


Summmary of
DFT pairs. The 1) Symmetry See Table 4.1
closed-form properties
expressions in 12
and 13 are valid 2) Linearity a f1 ( x, y) + b f2 ( x, y) ⇔ aF1 (u, v) + bF2 (u, v)
only for
M + v0 y N )
continuous 3) Translation f ( x, y) e j 2 p(u0 x ⇔ F (u − u0 , v − v0 )
variables. They (general)
f ( x − x0 , y − y0 ) ⇔ F (u, v) e − j 2 p(ux0 M + vy0 N )
can be used with
discrete variables
4) Translation f ( x, y)(−1)x + y ⇔ F (u − M 2 , v − N 2)
by sampling the
continuous to center of
the frequency f ( x − M 2 , y − N 2) ⇔ F (u, v)(−1)u + v
expressions.
rectangle,
( M 2 , N 2)
5) Rotation f (r, u + u0 ) ⇔ F (v, w + u0 )
r= x 2 + y2 u = tan −1 ( y x) v = u2 + v2 w = tan −1 (v u)

6) Convolution f 夹 h)( x, y) ⇔ (F i H )(u, v)


theorem† ( f i h)( x, y) ⇔ (1 MN )[( F 夹 H )(u, v)]

7) Correlation ( f 夽 h)( x, y) ⇔ (F *i H )(u, v)


theorem† ( f *i h)( x, y) ⇔ (1 MN )[(F 夽 H )(u, v)]

8) Discrete unit d( x, y) ⇔ 1
impulse 1 ⇔ MNd(u, v)
sin(pua) sin(pvb) − jp( ua + vb)
9) Rectangle rec [ a, b] ⇔ ab e
(pua) (pvb)

jMN
10) Sine sin( 2pu0 x M + 2pv0 y N ) ⇔
2
[d(u + u0 , v + v0 ) − d(u − u0 , v − v0 )]
1
11) Cosine cos(2pu0 x M + 2pv0 y N ) ⇔
2
[d(u + u0 , v + v0 ) + d(u − u0 , v − v0 )]
The following Fourier transform pairs are derivable only for continuous variables, denoted
as before by t and z for spatial variables and by m and n for frequency variables. These
results can be used for DFT work by sampling the continuous forms.
12) Differentiation ∂ m ∂ n
(the expressions a b a b f (t , z) ⇔ ( j 2pm) ( j 2pn) F (m, n)
m n
∂t ∂z
on the right
assume that ∂ m f (t , z) ∂ n f (t , z)
⇔ ( j 2pm)m F (m, n); ⇔ ( j 2pn)n F (m, n)
f (± , ± ) = 0 . ∂t m
∂z m
2 2
( t 2 + z2 ) 2
+ n2 ) 2 s 2
13) Gaussian A2ps 2 e −2 p s ⇔ Ae −( m ( A is a constant)


Assumes that f ( x, y) and h( x, y) have been properly padded. Convolution is associative, commutative, and
distributive. Correlation is distributive (see Table 3.5). The products are elementwise products (see Section 2.6).

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 259 6/16/2017 2:05:34 PM


260 Chapter 4 Filtering in the Frequency Domain

4.7 THE BASICS OF FILTERING IN THE FREQUENCY DOMAIN


4.7

In this section, we lay the groundwork for all the filtering techniques discussed in the
remainder of the chapter.

ADDITIONAL CHARACTERISTICS OF THE FREQUENCY DOMAIN


We begin by observing in Eq. (4-67) that each term of F(u, v) contains all values of
f ( x, y), modified by the values of the exponential terms. Thus, with the exception
of trivial cases, it is usually impossible to make direct associations between specific
components of an image and its transform. However, some general statements can
be made about the relationship between the frequency components of the Fourier
transform and spatial features of an image. For instance, because frequency is direct-
ly related to spatial rates of change, it is not difficult intuitively to associate frequen-
cies in the Fourier transform with patterns of intensity variations in an image. We
showed in Section 4.6 that the slowest varying frequency component (u = v = 0)
is proportional to the average intensity of an image. As we move away from the
origin of the transform, the low frequencies correspond to the slowly varying inten-
sity components of an image. In an image of a room, for example, these might cor-
respond to smooth intensity variations on the walls and floor. As we move further
away from the origin, the higher frequencies begin to correspond to faster and faster
intensity changes in the image. These are the edges of objects and other components
of an image characterized by abrupt changes in intensity.
Filtering techniques in the frequency domain are based on modifying the Fourier
transform to achieve a specific objective, and then computing the inverse DFT to get
us back to the spatial domain, as introduced in Section 2.6. It follows from Eq. (4-87)
that the two components of the transform to which we have access are the transform
magnitude (spectrum) and the phase angle. We learned in Section 4.6 that visual
analysis of the phase component generally is not very useful. The spectrum, however,
provides some useful guidelines as to the gross intensity characteristics of the image
from which the spectrum was generated. For example, consider Fig. 4.28(a), which
is a scanning electron microscope image of an integrated circuit, magnified approxi-
mately 2500 times.
Aside from the interesting construction of the device itself, we note two principal
features in this image: strong edges that run approximately at ± 45°, and two white,
oxide protrusions resulting from thermally induced failure. The Fourier spectrum
in Fig. 4.28(b) shows prominent components along the ± 45° directions that corre-
spond to the edges just mentioned. Looking carefully along the vertical axis in Fig.
4.28(b), we see a vertical component of the transform that is off-axis, slightly to the
left. This component was caused by the edges of the oxide protrusions. Note how the
angle of the frequency component with respect to the vertical axis corresponds to
the inclination (with respect to the horizontal axis of the image) of the long white
element. Note also the zeros in the vertical frequency component, corresponding to
the narrow vertical span of the oxide protrusions.
These are typical of the types of associations we can make in general between
the frequency and spatial domains. As we will show later in this chapter, even these
types of gross associations, coupled with the relationships mentioned previously

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 260 6/16/2017 2:05:34 PM


4.7 The Basics of Filtering in the Frequency Domain 261

a b
FIGURE 4.28 (a) SEM image of a damaged integrated circuit. (b) Fourier spectrum of (a).
(Original image courtesy of Dr. J. M. Hudak, Brockhouse Institute for Materials Research,
McMaster University, Hamilton, Ontario, Canada.)

between frequency content and rate of change of intensity levels in an image, can
lead to some very useful results. We will show in Section 4.8 the effects of modifying
various frequency ranges in the transform of Fig. 4.28(a).

FREQUENCY DOMAIN FILTERING FUNDAMENTALS


Filtering in the frequency domain consists of modifying the Fourier transform of an
image, then computing the inverse transform to obtain the spatial domain represen-
tation of the processed result. Thus, given (a padded) digital image, f ( x, y), of size
P × Q pixels, the basic filtering equation in which we are interested has the form:
If H is real and

{ }
symmetric and f is real
(as is typically the case), g( x, y) = Real ᑣ−1 [ H (u, v)F (u, v)] (4-104)
then the IDFT in Eq.
(4-104) should yield

where ᑣ−1 is the IDFT, F(u, v) is the DFT of the input image, f ( x, y), H(u, v) is a
real quantities in theory.
In practice, the inverse
often contains para- filter transfer function (which we often call just a filter or filter function), and g( x, y)
sitic complex terms from
roundoff error and other is the filtered (output) image. Functions F, H, and g are arrays of size P × Q, the same
computational inaccura- as the padded input image. The product H (u, v)F (u, v) is formed using elementwise
cies. Thus, it is customary
to take the real part of multiplication, as defined in Section 2.6. The filter transfer function modifies the
the IDFT to form g.
transform of the input image to yield the processed output, g( x, y). The task of speci-
fying H(u, v) is simplified considerably by using functions that are symmetric about
their center, which requires that F(u, v) be centered also. As explained in Section 4.6,
this is accomplished by multiplying the input image by (−1)x + y prior to computing
its transform.†


Some software implementations of the 2-D DFT (e.g., MATLAB) do not center the transform. This implies
that filter functions must be arranged to correspond to the same data format as the uncentered transform (i.e.,
with the origin at the top left). The net result is that filter transfer functions are more difficult to generate and
display. We use centering in our discussions to aid in visualization, which is crucial in developing a clear under-
standing of filtering concepts. Either method can be used in practice, provided that consistency is maintained.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 261 6/16/2017 2:05:36 PM


262 Chapter 4 Filtering in the Frequency Domain

We are now in a position to consider filtering in detail. One of the simplest filter
transfer functions we can construct is a function H(u, v) that is 0 at the center of
the (centered) transform, and 1’s elsewhere. This filter would reject the dc term and
“pass” (i.e., leave unchanged) all other terms of F(u, v) when we form the product
H (u, v)F (u, v). We know from property 7 in Table 4.3 that the dc term is responsible
for the average intensity of an image, so setting it to zero will reduce the average
intensity of the output image to zero. Figure 4.29 shows the result of this operation
using Eq. (4-104). As expected, the image became much darker. An average of zero
implies the existence of negative intensities. Therefore, although it illustrates the
principle, Fig. 4.29 is not a true representation of the original, as all negative intensi-
ties were clipped (set to 0) by the display.
As noted earlier, low frequencies in the transform are related to slowly varying
intensity components in an image, such as the walls of a room or a cloudless sky in
an outdoor scene. On the other hand, high frequencies are caused by sharp transi-
tions in intensity, such as edges and noise. Therefore, we would expect that a func-
tion H(u, v) that attenuates high frequencies while passing low frequencies (called a
lowpass filter, as noted before) would blur an image, while a filter with the opposite
property (called a highpass filter) would enhance sharp detail, but cause a reduction
in contrast in the image. Figure 4.30 illustrates these effects. For example, the first
column of this figure shows a lowpass filter transfer function and the corresponding
filtered image. The second column shows similar results for a highpass filter. Note
the similarity between Figs. 4.30(e) and Fig. 4.29. The reason is that the highpass
filter function shown eliminates the dc term, resulting in the same basic effect that
led to Fig. 4.29. As illustrated in the third column, adding a small constant to the
filter does not affect sharpening appreciably, but it does prevent elimination of the
dc term and thus preserves tonality.
Equation (4-104) involves the product of two functions in the frequency domain
which, by the convolution theorem, implies convolution in the spatial domain. We
know from the discussion in Section 4.6 that we can expect wraparound error if
the functions in question are not padded. Figure 4.31 shows what happens when

FIGURE 4.29
Result of filter-
ing the image in
Fig. 4.28(a) with
a filter transfer
function that sets
to 0 the dc term,
F (P 2 , Q 2),
in the centered
Fourier transform,
while leaving all
other transform
terms unchanged.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 262 6/16/2017 2:05:36 PM


4.7 The Basics of Filtering in the Frequency Domain 263

H (u, v)
H (u, v)
H (u, v)

M/ 2 N/ 2
M/ 2 N/ 2 M/2 N/ 2
u
v a
u v u
v

a b c
d e f
FIGURE 4.30 Top row: Frequency domain filter transfer functions of (a) a lowpass filter, (b) a highpass filter, and (c)
an offset highpass filter. Bottom row: Corresponding filtered images obtained using Eq. (4-104). The offset in (c) is
a = 0.85, and the height of H(u, v) is 1. Compare (f) with Fig. 4.28(a).

a b c
FIGURE 4.31 (a) A simple image. (b) Result of blurring with a Gaussian lowpass filter without padding. (c) Result of
lowpass filtering with zero padding. Compare the vertical edges in (b) and (c).

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 263 6/16/2017 2:05:44 PM


264 Chapter 4 Filtering in the Frequency Domain

we apply Eq. (4-104) without padding. Figure 4.31(a) shows a simple image, and
Fig. 4.31(b) is the result of lowpass filtering the image with a Gaussian lowpass filter
of the form shown in Fig. 4.30(a). As expected, the image is blurred. However, the
blurring is not uniform; the top white edge is blurred, but the sides are not. Pad-
ding the input image with zeros according to Eqs. (4-98) and (4-99) before applying
Eq. (4-104) resulted in the filtered image in Fig. 4.31(c). This result is as expected,
with a uniform dark border resulting from zero padding (see Fig. 3.33 for an expla-
nation of this effect).
Figure 4.32 illustrates the reason for the discrepancy between Figs. 4.31(b) and (c).
The dashed area in Fig. 4.32(a) corresponds to the image in Fig. 4.31(a). The other
copies of the image are due to the implied periodicity of the image (and its trans-
form) implicit when we use the DFT, as explained in Section 4.6. Imagine convolving
the spatial representation of the blurring filter (i.e., the corresponding spatial ker-
nel) with this image. When the kernel is centered on the top of the dashed image, it
will encompass part of the image and also part of the bottom of the periodic image
immediately above it. When a dark and a light region reside under the filter, the
result is a mid-gray, blurred output. However, when the kernel is centered on the top
right side of the image, it will encompass only light areas in the image and its right
region. Because the average of a constant value is that same value, filtering will have
no effect in this area, giving the result in Fig. 4.31(b). Padding the image with 0’s cre-
ates a uniform border around each image of the periodic sequence, as Fig. 4.32(b)
shows. Convolving the blurring kernel with the padded “mosaic” of Fig. 4.32(b) gives
the correct result in Fig. 4.31(c). You can see from this example that failure to pad an
image prior to filtering can lead to unexpected results.
Thus far, the discussion has centered on padding the input image. However,
Eq. (4-104) also involves a filter transfer function that can be specified either in the

a b
FIGURE 4.32 (a) Image periodicity without image padding. (b) Periodicity after padding with 0’s (black). The dashed
areas in the center correspond to the image in Fig. 4.31(a). Periodicity is inherent when using the DFT. (The thin
white lines in both images are superimposed for clarity; they are not part of the data.)

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 264 6/16/2017 2:05:46 PM


4.7 The Basics of Filtering in the Frequency Domain 265

spatial or in the frequency domain. But padding is done in the spatial domain, which
raises an important question about the relationship between spatial padding and
filter functions specified directly in the frequency domain.
It would be reasonable to conclude that the way to handle padding of a frequency
domain transfer function is to construct the function the same size as the unpad-
ded image, compute the IDFT of the function to obtain the corresponding spatial
representation, pad that representation in the spatial domain, and then compute its
DFT to return to the frequency domain. The 1-D example in Fig. 4.33 illustrates the
pitfalls in this approach.
Figure 4.33(a) shows a 1-D ideal lowpass filter transfer function in the frequency
domain. The function is real and has even symmetry, so we know from property 8
in Table 4.1 that its IDFT will be real and symmetric also. Figure 4.33(b) shows the
result of multiplying the elements of the transfer function by (−1)u and computing
Padding the two ends of
its IDFT to obtain the corresponding spatial filter kernel. The result is shown in
a function is the same Fig. 4.33(b). It is evident in this figure that the extremes of this spatial function are
as padding one end,
provided that the total
not zero. Zero-padding the function would create two discontinuities, as Fig. 4.33(c)
number of zeros is the shows. To return to the frequency domain, we compute the forward DFT of the
same.
spatial, padded function. As Fig. 4.33(d) shows, the discontinuities in the padded
function caused ringing in its frequency domain counterpart.

a c 1.2 0.04
b d
1
FIGURE 4.33 0.03
(a) Filter transfer 0.8
function specified in
the (centered) 0.6 0.02
frequency domain.
(b) Spatial 0.4 0.01
representation (filter
kernel) obtained by 0.2
computing the IDFT 0
of (a). 0
(c) Result of
padding (b) to twice 0.2 0.01
0 128 255 0 128 256 384 511
its length (note the
0.04 1.2
discontinuities).
(d) Corresponding
1
filter in the frequen- 0.03
cy domain obtained 0.8
by computing the
DFT of (c). Note the 0.02 0.6
ringing caused by
the discontinuities 0.4
in (c). Part (b) of the 0.01
figure is below (a), 0.2
and (d) is below (c). 0
0

0.01 0.2
0 128 255 0 128 256 384 511

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 265 6/16/2017 2:05:46 PM


266 Chapter 4 Filtering in the Frequency Domain

The preceding results tell us that we cannot pad the spatial representation of a
frequency domain transfer function in order to avoid wraparound error. Our objec-
tive is to work with specified filter shapes in the frequency domain without having to
be concerned with truncation issues. An alternative is to pad images and then create
the desired filter transfer function directly in the frequency domain, this function
being of the same size as the padded images (remember, images and filter transfer
functions must be of the same size when using the DFT). Of course, this will result
in wraparound error because no padding is used for the filter transfer function, but
this error is mitigated significantly by the separation provided by padding the image,
and it is preferable to ringing. Smooth transfer functions (such as those in Fig. 4.30)
present even less of a problem. Specifically, then, the approach we will follow in this
chapter is to pad images to size P × Q and construct filter transfer functions of the
same dimensions directly in the frequency domain. As explained earlier, P and Q
are given by Eqs. (4-100) and (4-101).
We conclude this section by analyzing the phase angle of filtered images. We can
express the DFT in terms of its real and imaginary parts: F (u, v) = R(u, v) + jI (u, v).
Equation (4-104) then becomes

g( x, y) = ᑣ−1 [ H (u, v)R(u, v) + jH (u, v)I (u, v)] (4-105)

The phase angle is computed as the arctangent of the ratio of the imaginary and the
real parts of a complex number [see Eq. (4-88)]. Because H(u, v) multiplies both
R and I, it will cancel out when this ratio is formed. Filters that affect the real and
imaginary parts equally, and thus have no effect on the phase angle, are appropri-
ately called zero-phase-shift filters. These are the only types of filters considered in
this chapter.
The importance of the phase angle in determining the spatial structure of an
image was vividly illustrated in Fig. 4.26. Thus, it should be no surprise that even
small changes in the phase angle can have dramatic (and usually undesirable) effects
on the filtered output. Figures 4.34(b) and (c) illustrate the effect of changing the
phase angle array of the DFT of Fig. 4.34(a) (the F(u, v) term was not changed in
either case). Figure 4.34(b) was obtained by multiplying the phase angle, f(u, v), in
Eq. (4-86) by −1 and computing the IDFT. The net result is a reflection of every pixel
in the image about both coordinate axes. Figure 4.34(c) was obtained by multiply-
ing the phase term by 0.25 and computing the IDFT. Even a scale change rendered
the image almost unrecognizable. These two results illustrate the advantage of using
frequency-domain filters that do not alter the phase angle.

SUMMARY OF STEPS FOR FILTERING IN THE FREQUENCY DOMAIN


The process of filtering in the frequency domain can be summarized as follows:

1. Given an input image f ( x, y) of size M × N , obtain the padding sizes P and Q


using Eqs. (4-102) and (4-103); that is, P = 2 M and Q = 2 N .

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 266 6/16/2017 2:05:47 PM


4.7 The Basics of Filtering in the Frequency Domain 267

a b c
FIGURE 4.34 (a) Original image. (b) Image obtained by multiplying the phase angle array by −1 in Eq. (4-86) and
computing the IDFT. (c) Result of multiplying the phase angle by 0.25 and computing the IDFT. The magnitude of
the transform, F(u, v) , used in (b) and (c) was the same.

2. Form a padded† image f p ( x, y) of size P × Q using zero-, mirror-, or replicate


padding (see Fig. 3.39 for a comparison of padding methods).
3. Multiply f p ( x, y) by (−1)x + y to center the Fourier transform on the P × Q fre-
quency rectangle.
4. Compute the DFT, F(u, v), of the image from Step 3.
5. Construct a real, symmetric filter transfer function, H(u, v), of size P × Q with
center at (P 2 , Q 2).
See Section 2.6 for a
6. Form the product G(u, v) = H (u, v)F (u, v) using elementwise multiplication; that
definition of elementwise is, G(i, k ) = H (i, k )F (i, k ) for i = 0, 1, 2, … , M − 1 and k = 0, 1, 2, … , N − 1.
operations.
7. Obtain the filtered image (of size P × Q) by computing the IDFT of G(u, v) :

g p ( x, y) = Qreal ⎡⎣ᑣ−1 {G(u, v)}⎤⎦ R(−1)x + y

8. Obtain the final filtered result, g( x, y), of the same size as the input image, by
extracting the M × N region from the top, left quadrant of g p ( x, y).

We will discuss the construction of filter transfer functions (Step 5) in the following
sections of this chapter. In theory, the IDFT in Step 7 should be real because f ( x, y)
is real and H(u, v) is real and symmetric. However, parasitic complex terms in the
IDFT resulting from computational inaccuracies are not uncommon. Taking the real
part of the result takes care of that. Multiplication by (−1)x + y cancels out the multi-
plication by this factor in Step 3.


Sometimes we omit padding when doing “quick” experiments to get an idea of filter performance, or when
trying to determine quantitative relationships between spatial features and their effect on frequency domain
components, particularly in band and notch filtering, as explained later in Section 4.10 and in Chapter 5.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 267 6/16/2017 2:05:50 PM


268 Chapter 4 Filtering in the Frequency Domain

a b c
d e f
g h
FIGURE 4.35
(a) An M × N
image, f .
(b) Padded image,
f p of size P × Q.
(c) Result of
multiplying f p by
(−1)x + y .
(d) Spectrum of
F. (e) Centered
Gaussian lowpass
filter transfer
function, H, of size
P × Q.
(f) Spectrum of
the product HF.
(g) Image g p , the
real part of the
IDFT of HF, mul-
tiplied by (−1)x + y .
(h) Final result,
g, obtained by
extracting the first
M rows and N
columns of g p .

Figure 4.35 illustrates the preceding steps using zero padding. The figure legend
explains the source of each image. If enlarged, Fig. 4.35(c) would show black dots
interleaved in the image because negative intensities, resulting from the multiplica-
tion of f p by (−1)x + y , are clipped at 0 by the display. Note in Fig. 4.35(h) the charac-
teristic dark border of by lowpass filtered images obtained using zero padding.

CORRESPONDENCE BETWEEN FILTERING IN THE SPATIAL AND


FREQUENCY DOMAINS
As mentioned several times before, the link between filtering in the spatial and fre-
quency domains is the convolution theorem. Earlier in this section, we defined fil-
See Section 2.6 for a
tering in the frequency domain as the elementwise product of a filter transfer func-
definition of elementwise tion, H(u, v), and F(u, v), the Fourier transform of the input image. Given H(u, v),
operations. suppose that we want to find its equivalent kernel in the spatial domain. If we let
f ( x, y) = d( x, y), it follows from Table 4.4 that F(u, v) = 1. Then, from Eq. (4-104),
the filtered output is ᑣ−1{H(u, v)} . This expression as the inverse transform of the
frequency domain filter transfer function, which is the corresponding kernel in the

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 268 6/16/2017 2:05:53 PM


4.7 The Basics of Filtering in the Frequency Domain 269

spatial domain. Conversely, it follows from a similar analysis and the convolution
theorem that, given a spatial filter kernel, we obtain its frequency domain repre-
sentation by taking the forward Fourier transform of the kernel. Therefore, the two
filters form a Fourier transform pair:

h( x, y) ⇔ H (u, v) (4-106)

where h( x, y) is the spatial kernel. Because this kernel can be obtained from the
response of a frequency domain filter to an impulse, h( x, y) sometimes is referred to
as the impulse response of H(u, v). Also, because all quantities in a discrete imple-
mentation of Eq. (4-106) are finite, such filters are called finite impulse response
(FIR) filters. These are the only types of linear spatial filters considered in this book.
We discussed spatial convolution in Section 3.4, and its implementation in
Eq. (3-35), which involved convolving functions of different sizes. When we use the
DFT to compute the transforms used in the convolution theorem, it is implied that
we are convolving periodic functions of the same size, as explained in Fig. 4.27. For
this reason, as explained earlier, Eq. (4-94) is referred to as circular convolution.
When computational speed, cost, and size are important parameters, spatial con-
volution filtering using Eq. (3-35) is well suited for small kernels using hardware
and/or firmware, as explained in Section 4.1. However, when working with general-
purpose machines, frequency-domain methods in which the DFT is computed using
a fast Fourier transform (FFT) algorithm can be hundreds of times faster than using
spatial convolution, depending on the size of the kernels used, as you saw in Fig. 4.2.
We will discuss the FFT and its computational advantages in Section 4.11.
Filtering concepts are more intuitive in the frequency domain, and filter design
often is easier there. One way to take advantage of the properties of both domains
is to specify a filter in the frequency domain, compute its IDFT, and then use the
properties of the resulting, full-size spatial kernel as a guide for constructing smaller
kernels. This is illustrated next (keep in mind that the Fourier transform and its
inverse are linear processes (see Problem 4.24), so the discussion is limited to linear
filtering). In Example 4.15, we illustrate the converse, in which a spatial kernel is
given, and we obtain its full-size frequency domain representation. This approach is
useful for analyzing the behavior of small spatial kernels in the frequency domain.
Frequency domain filters can be used as guides for specifying the coefficients of
some of the small kernels we discussed in Chapter 3. Filters based on Gaussian func-
tions are of particular interest because, as noted in Table 4.4, both the forward and
inverse Fourier transforms of a Gaussian function are real Gaussian functions. We
limit the discussion to 1-D to illustrate the underlying principles. Two-dimensional
Gaussian transfer functions are discussed later in this chapter.
Let H (u) denote the 1-D frequency domain Gaussian transfer function

H (u ) = Ae −u
2
As mentioned in Table 2s 2
(4-107)
4.4, the forward and
inverse Fourier trans-
forms of Gaussians are where s is the standard deviation of the Gaussian curve. The kernel in the spatial
valid only for continuous
variables. To use discrete
domain is obtained by taking the inverse DFT of H (u) (see Problem 4.48):
formulations, we sample
h( x ) = 2ps A e −2 p s x
2 2 2
the continuous forms. (4-108)

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 269 6/16/2017 2:05:54 PM


270 Chapter 4 Filtering in the Frequency Domain

These two equations are important for two reasons: (1) They are a Fourier trans-
form pair, both components of which are Gaussian and real. This facilitates analysis
because we do not have to be concerned with complex numbers. In addition, Gauss-
ian curves are intuitive and easy to manipulate. (2) The functions behave recipro-
cally. When H (u) has a broad profile (large value of s), h( x) has a narrow profile,
and vice versa. In fact, as s approaches infinity, H (u) tends toward a constant func-
tion and h( x) tends toward an impulse, which implies no filtering in either domain.
Figures 4.36(a) and (b) show plots of a Gaussian lowpass filter transfer function
in the frequency domain and the corresponding function in the spatial domain. Sup-
pose that we want to use the shape of h( x) in Fig. 4.36(b) as a guide for specifying
the coefficients of a small kernel in the spatial domain. The key characteristic of the
function in Fig. 4.36(b) is that all its values are positive. Thus, we conclude that we
can implement lowpass filtering in the spatial domain by using a kernel with all posi-
tive coefficients (as we did in Section 3.5). For reference, Fig. 4.36(b) also shows two
of the kernels discussed in that section. Note the reciprocal relationship between
the width of the Gaussian functions, as discussed in the previous paragraph. The nar-
rower the frequency domain function, the more it will attenuate the low frequencies,
resulting in increased blurring. In the spatial domain, this means that a larger kernel
must be used to increase blurring, as we illustrated in Example 3.11.
As you know from Section 3.7, we can construct a highpass filter from a lowpass
filter by subtracting a lowpass function from a constant. We working with Gauss-
ian functions, we can gain a little more control over filter function shape by using
a so-called difference of Gaussians, which involves two lowpass functions. In the
frequency domain, this becomes
2
/ 2 s12 2
/ 2 s 22
H (u) = Ae − u − B e−u (4-109)

with A ≥ B and s1 > s 2 . The corresponding function in the spatial domain is

a c H (u) H(u)
b d
FIGURE 4.36
(a) A 1-D Gaussian
lowpass transfer
function in the
frequency domain.
(b) Corresponding
kernel in the spatial u u
domain. (c) Gauss- h (x) h (x)
ian highpass trans-
fer function in the 1
1 1 1 1 1 1
––  1 1 1 1 8 1
frequency domain. 9
1 1 1 1 1 1
(d) Corresponding 1 2 1 0 1 0
1
kernel. The small ––  2
16
4 2 1 4 1
1 2 1 0 1 0
2-D kernels shown
are kernels we used x x
in Chapter 3.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 270 6/16/2017 2:05:55 PM


4.7 The Basics of Filtering in the Frequency Domain 271

2 2 2 2 2 2
h( x) = 2ps1 Ae −2 p s1 x − 2ps 2 Be −2 p s2 x (4-110)

Figures 4.36(c) and (d) show plots of these two equations. We note again the reci-
procity in width, but the most important feature here is that h( x) has a positive cen-
ter term with negative terms on either side. The small kernels shown in Fig. 4.36(d),
which we used in Chapter 3 for sharpening, “capture” this property, and thus illus-
trate how knowledge of frequency domain filtering can be used as the basis for
choosing coefficients of spatial kernels.
Although we have gone through significant effort to get here, be assured that it is
impossible to truly understand filtering in the frequency domain without the foun-
dation we have just established. In practice, the frequency domain can be viewed as
a “laboratory” in which we take advantage of the correspondence between frequen-
cy content and image appearance. As will be demonstrated numerous times later in
this chapter, some tasks that would be exceptionally difficult to formulate direct-
ly in the spatial domain become almost trivial in the frequency domain. Once we
have selected a specific filter transfer function via experimentation in the frequency
domain, we have the option of implementing the filter directly in that domain using
the FFT, or we can take the IDFT of the transfer function to obtain the equivalent
spatial domain function. As we showed in Fig. 4.36, one approach is to specify a
small spatial kernel that attempts to capture the “essence” of the full filter function
in the spatial domain. A more formal approach is to design a 2-D digital filter by
using approximations based on mathematical or statistical criteria, as we discussed
in Section 3.7.

EXAMPLE 4.15 : Obtaining a frequency domain transfer function from a spatial kernel.
In this example, we start with a spatial kernel and show how to generate its corresponding filter trans-
fer function in the frequency domain. Then, we compare the filtering results obtained using frequency
domain and spatial techniques. This type of analysis is useful when one wishes to compare the perfor-
mance of a given kernel against one or more “full” filter candidates in the frequency domain, or to gain a
deeper understanding about the performance of a kernel in the spatial domain. To keep matters simple,
we use the 3 × 3 vertical Sobel kernel from Fig. 3.50(e). Figure 4.37(a) shows a 600 × 600-pixel image,
f ( x, y), that we wish to filter, and Fig. 4.37(b) shows its spectrum.
Figure 4.38(a) shows the Sobel kernel, h( x, y) (the perspective plot is explained below). Because
the input image is of size 600 × 600 pixels and the kernel is of size 3 × 3, we avoid wraparound error in
the frequency domain by padding f and h with zeros to size 602 × 602 pixels, according to Eqs. (4-100)
and (4-101). At first glance, the Sobel kernel appears to exhibit odd symmetry. However, its first element
is not 0, as required by Eq. (4-81). To convert the kernel to the smallest size that will satisfy Eq. (4-83),
we have to add to it a leading row and column of 0’s, which turns it into an array of size 4 × 4. We can
embed this array into a larger array of zeros and still maintain its odd symmetry if the larger array is of
even dimensions (as is the 4 × 4 kernel) and their centers coincide, as explained in Example 4.10. The
preceding comments are an important aspect of filter generation. If we preserve the odd symmetry with
respect to the padded array in forming hp ( x, y), we know from property 9 in Table 4.1 that H(u, v) will
be purely imaginary. As we show at the end of this example, this will yield results that are identical to
filtering the image spatially using the original kernel h( x, y). If the symmetry were not preserved, the
results would no longer be the same.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 271 6/16/2017 2:05:56 PM


272 Chapter 4 Filtering in the Frequency Domain

a b
FIGURE 4.37
(a) Image of a
building, and
(b) its Fourier
spectrum.

The procedure used to generate H(u, v) is: (1) multiply hp ( x, y) by (−1)x + y to center the frequency
domain filter; (2) compute the forward DFT of the result in (1) to generate H(u, v); (3) set the real
part of H(u, v) to 0 to account for parasitic real parts (we know that H has to be purely imaginary
because hp is real and odd); and (4) multiply the result by (−1)u + v . This last step reverses the multiplica-
tion of H(u, v) by (−1)u + v , which is implicit when h( x, y) was manually placed in the center of hp ( x, y).
Figure 4.38(a) shows a perspective plot of H(u, v), and Fig. 4.38(b) shows H(u, v) as an image. Note
the antisymmetry in this image about its center, a result of H(u, v) being odd. Function H(u, v) is used
as any other frequency domain filter transfer function. Figure 4.38(c) is the result of using the filter
transfer function just obtained to filter the image in Fig. 4.37(a) in the frequency domain, using the step-
by-step filtering procedure outlined earlier. As expected from a derivative filter, edges were enhanced
and all the constant intensity areas were reduced to zero (the grayish tone is due to scaling for display).
Figure 4.38(d) shows the result of filtering the same image in the spatial domain with the Sobel kernel
h( x, y), using the procedure discussed in Section 3.6. The results are identical.

4.8 IMAGE SMOOTHING USING LOWPASS FREQUENCY DOMAIN


4.8
FILTERS
The remainder of this chapter deals with various filtering techniques in the frequency
domain, beginning with lowpass filters. Edges and other sharp intensity transitions
(such as noise) in an image contribute significantly to the high frequency content
of its Fourier transform. Hence, smoothing (blurring) is achieved in the frequency
domain by high-frequency attenuation; that is, by lowpass filtering. In this section,
we consider three types of lowpass filters: ideal, Butterworth, and Gaussian. These
three categories cover the range from very sharp (ideal) to very smooth (Gaussian)
filtering. The shape of a Butterworth filter is controlled by a parameter called the
filter order. For large values of this parameter, the Butterworth filter approaches
the ideal filter. For lower values, the Butterworth filter is more like a Gaussian filter.
Thus, the Butterworth filter provides a transition between two “extremes.” All filter-
ing in this section follows the procedure outlined in the previous section, so all filter
transfer functions, H(u, v), are understood to be of size P × Q; that is, the discrete

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 272 6/16/2017 2:05:58 PM


4.8 Image Smoothing Using Lowpass Frequency Domain Filters 273

a b
1 0 1
c d
FIGURE 4.38 2 0 2
(a) A spatial
kernel and per- 1 0 1
spective plot of
its corresponding
frequency domain
filter transfer
function.
(b) Transfer
function shown as
an image.
(c) Result of
filtering
Fig. 4.37(a) in the
frequency domain
with the transfer
function in (b).
(d) Result of
filtering the same
image in the
spatial domain
with the kernel
in (a). The results
are identical.

frequency variables are in the range u = 0, 1, 2, … , P − 1 and v = 0, 1, 2, … , Q − 1,


where P and Q are the padded sizes given by Eqs. (4-100) and (4-101).

IDEAL LOWPASS FILTERS


A 2-D lowpass filter that passes without attenuation all frequencies within a circle of
radius from the origin, and “cuts off” all frequencies outside this, circle is called an
ideal lowpass filter (ILPF); it is specified by the transfer function

⎧1 if D(u, v) ≤ D0
H (u, v) = ⎨ (4-111)
⎩0 if D(u, v) > D0

where D0 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 P × Q frequency rectangle; that is,
1/ 2
D(u, v) = ⎡( u − P 2 ) + ( v − Q 2 ) ⎤
2 2
(4-112)
⎣ ⎦

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 273 6/16/2017 2:06:01 PM


274 Chapter 4 Filtering in the Frequency Domain
H (u, v) v H (u, v)

u
v
D (u, v)
D0
u
a b c
FIGURE 4.39 (a) Perspective plot of an ideal lowpass-filter transfer function. (b) Function displayed as an image.
(c) Radial cross section.

where, as before, P and Q are the padded sizes from Eqs. (4-102) and (4-103).
Figure 4.39(a) shows a perspective plot of transfer function H(u, v) and Fig. 4.39(b)
shows it displayed as an image. As mentioned in Section 4.3, the name ideal indicates
that all frequencies on or inside a circle of radius D0 are passed without attenuation,
whereas all frequencies outside the circle are completely attenuated (filtered out).
The ideal lowpass filter transfer function is radially symmetric about the origin. This
means that it is defined completely by a radial cross section, as Fig. 4.39(c) shows. A
2-D representation of the filter is obtained by rotating the cross section 360°.
For an ILPF cross section, the point of transition between the values H(u, v) = 1
and H(u, v) = 0 is called the cutoff frequency. In Fig. 4.39, the cutoff frequency is D0 .
The sharp cutoff frequency of an ILPF cannot be realized with electronic compo-
nents, although they certainly can be simulated in a computer (subject to the con-
strain that the fastest possible transition is limited by the distance between pixels).
The lowpass filters in this chapter are compared by studying their behavior as a
function of the same cutoff frequencies. One way to establish standard cutoff fre-
quency loci using circles that enclose specified amounts of total image power PT ,
which we obtain by summing the components of the power spectrum of the padded
images at each point (u, v), for u = 0, 1, 2, … , P − 1 and v = 0, 1, 2, … , Q − 1; that is,
P −1 Q −1
PT = ∑ ∑ P(u, v)
u=0 v=0
(4-113)

where P(u, v) is given by Eq. (4-89). If the DFT has been centered, a circle of radius
D0 with origin at the center of the frequency rectangle encloses a percent of the
power, where
⎡ ⎤
a = 100 ⎢∑ ∑ P(u, v) PT ⎥ (4-114)
⎣u v ⎦
and the summation is over values of (u, v) that lie inside the circle or on its boundary.
Figures 4.40(a) and (b) show a test pattern image and its spectrum. The cir-
cles superimposed on the spectrum have radii of 10, 30, 60, 160, and 460 pixels,

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 274 6/16/2017 2:06:04 PM


4.8 Image Smoothing Using Lowpass Frequency Domain Filters 275

a b
FIGURE 4.40 (a) Test pattern of size 688 × 688 pixels, and (b) its spectrum. The spectrum is dou-
ble the image size as a result of padding, but is shown half size to fit. The circles have radii of
10, 30, 60, 160, and 460 pixels with respect to the full-size spectrum. The radii enclose 86.9, 92.8,
95.1, 97.6, and 99.4% of the padded image power, respectively.

respectively, and enclosed the percentages of total power listed in the figure caption.
The spectrum falls off rapidly, with close to 87% of the total power being enclosed
by a relatively small circle of radius 10. The significance of this will become evident
in the following example.

EXAMPLE 4.16 : Image smoothing in the frequency domain using lowpass filters.
Figure 4.41 shows the results of applying ILPFs with cutoff frequencies at the radii shown in Fig. 4.40(b).
Figure 4.41(b) is useless for all practical purposes, unless the objective of blurring is to eliminate all
detail in the image, except the “blobs” representing the largest objects. The severe blurring in this image
is a clear indication that most of the sharp detail information in the image is contained in the 13% power
removed by the filter. As the filter radius increases, less and less power is removed, resulting in less blur-
ring. Note that the images in Figs. 4.41(c) through (e) contain significant “ringing,” which becomes finer
in texture as the amount of high frequency content removed decreases. Ringing is visible even in the
image in which only 2% of the total power was removed [Fig. 4.41(e)]. This ringing behavior is a char-
acteristic of ideal filters, as we have mentioned several times before. Finally, the result for a = 99.4% in
Fig. 4.41(f) shows very slight blurring and almost imperceptible ringing but, for the most part, this image
is close to the original. This indicates that little edge information is contained in the upper 0.6% of the
spectrum power removed by the ILPF.
It is clear from this example that ideal lowpass filtering is not practical. However, it is useful to study
the behavior of ILPFs as part of our development of filtering concepts. Also, as shown in the discussion
that follows, some interesting insight is gained by attempting to explain the ringing property of ILPFs
in the spatial domain.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 275 6/16/2017 2:06:04 PM


276 Chapter 4 Filtering in the Frequency Domain

a b c
d e f
FIGURE 4.41 (a) Original image of size 688 × 688 pixels. (b)–(f) Results of filtering using ILPFs with cutoff frequencies
set at radii values 10, 30, 60, 160, and 460, as shown in Fig. 4.40(b). The power removed by these filters was 13.1, 7.2,
4.9, 2.4, and 0.6% of the total, respectively. We used mirror padding to avoid the black borders characteristic of zero
padding, as illustrated in Fig. 4.31(c).

The blurring and ringing properties of ILPFs can be explained using the convolu-
tion theorem. Figure 4.42(a) shows an image of a frequency-domain ILPF transfer
function of radius 15 and size 1000 × 1000 pixels. Figure 4.42(b) is the spatial repre-
sentation, h( x, y), of the ILPF, obtained by taking the IDFT of (a) (note the ringing).
Figure 4.42(c) shows the intensity profile of a line passing through the center of (b).
This profile resembles a sinc function.† Filtering in the spatial domain is done by
convolving the function in Fig. 4.42(b) with an image. Imagine each pixel in an image
as being a discrete impulse whose strength is proportional to the intensity of the
image at that location. Convolving this sinc-like function with an impulse copies (i.e.,
shifts the origin of) the function to the location of the impulse. That is, convolution

Although this profile resembles a sinc function, the transform of an ILPF is actually a Bessel function whose
derivation is beyond the scope of this discussion. The important point to keep in mind is that the inverse propor-
tionality between the “width” of the filter function in the frequency domain, and the “spread” of the width of the
lobes in the spatial function, still holds.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 276 6/16/2017 2:06:04 PM


4.8 Image Smoothing Using Lowpass Frequency Domain Filters 277

a b c
FIGURE 4.42
(a) Frequency
domain ILPF
transfer function.
(b) Corresponding
spatial domain
kernel function.
(c) Intensity profile
of a horizontal line
through the center
of (b).

makes a copy of the function in Fig. 4.42(b) centered on each pixel location in the
image. The center lobe of this spatial function is the principal cause of blurring, while
the outer, smaller lobes are mainly responsible for ringing. Because the “spread” of
the spatial function is inversely proportional to the radius of H(u, v), the larger D0
becomes (i,e, the more frequencies that are passed), the more the spatial function
approaches an impulse which, in the limit, causes no blurring at all when convolved
with the image. The converse happens as D0 becomes smaller. This type of recipro-
cal behavior should be routine to you by now. In the next two sections, we show that
it is possible to achieve blurring with little or no ringing, an important objective in
lowpass filtering.

GAUSSIAN LOWPASS FILTERS


Gaussian lowpass filter (GLPF) transfer functions have the form
2
( u,v )/ 2s 2
H (u, v) = e − D (4-115)

where, as in Eq. (4-112), D(u, v) is the distance from the center of the P × Q fre-
quency rectangle to any point, (u, v), contained by the rectangle. Unlike our earlier
expressions for Gaussian functions, we do not use a multiplying constant here in
order to be consistent with the filters discussed in this and later sections, whose
highest value is 1. As before, s is a measure of spread about the center. By letting
s = D0 , we can express the Gaussian transfer function in the same notation as other
functions in this section:
2
( u,v )/ 2 D02
H (u, v) = e − D (4-116)

where D0 is the cutoff frequency. When D(u, v) = D0 , the GLPF transfer function is
down to 0.607 of its maximum value of 1.0.
From Table 4.4, we know that the inverse Fourier transform of a frequency-
domain Gaussian function is Gaussian also. This means that a spatial Gaussian filter
kernel, obtained by computing the IDFT of Eq. (4-115) or (4-116), will have no
ringing. As property 13 of Table 4.4 shows, the same inverse relationship explained
earlier for ILPFs is true also of GLPFs. Narrow Gaussian transfer functions in the
frequency domain imply broader kernel functions in the spatial domain, and vice

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 277 6/16/2017 2:06:05 PM


278 Chapter 4 Filtering in the Frequency Domain

H (u, v) H (u, v)
v
1.0

D0  10
0.607 D0  20
D0  40
D0  60
u
v
0 D(u, v)
u
a b c
FIGURE 4.43 (a) Perspective plot of a GLPF transfer function. (b) Function displayed as an image. (c) Radial cross
sections for various values of D0 .

versa. Figure 4.43 shows a perspective plot, image display, and radial cross sections
of a GLPF transfer function.

EXAMPLE 4.17 : Image smoothing in the frequency domain using Gaussian lowpass filters.
Figure 4.44 shows the results of applying the GLPF of Eq. (4-116) to Fig. 4.44(a), with D0 equal to the five
radii in Fig. 4.40(b). Compared to the results obtained with an ILPF (Fig. 4.41), we note a smooth transi-
tion in blurring as a function of increasing cutoff frequency. The GLPF achieved slightly less smoothing
than the ILPF. The key difference is that we are assured of no ringing when using a GLPF. This is an
important consideration in practice, especially in situations in which any type of artifact is unacceptable,
as in medical imaging. In cases where more control of the transition between low and high frequencies
about the cutoff frequency are needed, the Butterworth lowpass filter discussed next presents a more
suitable choice. The price of this additional control over the filter profile is the possibility of ringing, as
you will see shortly.

BUTTERWORTH LOWPASS FILTERS


The transfer function of a Butterworth lowpass filter (BLPF) of order n, with cutoff
frequency at a distance D0 from the center of the frequency rectangle, is defined as

1
H (u, v) = (4-117)
1 + [ D(u, v) D0 ]
2n

where D(u, v) is given by Eq. (4-112). Figure 4.45 shows a perspective plot, image
display, and radial cross sections of the BLPF function. Comparing the cross section
plots in Figs. 4.39, 4.43, and 4.45, we see that the BLPF function can be controlled to
approach the characteristics of the ILPF using higher values of n, and the GLPF for
lower values of n, while providing a smooth transition in from low to high frequen-
cies. Thus, we can use a BLPF to approach the sharpness of an ILPF function with
considerably less ringing.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 278 6/16/2017 2:06:07 PM


4.8 Image Smoothing Using Lowpass Frequency Domain Filters 279

a b c
d e f
FIGURE 4.44 (a) Original image of size 688 × 688 pixels. (b)–(f) Results of filtering using GLPFs with cutoff frequen-
cies at the radii shown in Fig. 4.40. Compare with Fig. 4.41. We used mirror padding to avoid the black borders
characteristic of zero padding.

H (u, v) H (u, v)
v
1.0

n1
0.5 n2
n3
u n4
v
D(u, v)
D0
u
a b c
FIGURE 4.45 (a) Perspective plot of a Butterworth lowpass-filter transfer function. (b) Function displayed as an image.
(c) Radial cross sections of BLPFs of orders 1 through 4.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 279 6/16/2017 2:06:09 PM


280 Chapter 4 Filtering in the Frequency Domain

EXAMPLE 4.18 : Image smoothing using a Butterworth lowpass filter.

Figures 4.46(b)-(f) show the results of applying the BLPF of Eq. (4-117) to Fig. 4.46(a), with cutoff
frequencies equal to the five radii in Fig. 4.40(b), and with n = 2.25. The results in terms of blurring are
between the results obtained with using ILPFs and GLPFs. For example, compare Fig. 4.46(b), with
Figs. 4.41(b) and 4.44(b). The degree of blurring with the BLPF was less than with the ILPF, but more
than with the GLPF.

The kernels in Figs. 4.47(a) The spatial domain kernel obtainable from a BLPF of order 1 has no ringing.
through (d) were obtained Generally, ringing is imperceptible in filters of order 2 or 3, but can become sig-
using the procedure out-
lined in the explanation of nificant in filters of higher orders. Figure 4.47 shows a comparison between the spa-
Fig. 4.42. tial representation (i.e., spatial kernels) corresponding to BLPFs of various orders
(using a cutoff frequency of 5 in all cases). Shown also is the intensity profile along

a b c
d e f
FIGURE 4.46 (a) Original image of size 688 × 688 pixels. (b)–(f) Results of filtering using BLPFs with cutoff frequen-
cies at the radii shown in Fig. 4.40 and n = 2.25. Compare with Figs. 4.41 and 4.44. We used mirror padding to avoid
the black borders characteristic of zero padding.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 280 6/16/2017 2:06:09 PM


4.8 Image Smoothing Using Lowpass Frequency Domain Filters 281

a b c d
e f g h
FIGURE 4.47 (a)–(d) Spatial representations (i.e., spatial kernels) corresponding to BLPF transfer functions of size
1000 × 1000 pixels, cut-off frequency of 5, and order 1, 2, 5, and 20, respectively. (e)–(h) Corresponding intensity
profiles through the center of the filter functions.

a horizontal scan line through the center of each spatial kernel. The kernel corre-
sponding to the BLPF of order 1 [see Fig. 4.47(a)] has neither ringing nor negative
values. The kernel corresponding to a BLPF of order 2 does show mild ringing and
small negative values, but they certainly are less pronounced than would be the case
for an ILPF. As the remaining images show, ringing becomes significant for higher-
order filters. A BLPF of order 20 has a spatial kernel that exhibits ringing charac-
teristics similar to those of the ILPF (in the limit, both filters are identical). BLPFs
of orders 2 to 3 are a good compromise between effective lowpass filtering and
acceptable spatial-domain ringing. Table 4.5 summarizes the lowpass filter transfer
functions discussed in this section.

ADDITIONAL EXAMPLES OF LOWPASS FILTERING


In the following discussion, we show several practical applications of lowpass filter-
ing in the frequency domain. The first example is from the field of machine per-
ception with application to character recognition; the second is from the printing
and publishing industry; and the third is related to processing satellite and aerial
images. Similar results can be obtained using the lowpass spatial filtering techniques
discussed in Section 3.5. We use GLPFs in all examples for consistency, but simi-
lar results can be obtained using BLPFs. Keep in mind that images are padded to
double size for filtering, as indicated by Eqs. (4-102) and (4-103), and filter transfer
functions have to match padded-image size. The values of D0 used in the following
examples reflect this doubled filter size.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 281 6/16/2017 2:06:10 PM


282 Chapter 4 Filtering in the Frequency Domain

TABLE 4.5
Lowpass filter transfer functions. D0 is the cutoff frequency, and n is the order of the Butterworth filter.
Ideal Gaussian Butterworth

⎧1 if D(u, v) ≤ D0
H ( u, v) = e − D ( u,v) 2 D0
2 2
1
H (u, v) = ⎨ H (u, v) =
⎩0 if D(u, v) > D0 1 + [ D(u, v) D0 ]
2n

Figure 4.48 shows a sample of text of low resolution. One encounters text like
this, for example, in fax transmissions, duplicated material, and historical records.
This particular sample is free of additional difficulties like smudges, creases, and
torn sections. The magnified section in Fig. 4.48(a) shows that the characters in this
document have distorted shapes due to lack of resolution, and many of the charac-
ters are broken. Although humans fill these gaps visually without difficulty, machine
recognition systems have real difficulties reading broken characters. One approach
for handling this problem is to bridge small gaps in the input image by blurring
it. Figure 4.48(b) shows how well characters can be “repaired” by this simple pro-
cess using a Gaussian lowpass filter with D0 = 120. It is typical to follow the type of
“repair” just described with additional processing, such as thresholding and thinning,
to yield cleaner characters. We will discuss thinning in Chapter 9 and thresholding
in Chapter 10.
Lowpass filtering is a staple in the printing and publishing industry, where it is
We will cover unsharp
used for numerous preprocessing functions, including unsharp masking, as discussed
masking in the frequency in Section 3.6. “Cosmetic” processing is another use of lowpass filtering prior to print-
domain in Section 4.9. ing. Figure 4.49 shows an application of lowpass filtering for producing a smoother,
softer-looking result from a sharp original. For human faces, the typical objective is
to reduce the sharpness of fine skin lines and small blemishes. The magnified sec-
tions in Figs. 4.49(b) and (c) clearly show a significant reduction in fine skin lines
around the subject’s eyes. In fact, the smoothed images look quite soft and pleasing.
Figure 4.50 shows two applications of lowpass filtering on the same image, but
with totally different objectives. Figure 4.50(a) is an 808 × 754 segment of a very high

a b
FIGURE 4.48
(a) Sample text
of low resolution
(note the broken
characters in the
magnified view).
(b) Result of
filtering with a
GLPF,
showing that gaps
in the broken
characters were
joined.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 282 6/16/2017 2:06:11 PM


4.8 Image Smoothing Using Lowpass Frequency Domain Filters 283

a b c
FIGURE 4.49 (a) Original 785 × 732 image. (b) Result of filtering using a GLPF with D0 = 150. (c) Result of filtering
using a GLPF with D0 = 130. Note the reduction in fine skin lines in the magnified sections in (b) and (c).

resolution radiometer (VHRR) image showing part of the Gulf of Mexico (dark)
and Florida (light) (note the horizontal sensor scan lines). The boundaries between
bodies of water were caused by loop currents. This image is illustrative of remotely
sensed images in which sensors have the tendency to produce pronounced scan lines
along the direction in which the scene is being scanned. (See Example 4.24 for an

a b c
FIGURE 4.50 (a) 808 × 754 satellite image showing prominent horizontal scan lines. (b) Result of filtering using a
GLPF with D0 = 50. (c) Result of using a GLPF with D0 = 20. (Original image courtesy of NOAA.)

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 283 6/16/2017 2:06:12 PM


284 Chapter 4 Filtering in the Frequency Domain

illustration of imaging conditions that can lead for such degradations.) Lowpass fil-
tering is a crude (but simple) way to reduce the effect of these lines, as Fig. 4.50(b)
shows (we consider more effective approaches in Sections 4.10 and 5.4). This image
was obtained using a GLFP with D0 = 50. The reduction in the effect of the scan
lines in the smoothed image can simplify the detection of macro features, such as the
interface boundaries between ocean currents.
Figure 4.50(c) shows the result of significantly more aggressive Gaussian lowpass
filtering with D0 = 20. Here, the objective is to blur out as much detail as possible
while leaving large features recognizable. For instance, this type of filtering could be
part of a preprocessing stage for an image analysis system that searches for features
in an image bank. An example of such features could be lakes of a given size, such
as Lake Okeechobee in the lower eastern region of Florida, shown in Fig. 4.50(c) as
a nearly round dark region surrounded by a lighter region. Lowpass filtering helps
to simplify the analysis by averaging out features smaller than the ones of interest.

4.9 IMAGE SHARPENING USING HIGHPASS FILTERS


4.9

We showed in the previous section that an image can be smoothed by attenuating


the high-frequency components of its Fourier transform. Because edges and other
abrupt changes in intensities are associated with high-frequency components, image
sharpening can be achieved in the frequency domain by highpass filtering, which
In some applications of
attenuates low-frequencies components without disturbing high-frequencies in the
highpass filtering, it is Fourier transform. As in Section 4.8, we consider only zero-phase-shift filters that
advantageous to enhance are radially symmetric. All filtering in this section is based on the procedure outlined
the high-frequencies of
the Fourier transform. in Section 4.7, so all images are assumed be padded to size P × Q [see Eqs. (4-102)
and (4-103)], and filter transfer functions, H(u, v), are understood to be centered,
discrete functions of size P × Q.

IDEAL, GAUSSIAN, AND BUTTERWORTH HIGHPASS FILTERS FROM


LOWPASS FILTERS
As was the case with kernels in the spatial domain (see Section 3.7), subtracting a
lowpass filter transfer function from 1 yields the corresponding highpass filter trans-
fer function in the frequency domain:

H HP (u, v) = 1 − H LP (u, v) (4-118)

where H LP (u, v) is the transfer function of a lowpass filter. Thus, it follows from
Eq. (4-111) that an ideal highpass filter (IHPF) transfer function is given by

⎧0 if D(u, v) ≤ D0
H (u, v) = ⎨ (4-119)
⎩1 if D(u, v) > D0

where, as before, D(u, v) is the distance from the center of the P × Q frequency rect-
angle, as given in Eq. (4-112). Similarly, it follows from Eq. (4-116) that the transfer
function of a Gaussian highpass filter (GHPF) transfer function is given by

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 284 6/16/2017 2:06:12 PM


4.9 Image Sharpening Using Highpass Filters 285

a b c H (u, v) H (u, v)
d e f v 1
g h i
FIGURE 4.51
Top row:
Perspective plot,
image, and, radial
cross section of
an IHPF transfer
function. Middle u
v D(u, v)
and bottom
u H (u, v)
rows: The same H (u, v)
sequence for v 1
GHPF and BHPF
transfer functions.
(The thin image
borders were
added for clarity.
They are not part
of the data.)
u
v D(u, v)
H (u, v) u H (u, v)
v 1

u
v D(u, v)
u

2
( u,v ) 2 D02
H (u, v) = 1 − e − D (4-120)

and, from Eq. (4-117), that the transfer function of a Butterworth highpass filter
(BHPF) is
1
H (u, v) = (4-121)
1 + [ D0 D(u, v)]
2n

Figure 4.51 shows 3-D plots, image representations, and radial cross sections for
the preceding transfer functions. As before, we see that the BHPF transfer function
in the third row of the figure represents a transition between the sharpness of the
IHPF and the broad smoothness of the GHPF transfer function.
It follows from Eq. (4-118) that the spatial kernel corresponding to a highpass
filter transfer function in the frequency domain is given by

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 285 6/16/2017 2:06:16 PM


286 Chapter 4 Filtering in the Frequency Domain

hHP ( x, y) = ᑣ−1 [ H HP (u, v)]


= ᑣ−1 [1 − H LP (u, v)] (4-122)
= d( x, y) − hLP ( x, y)

where we used the fact that the IDFT of 1 in the frequency domain is a unit impulse
in the spatial domain (see Table 4.4). This equation is precisely the foundation for
the discussion in Section 3.7, in which we showed how to construct a highpass kernel
Recall that a unit impulse
by subtracting a lowpass kernel from a unit impulse.
in the spatial domain is Figure 4.52 shows highpass spatial kernels constructed in just this manner, using
an array of 0’s with a 1 in Eq. (4-122) with ILPF, GLPF, and BLPF transfer functions (the values of M, N, and
the center.
D0 used in this figure are the same as those we used for Fig. 4.42, and the BLPF is of
order 2). Figure 4.52(a) shows the resulting ideal highpass kernel obtained using Eq.
(4-122), and Fig. 4.52(b) is a horizontal intensity profile through the center of the ker-
nel. The center element of the profile is a unit impulse, visible as a bright dot in the
center of Fig. 4.52(a). Note that this highpass kernel has the same ringing properties
illustrated in Fig. 4.42(b) for its corresponding lowpass counterpart. As you will see
shortly, ringing is just as objectionable as before, but this time in images sharpened
with ideal highpass filters. The other images and profiles in Fig. 4.52 are for Gaussian
and Butterworth kernels. We know from Fig. 4.51 that GHPF transfer functions in
the frequency domain tend to have a broader “skirt” than Butterworth functions of
comparable size and cutoff frequency. Thus, we would expect Butterworth spatial

a b c
d e f
FIGURE 4.52 (a)–(c): Ideal, Gaussian, and Butterworth highpass spatial kernels obtained from
IHPF, GHPF, and BHPF frequency-domain transfer functions. (The thin image borders are
not part of the data.) (d)–(f): Horizontal intensity profiles through the centers of the kernels.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 286 6/16/2017 2:06:17 PM


4.9 Image Sharpening Using Highpass Filters 287

TABLE 4.6
Highpass filter transfer functions. D0 is the cutoff frequency and n is the order of the Butterworth transfer function.
Ideal Gaussian Butterworth

⎧0 if D(u, v) ≤ D0 2
( u,v ) 2 D02 1
H (u, v) = ⎨ H (u, v) = 1 − e − D H (u, v) =
if D(u, v) > D0 1 + [ D0 D(u, v)]
2n
⎩1

kernels to be “broader” than comparable Gaussian kernels, a fact that is confirmed


by the images and their profiles in Figs. 4.52. Table 4.6 summarizes the three highpass
filter transfer functions discussed in the preceding paragraphs.

EXAMPLE 4.19 : Highpass filtering of the character test pattern.


The first row of Fig. 4.53 shows the result of filtering the test pattern in Fig. 4.37(a) using IHPF, GHPF, and
BHPF transfer functions with D0 = 60 [see Fig. 4.37(b)] and n = 2 for the Butterworth filter. We know
from Chapter 3 that highpass filtering produces images with negative values. The images in Fig. 4.53 are
not scaled, so the negative values are clipped by the display at 0 (black). The key objective of highpass
filtering is to sharpen. Also, because the highpass filters used here set the DC term to zero, the images
have essentially no tonality, as explained earlier in connection with Fig. 4.30.
Our main objective in this example is to compare the behavior of the three highpass filters. As
Fig. 4.53(a) shows, the ideal highpass filter produced results with severe distortions caused by ringing.
For example, the blotches inside the strokes of the large letter “a” are ringing artifacts. By comparison,
neither Figs. 4.53(b) or (c) have such distortions. With reference to Fig. 4.37(b), the filters removed or
attenuated approximately 95% of the image energy. As you know, removing the lower frequencies of an
image reduces its gray-level content significantly, leaving mostly edges and other sharp transitions, as is
evident in Fig. 4.53. The details you see in the first row of the figure are contained in only the upper 5%
of the image energy.
The second row, obtained with D0 = 160, is more interesting. The remaining energy of those images
is about 2.5%, or half, the energy of the images in the first row. However, the difference in fine detail
is striking. See, for example, how much cleaner the boundary of the large “a” is now, especially in the
Gaussian and Butterworth results. The same is true for all other details, down to the smallest objects.
This is the type of result that is considered acceptable when detection of edges and boundaries is impor-
tant.
Figure 4.54 shows the images in the second row of Fig. 4.53, scaled using Eqs. (2-31) and (2-32) to
display the full intensity range of both positive and negative intensities. The ringing in Fig. 4.54(a) shows
the inadequacy of ideal highpass filters. In contrast, notice the smoothness of the background on the
other two images, and the crispness of their edges.

EXAMPLE 4.20 : Using highpass filtering and thresholding for image enhancement.
Figure 4.55(a) is a 962 × 1026 image of a thumbprint in which smudges (a typical problem) are evident.
A key step in automated fingerprint recognition is enhancement of print ridges and the reduction of
smudges. In this example, we use highpass filtering to enhance the ridges and reduce the effects of

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 287 6/16/2017 2:06:18 PM


288 Chapter 4 Filtering in the Frequency Domain

a b c
d e f
FIGURE 4.53 Top row: The image from Fig. 4.40(a) filtered with IHPF, GHPF, and BHPF transfer functions using
D0 = 60 in all cases (n = 2 for the BHPF). Second row: Same sequence, but using D0 = 160.

a b c
FIGURE 4.54 The images from the second row of Fig. 4.53 scaled using Eqs. (2-31) and (2-32) to show both positive
and negative values.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 288 6/16/2017 2:06:18 PM


4.9 Image Sharpening Using Highpass Filters 289

a b c
FIGURE 4.55 (a) Smudged thumbprint. (b) Result of highpass filtering (a). (c) Result of thresholding (b). (Original
image courtesy of the U.S. National Institute of Standards and Technology.)

smudging. Enhancement of the ridges is accomplished by the fact that their boundaries are character-
ized by high frequencies, which are unchanged by a highpass filter. On the other hand, the filter reduces
low frequency components, which correspond to slowly varying intensities in the image, such as the
background and smudges. Thus, enhancement is achieved by reducing the effect of all features except
those with high frequencies, which are the features of interest in this case.
Figure 4.55(b) is the result of using a Butterworth highpass filter of order 4 with a cutoff frequency
of 50. A fourth-order filter provides a sharp (but smooth) transition from low to high frequencies, with
filtering characteristics between an ideal and a Gaussian filter. The cutoff frequency chosen is about 5%
of the long dimension of the image. The idea is for D0 to be close to the origin so that low frequencies are
attenuated but not completely eliminated, except for the DC term which is set to 0, so that tonality dif-
ferences between the ridges and background are not lost completely. Choosing a value for D0 between
5% and 10% of the long dimension of the image is a good starting point. Choosing a large value of
D0 would highlight fine detail to such an extent that the definition of the ridges would be affected. As
expected, the highpass filtered image has negative values, which are shown as black by the display.
A simple approach for highlighting sharp features in a highpass-filtered image is to threshold it by set-
ting to black (0) all negative values and to white (1) the remaining values. Figure 4.55(c) shows the result
of this operation. Note how the ridges are clear, and how the effect of the smudges has been reduced
considerably. In fact, ridges that are barely visible in the top, right section of the image in Fig. 4.55(a) are
nicely enhanced in Fig. 4.55(c). An automated algorithm would find it much easier to follow the ridges
on this image than it would on the original.

THE LAPLACIAN IN THE FREQUENCY DOMAIN


In Section 3.6, we used the Laplacian for image sharpening in the spatial domain. In
this section, we revisit the Laplacian and show that it yields equivalent results using
frequency domain techniques. It can be shown (see Problem 4.52) that the Laplacian
can be implemented in the frequency domain using the filter transfer function

H (u, v) = − 4p 2 (u 2 + v 2 ) (4-123)

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 289 6/16/2017 2:06:19 PM


290 Chapter 4 Filtering in the Frequency Domain

or, with respect to the center of the frequency rectangle, using the transfer function

H (u, v) = − 4p 2 ⎡( u − P 2 ) + ( v − Q 2 ) ⎤
2 2
⎣ ⎦ (4-124)
= − 4p 2 D2 (u, v)

where D(u, v) is the distance function defined in Eq. (4-112). Using this transfer
function, the Laplacian of an image, f ( x, y), is obtained in the familiar manner:
2
f ( x, y) = ᑣ−1 [ H (u, v)F (u, v)] (4-125)

where F(u, v) is the DFT of f ( x, y). As in Eq. (3-54), enhancement is implemented


using the equation

g( x, y) = f ( x, y) + c∇ 2 f ( x, y) (4-126)

Here, c = −1 because H(u, v) is negative. In Chapter 3, f ( x, y) and 2 f ( x, y) had


comparable values. However, computing 2 f ( x, y) with Eq. (4-125) introduces DFT
scaling factors that can be several orders of magnitude larger than the maximum
value of f. Thus, the differences between f and its Laplacian must be brought into
comparable ranges. The easiest way to handle this problem is to normalize the val-
ues of f ( x, y) to the range [0, 1] (before computing its DFT) and divide 2 f ( x, y) by
its maximum value, which will bring it to the approximate range [ −1, 1]. (Remember,
the Laplacian has negative values.) Equation (4-126) can then be used.
We can write Eq. (4-126) directly in the frequency domain as

g( x, y) = ᑣ−1 {F (u, v) − H (u, v)F (u, v)}


= ᑣ−1 {[1 − H (u, v)] F (u, v)} (4-127)

{
= ᑣ−1 ⎡⎣1 + 4p 2 D2 (u, v)⎤⎦ F (u, v) }
Although this result is elegant, it has the same scaling issues just mentioned, com-
pounded by the fact that the normalizing factor is not as easily computed. For this
reason, Eq. (4-126) is the preferred implementation in the frequency domain, with
2
f ( x, y) computed using Eq. (4-125) and scaled using the approach mentioned in
the previous paragraph.

EXAMPLE 4.21 : Image sharpening in the frequency domain using the Laplacian.
Figure 4.56(a) is the same as Fig. 3.46(a), and Fig. 4.56(b) shows the result of using Eq. (4-126), in which
the Laplacian was computed in the frequency domain using Eq. (4-125). Scaling was done as described
in connection with Eq. (4-126). We see by comparing Figs. 4.56(b) and 3.46(d) that the frequency-domain
result is superior. The image in Fig. 4.56(b) is much sharper, and shows details that are barely visible in
3.46(d), which was obtained using the Laplacian kernel in Fig. 3.45(b), with a −8 in the center. The sig-
nificant improvement achieved in the frequency domain is not unexpected. The spatial Laplacian kernel

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 290 6/16/2017 2:06:20 PM


4.9 Image Sharpening Using Highpass Filters 291

a b
FIGURE 4.56
(a) Original,
blurry image.
(b) Image
enhanced using
the Laplacian in
the frequency
domain.
Compare with
Fig. 3.46(d).
(Original image
courtesy of
NASA.)

encompasses a very small neighborhood, while the formulation in Eqs. (4-125) and (4-126) encompasses
the entire image.

UNSHARP MASKING, HIGH-BOOST FILTERING, AND HIGH-


FREQUENCY-EMPHASIS FILTERING
In this section, we discuss frequency domain formulations of the unsharp mask-
ing and high-boost filtering image sharpening techniques introduced in Section 3.6.
Using frequency domain methods, the mask defined in Eq. (3-55) is given by

gmask ( x, y) = f ( x, y) − fLP ( x, y) (4-128)

with

fLP ( x, y) = ᑣ−1 [ H LP (u, v)F (u, v)] (4-129)

where H LP (u, v) is a lowpass filter transfer function, and F(u, v) is the DFT of f ( x, y).
Here, fLP ( x, y) is a smoothed image analogous to f ( x, y) in Eq. (3-55). Then, as in
Eq. (3-56),

g( x, y) = f ( x, y) + kgmask ( x, y) (4-130)

This expression defines unsharp masking when k = 1 and high-boost filtering when
k > 1. Using the preceding results, we can express Eq. (4-130) entirely in terms of
frequency domain computations involving a lowpass filter:

{
g( x, y) = ᑣ−1 Q1 + k [1 − H LP (u, v)]R F (u, v) } (4-131)

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 291 6/16/2017 2:06:22 PM


292 Chapter 4 Filtering in the Frequency Domain

We can express this result in terms of a highpass filter using Eq. (4-118):

g( x, y) = ᑣ−1 {[1 + kH HP (u, v)] F (u, v)} (4-132)

The expression contained within the square brackets is called a high-frequency-


emphasis filter transfer function. As noted earlier, highpass filters set the dc term
to zero, thus reducing the average intensity in the filtered image to 0. The high-fre-
quency-emphasis filter does not have this problem because of the 1 that is added to
the highpass filter transfer function. Constant k gives control over the proportion of
high frequencies that influences the final result. A slightly more general formulation
of high-frequency-emphasis filtering is the expression

g( x, y) = ᑣ−1 {[ k1 + k2 H HP (u, v)] F (u, v)} (4-133)

where k1 ≥ 0 offsets the value the transfer function so as not to zero-out the dc term
[see Fig. 4.30(c)], and k2 > 0 controls the contribution of high frequencies.

EXAMPLE 4.22 : Image enhancement using high-frequency-emphasis filtering.


Figure 4.57(a) shows a 503 × 720-pixel chest X-ray image with a narrow range of intensity levels. The
objective of this example is to enhance the image using high-frequency-emphasis filtering. X-rays can-
not be focused in the same manner that optical lenses can, and the resulting images generally tend to be
slightly blurred. Because the intensities in this particular image are biased toward the dark end of the

a b
c d
FIGURE 4.57
(a) A chest X-ray.
(b) Result of
filtering with a
GHPF function.
(c) Result of
high-frequency-
emphasis filtering
using the same
GHPF. (d) Result
of performing
histogram
equalization on (c).
(Original image
courtesy of Dr.
Thomas R. Gest,
Division of
Anatomical
Sciences,
University of
Michigan Medical
School.)

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 292 6/16/2017 2:06:22 PM


4.9 Image Sharpening Using Highpass Filters 293

gray scale, we also take this opportunity to give an example of how spatial domain processing can be
used to complement frequency-domain filtering.
Image artifacts, such as ringing, are unacceptable in medical image processing, so we use a Gaussian
highpass filter transfer function. Because the spatial representation of a GHPF function is Gaussian also,
we know that ringing will not be an issue. The value chosen for D0 should provide enough filtering to
sharpen boundaries while at the same time not over-sharpening minute details (such as noise). We used
D0 = 70, approximately 10% of the long image dimension, but other similar values would work also.
Figure 4.57(b) is the result of highpass filtering the original image (scaled as the images in Fig. 4.54). As
expected, the image is rather featureless, but the important boundaries (e.g., the edges of the ribs) are
clearly delineated. Figure 4.57(c) shows the advantage of high-frequency-emphasis filtering, where we
used Eq. (4-133) with k1 = 0.5 and k2 = 0.75. Although the image is still dark, the gray-level tonality has
been restored, with the added advantage of sharper features.
As we discussed in Section 3.3, an image characterized by intensity levels in a narrow range of the
gray scale is an ideal candidate for histogram equalization. As Fig. 4.57(d) shows, this was indeed an
appropriate method to further enhance the image. Note the clarity of the bone structure and other
details that simply are not visible in any of the other three images. The final enhanced image is a little
noisy, but this is typical of X-ray images when their gray scale is expanded. The result obtained using a
combination of high-frequency-emphasis and histogram equalization is superior to the result that would
be obtained by using either method alone.

HOMOMORPHIC FILTERING
The illumination-reflectance model introduced in Section 2.3 can be used to develop
a frequency domain procedure for improving the appearance of an image by simul-
taneous intensity range compression and contrast enhancement. From the discus-
sion in that section, an image f ( x, y) can be expressed as the product of its illumina-
tion, i( x, y), and reflectance, r( x, y), components:

f ( x, y) = i( x, y)r( x, y) (4-134)

This equation cannot be used directly to operate on the frequency components of


illumination and reflectance because the Fourier transform of a product is not the
product of the transforms:

ᑣ [ f ( x, y)] ≠ ᑣ [ i( x, y)] ᑣ [ r( x, y)] (4-135)

However, suppose that we define


If f(x, y) has any zero
values, a 1 must be added
to the image to avoid
z( x, y) = ln f ( x, y)
(4-136)
having to deal with ln(0). = ln i( x, y) + ln r( x, y)
The 1 is then subtracted
from the final result.
Then,

ᑣ [ z( x, y)] = ᑣ [ ln f ( x, y)]
(4-137)
= ᑣ [ ln i( x, y)] + ᑣ [ ln r( x, y)]

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 293 6/16/2017 2:06:23 PM


294 Chapter 4 Filtering in the Frequency Domain

or

Z(u, v) = Fi (u, v) + Fr (u, v) (4-138)

where Fi (u, v) and Fr (u, v) are the Fourier transforms of ln i( x, y) and ln r( x, y),
respectively.
We can filter Z(u, v) using a filter transfer function H(u, v) so that

S(u, v) = H (u, v)Z(u, v)


(4-139)
= H (u, v)Fi (u, v) + H (u, v)Fr (u, v)

The filtered image in the spatial domain is then

s( x, y) = ᑣ−1 [ S(u, v)]


(4-140)
= ᑣ−1 [ H (u, v)Fi (u, v)] + ᑣ−1 [ H (u, v)Fr (u, v)]

By defining

i ′( x, y) = ᑣ−1 [ H (u, v)Fi (u, v)] (4-141)

and

r ′( x, y) = ᑣ−1 [ H (u, v)Fr (u, v)] (4-142)

we can express Eq. (4-140) in the form

s( x, y) = i ′( x, y) + r ′( x, y) (4-143)

Finally, because z( x, y) was formed by taking the natural logarithm of the input
image, we reverse the process by taking the exponential of the filtered result to form
the output image:
g( x, y) = e s( x, y )
= e i ′ ( x , y )e r ′ ( x , y ) (4-144)
= i0 ( x, y) r0 ( x, y)

where

i0 ( x, y) = ei ′( x, y ) (4-145)

and

r0 ( x, y) = er ′( x, y ) (4-146)

are the illumination and reflectance components of the output (processed) image.
Figure 4.58 is a summary of the filtering approach just derived. This method is
based on a special case of a class of systems known as homomorphic systems. In this
particular application, the key to the approach is the separation of the illumination

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 294 6/16/2017 2:06:25 PM


4.9 Image Sharpening Using Highpass Filters 295

FIGURE 4.58
Summary of steps
in homomorphic f (x, y) ln DF T H (u, v) (DF T)1 exp g (x, y)
filtering.

and reflectance components achieved in the form shown in Eq. (4-138). The homo-
morphic filter transfer function, H(u, v), then can operate on these components sepa-
rately, as indicated by Eq. (4-139).
The illumination component of an image generally is characterized by slow spa-
tial variations, while the reflectance component tends to vary abruptly, particularly
at the junctions of dissimilar objects. These characteristics lead to associating the low
frequencies of the Fourier transform of the logarithm of an image with illumination,
and the high frequencies with reflectance. Although these associations are rough
approximations, they can be used to advantage in image filtering, as illustrated in
Example 4.23.
A good deal of control can be gained over the illumination and reflectance com-
ponents with a homomorphic filter. This control requires specification of a filter
transfer function H(u, v) that affects the low- and high-frequency components of
the Fourier transform in different, controllable ways. Figure 4.59 shows a cross sec-
tion of such a function. If the parameters gL and gH are chosen so that gL < 1 and
gH ≥ 1, the filter function in Fig. 4.59 will attenuate the contribution made by the
low frequencies (illumination) and amplify the contribution made by high frequen-
cies (reflectance). The net result is simultaneous dynamic range compression and
contrast enhancement.
The shape of the function in Fig. 4.59 can be approximated using a highpass filter
A BHPF function would
transfer function. For example, using a slightly modified form of the GHPF function
work well too, with the yields the homomorphic function
added advantage of more

H (u, v) = ( gH − gL ) ⎡1 − e − cD ⎤+g
control over the sharp- 2
( u,v ) D02
ness of the transition (4-147)
between gL and gH. The ⎣ ⎦ L

disadvantage is the
possibility of ringing for where D(u, v) is defined in Eq. (4-112) and constant c controls the sharpness of the
high values of n. slope of the function as it transitions between gL and gH . This filter transfer function
is similar to the high-frequency-emphasis function discussed in the previous section.

FIGURE 4.59 H (u, v)


Radial cross
section of a
homomorphic
filter transfer gH
function..

gL

D(u, v)

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 295 6/16/2017 2:06:26 PM


296 Chapter 4 Filtering in the Frequency Domain

a b
FIGURE 4.60
(a) Full body PET
scan. (b) Image
enhanced using
homomorphic
filtering. (Original
image courtesy
of Dr. Michael E.
Casey, CTI Pet
Systems.)

EXAMPLE 4.23 : Homomorphic filtering.


Figure 4.60(a) shows a full body PET (Positron Emission Tomography) scan of size 1162 × 746 pixels.
The image is slightly blurred and many of its low-intensity features are obscured by the high intensity of
the “hot spots” dominating the dynamic range of the display. (These hot spots were caused by a tumor in
the brain and one in the lungs.) Figure 4.60(b) was obtained by homomorphic filtering Fig. 4.60(a) using
the filter transfer function in Eq. (4-147) with gL = 0.4, gH = 3.0, c = 5, and D0 = 20. A radial cross sec-
tion of this function looks just like Fig. 4.59, but with a much sharper slope, and the transition between
low and high frequencies much closer to the origin.
Note in Fig. 4.60(b) how much sharper the hot spots, the brain, and the skeleton are in the processed
image, and how much more detail is visible in this image, including, for example, some of the organs, the
shoulders, and the pelvis region. By reducing the effects of the dominant illumination components (the
hot spots), it became possible for the dynamic range of the display to allow lower intensities to become
more visible. Similarly, because the high frequencies are enhanced by homomorphic filtering, the reflec-
tance components of the image (edge information) were sharpened considerably. The enhanced image
in Fig. 4.60(b) is a significant improvement over the original.

4.10 SELECTIVE FILTERING


4.10

The filters discussed in the previous two sections operate over the entire frequency
rectangle. There are applications in which it is of interest to process specific bands of
frequencies or small regions of the frequency rectangle. Filters in the first category

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 296 6/16/2017 2:06:26 PM


4.10 Selective Filtering 297

are called band filters. If frequencies in the band are filtered out, the band filter is
called a bandreject filter; similarly, if the frequencies are passed, the filter is called
a bandpass filter. Filters in the second category are called notch filters. These filters
are further qualified as being notch reject or notch pass filters, depending on whether
frequencies in the notch areas are rejected or passed.

BANDREJECT AND BANDPASS FILTERS


As you learned in Section 3.7, bandpass and bandreject filter transfer functions in
the frequency domain can be constructed by combining lowpass and highpass filter
transfer functions, with the latter also being derivable from lowpass functions (see
Fig. 3.52). In other words, lowpass filter transfer functions are the basis for forming
highpass, bandreject, and bandpass filter functions. Furthermore, a bandpass filter
transfer function is obtained from a bandreject function in the same manner that we
obtained a highpass from a lowpass transfer function:

H BP (u, v) = 1 − H BR (u, v) (4-148)

Figure 4.61(a) shows how to construct an ideal bandreject filter (IBRF) transfer
function. It consists of an ILPF and an IHPF function with different cutoff frequen-
cies. When dealing with bandpass functions, the parameters of interest are the width,
W, and the center, C0 , of the band. An equation for the IBRF function is easily
obtained by inspection from Fig, 4.61(a), as the leftmost entry in Table 4.7 shows.
The key requirements of a bandpass transfer function are: (1) the values of the func-
tion must be in the range [0, 1]; (2) the value of the function must be zero at a dis-
tance C0 from the origin (center) of the function; and (3) we must be able to specify
a value for W. Clearly, the IBRF function just developed satisfies these requirements.
Adding lowpass and highpass transfer functions to form Gaussian and Butter-
worth bandreject functions presents some difficulties. For example, Fig. 4.61(b)
shows a bandpass function formed as the sum of lowpass and highpass Gaussian
functions with different cutoff points. Two problems are immediately obvious: we
have no direct control over W, and the value of H(u, v) is not 0 at C0 . We could

H (u, v) H (u, v) H (u, v) H (u, v)

1.0 1.0 1.0 1.0

C0 D(u, v) C0 D(u, v) C0 D(u, v) C0 D(u, v)

a b c d
FIGURE 4.61 Radial cross sections. (a) Ideal bandreject filter transfer function. (b) Bandreject transfer function formed
by the sum of Gaussian lowpass and highpass filter functions. (The minimum is not 0 and does not align with C0 .)
(c) Radial plot of Eq. (4-149). (The minimum is 0 and is properly aligned with C0 , but the value at the origin is
not 1.) (d) Radial plot of Eq. (4-150); this Gaussian-shape plot meets all the requirements of a bandreject filter
transfer function.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 297 6/16/2017 2:06:27 PM


298 Chapter 4 Filtering in the Frequency Domain

TABLE 4.7
Bandreject filter transfer functions. C0 is the center of the band, W is the width of the band, and D(u, v) is the dis-
tance from the center of the transfer function to a point (u, v) in the frequency rectangle.

Ideal (IBRF) Gaussian (GBRF) Butterworth (BBRF)

1
⎧ H (u, v) =
2
W W ⎡ D 2 ( u , v ) − C02 ⎤
⎪0 if C0 − ≤ D(u, v) ≤ C0 + −⎢
⎢⎣ D ( u , v )W ⎥⎦

⎡ D(u, v)W ⎤
2n
H (u, v) = ⎨ 2 2 H ( u, v) = 1 − e 1+ ⎢ 2
⎪⎩1 otherwise 2⎥
⎣ D (u, v) − C0 ⎦

offset the function and scale it so that values fall in the range [0, 1], but finding an
analytical solution for the point where the lowpass and highpass Gaussian functions
intersect is impossible, and this intersection would be required to solve for the cutoff
points in terms of C0 . The only alternatives are trial-and-error or numerical methods.
Fortunately, instead of adding lowpass and highpass transfer function, an alterna-
tive is to modify the expressions for the Gaussian and Butterworth highpass transfer
functions so that they will satisfy the three requirements stated earlier. We illustrate
the procedure for a Gaussian function. In this case, we begin by changing the point
at which H(u, v) = 0 from D(u, v) = 0 to D(u, v) = C0 in Eq. (4-120):

⎡ ( D( u,v ) − C )2 ⎤
−⎢ 0

⎢⎣ W2 ⎥⎦
H (u, v) = 1 − e (4-149)

A plot of this function [Fig. 4.61(c)] shows that, below C0 , the function behaves as a
lowpass Gaussian function, at C0 the function will always be 0, and for values higher
than C0 the function behaves as a highpass Gaussian function. Parameter W is pro-
portional to the standard deviation and thus controls the “width” of the band. The
only problem remaining is that the function is not always 1 at the origin. A simple
modification of Eq. (4-149) removes this shortcoming:
The overall ratio in this 2
⎡ D2 ( u,v ) − C02 ⎤
equation is squared so −⎢ ⎥
⎢⎣ D( u,v )W ⎥⎦
that, as the distance
increases, Eqs. (4-149)
H (u, v) = 1 − e (4-150)
and (4-150) behave
approximately the same.
Now, the exponent is infinite when D(u, v) = 0, which makes the exponential term go
to zero and H(u, v) = 1 at the origin, as desired. In this modification of Eq. (4-149),
the basic Gaussian shape is preserved and the three requirements stated earlier are
satisfied. Figure 4.61(d) shows a plot of Eq. (4-150). A similar analysis leads to the
form of a Butterworth bandreject filter transfer function shown in Table 4.7.
Figure 4.62 shows perspective plots of the filter transfer functions just discussed.
At first glance the Gaussian and Butterworth functions appear to be about the same,
but, as before, the behavior of the Butterworth function is between the ideal and
Gaussian functions. As Fig. 4.63 shows, this is easier to see by viewing the three filter

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 298 6/16/2017 2:06:29 PM


4.10 Selective Filtering 299

H(u, v) H (u , v ) H(u, v)

u u u
v v v

a b c
FIGURE 4.62 Perspective plots of (a) ideal, (b) modified Gaussian, and (c) modified Butterworth (of order 1) bandre-
ject filter transfer functions from Table 4.7. All transfer functions are of size 512 × 512 elements, with C0 = 128 and
W = 60.

functions as images. Increasing the order of the Butterworth function would bring it
closer to the ideal bandreject transfer function.

NOTCH FILTERS
Notch filters are the most useful of the selective filters. A notch filter rejects (or
passes) frequencies in a predefined neighborhood of the frequency rectangle. Zero-
phase-shift filters must be symmetric about the origin (center of the frequency
rectangle), so a notch filter transfer function with center at (u0 , v0 ) must have a
corresponding notch at location (− u0 , − v0 ). Notch reject filter transfer functions are
constructed as products of highpass filter transfer functions whose centers have
been translated to the centers of the notches. The general form is:
Q
H NR (u, v) = ∏ H k (u, v) H − k (u, v) (4-151)
k =1

where H k (u, v) and H − k (u, v) are highpass filter transfer functions whose centers are
at (uk , vk ) and (− uk , − vk ), respectively. These centers are specified with respect to
the center of the frequency rectangle, ( M 2 , N 2 ) , where, as usual, M and N are the

a b c
FIGURE 4.63
(a) The ideal,
(b) Gaussian, and
(c) Butterworth
bandpass transfer
functions from
Fig. 4.62, shown
as images. (The
thin border lines
are not part of the
image data.)

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 299 6/16/2017 2:06:34 PM


300 Chapter 4 Filtering in the Frequency Domain

number of rows and columns in the input image. Thus, the distance computations for
each filter transfer function are given by
1/ 2
Dk (u, v) = ⎡⎣(u − M 2 − uk )2 + (v − N 2 − vk )2 ⎤⎦ (4-152)

and
1/ 2
D− k (u, v) = ⎡⎣(u − M 2 + uk )2 + (v − N 2 + vk )2 ⎤⎦ (4-153)

For example, the following is a Butterworth notch reject filter transfer function of
order n, containing three notch pairs:

3 ⎡ ⎤⎡ ⎤
1 1
H NR (u, v) = ∏ ⎢ ⎥ ⎢ ⎥ (4-154)
k =1 ⎢ 1 + [ D0 k Dk (u, v)] ⎥ ⎢ 1 + [ D0 k D− k (u, v)] ⎥
n n
⎣ ⎦⎣ ⎦

where Dk (u, v) and D− k (u, v) are given by Eqs. (4-152) and (4-153). The constant D0 k
is the same for each pair of notches, but it can be different for different pairs. Other
notch reject filter functions are constructed in the same manner, depending on the
highpass filter function chosen. As with the filters discussed earlier, a notch pass
filter transfer function is obtained from a notch reject function using the expression

H NP (u, v) = 1 − H NR (u, v) (4-155)

As the next two examples show, one of the principal applications of notch filter-
ing is for selectively modifying local regions of the DFT. Often, this type of pro-
cessing is done interactively, working directly with DFTs obtained without padding.
The advantages of working interactively with actual DFTs (as opposed to having to
“translate” from padded to actual frequency values) generally outweigh any wrap-
around errors that may result from not using padding in the filtering process. If nec-
essary, after an acceptable solution is obtained, a final result using padding can be
generated by adjusting all filter parameters to compensate for the padded DFT size.
The following two examples were done without padding. To get an idea of how DFT
values change as a function of padding, see Problem 4.42.

EXAMPLE 4.24 : Using notch filtering to remove moiré patterns from digitized printed media images.
Figure 4.64(a) is the scanned newspaper image used in Fig. 4.21, showing a prominent moiré pattern, and
Fig. 4.64(b) is its spectrum. The Fourier transform of a pure sine, which is a periodic function, is a pair of
conjugate symmetric impulses (see Table 4.4). The symmetric “impulse-like” bursts in Fig. 4.64(b) are a
result of the near periodicity of the moiré pattern. We can attenuate these bursts by using notch filtering.
Figure 4.64(c) shows the result of multiplying the DFT of Fig. 4.64(a) by a Butterworth notch reject
transfer function with D0 = 9 and n = 4 for all notch pairs (the centers of the notches are coincide with
the centers of the black circular regions in the figure). The value of the radius was selected (by visual
inspection of the spectrum) to encompass the energy bursts completely, and the value of n was selected
to produce notches with sharp transitions. The locations of the center of the notches were determined

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 300 6/16/2017 2:06:35 PM


4.10 Selective Filtering 301

a b
c d
FIGURE 4.64
(a) Sampled
newspaper
image showing a
moiré pattern.
(b) Spectrum.
(c) Fourier
transform
multiplied by
a Butterworth
notch reject filter
transfer function.
(d) Filtered image.

interactively from the spectrum. Figure 4.64(d) shows the result obtained with this filter transfer func-
tion, using the filtering procedure outlined in Section 4.7. The improvement is significant, considering
the low resolution and degree of degradation of the original image.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 301 6/16/2017 2:06:35 PM


302 Chapter 4 Filtering in the Frequency Domain

EXAMPLE 4.25 : Using notch filtering to remove periodic interference.


Figure 4.65(a) shows an image of part of the rings surrounding the planet Saturn. This image was cap-
tured by Cassini, the first spacecraft to enter the planet’s orbit. The nearly sinusoidal pattern visible in
the image was caused by an AC signal superimposed on the camera video signal just prior to digitizing
the image. This was an unexpected problem that corrupted some images from the mission. Fortunately,
this type of interference is fairly easy to correct by postprocessing. One approach is to use notch filtering.
Figure 4.65(b) shows the DFT spectrum. Careful analysis of the vertical axis reveals a series of
small bursts of energy near the origin which correspond to the nearly sinusoidal interference. A simple
approach is to use a narrow notch rectangle filter starting with the lowest frequency burst, and extending
for the remainder of the vertical axis. Figure 4.65(c) shows the transfer function of such a filter (white
represents 1 and black 0). Figure 4.65(d) shows the result of processing the corrupted image with this
filter. This result is a significant improvement over the original image.
To obtain and image of just the interference pattern, we isolated the frequencies in the vertical axis
using a notch pass transfer function, obtained by subtracting the notch reject function from 1 [see
Fig. 4.66(a)]. Then, as Fig. 4.66(b) shows, the IDFT of the filtered image is the spatial interference pattern.

a b
c d
FIGURE 4.65
(a) Image of
Saturn rings
showing nearly
periodic
interference.
(b) Spectrum.
(The bursts of
energy in the
vertical axis
near the origin
correspond to
the interference
pattern).
(c) A vertical
notch reject filter
transfer function.
(d) Result of
filtering.
(The thin black
border in (c) is
not part of the
data.) (Original
image courtesy
of Dr. Robert A.
West, NASA/
JPL.)

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 302 6/16/2017 2:06:36 PM


4.11 The Fast Fourier Transform 303

a b
FIGURE 4.66
(a) Notch pass
filter function
used to isolate
the vertical axis
of the DFT of Fig.
4.65(a).
(b) Spatial pattern
obtained by
computing the
IDFT of (a).

4.11 THE FAST FOURIER TRANSFORM


4.11

We have focused attention thus far on theoretical concepts and on examples of fil-
tering in the frequency domain. One thing that should be clear by now is that com-
putational requirements in this area of image processing are not trivial. Thus, it is
important to develop a basic understanding of methods by which Fourier transform
computations can be simplified and speeded up. This section deals with these issues.

SEPARABILITY OF THE 2-D DFT


As mentioned in Table 4.3, the 2-D DFT is separable into 1-D transforms. We can
write Eq. (4-67) as
M −1 N −1
F (u, v) = ∑ e− j 2pux
x=0
M
∑ f ( x, y) e− j 2pvy N
y=0
(4-156)
M −1
= ∑ F ( x, v) e
x=0
− j 2 pux M

where
N −1
F ( x, v) = ∑ f ( x, y) e− j 2pvy N
y=0
(4-157)

For one value of x, and for v = 0, 1, 2, … , N − 1, we see that F ( x, v) is the 1-D DFT of
one row of f ( x, y). By varying x from 0 to M − 1 in Eq. (4-157), we compute a set of
We could have formu- 1-D DFTs for all rows of f ( x, y). The computations in Eq. (4-156) similarly are 1-D
lated the preceding
two equations to show transforms of the columns of F ( x, v). Thus, we conclude that the 2-D DFT of f ( x, y)
that a 2-D DFT can be can be obtained by computing the 1-D transform of each row of f ( x, y) and then
obtained by computing
the 1-D DFT of each computing the 1-D transform along each column of the result. This is an important
column of the input simplification because we have to deal only with one variable at a time. A similar
image followed by 1-D
computations on the development applies to computing the 2-D IDFT using the 1-D IDFT. However,
rows of the result. as we show in the following section, we can compute the IDFT using an algorithm

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 303 6/16/2017 2:06:37 PM


304 Chapter 4 Filtering in the Frequency Domain

designed to compute the forward DFT, so all 2-D Fourier transform computations
are reduced to multiple passes of a 1-D algorithm designed for computing the 1-D
DFT.

COMPUTING THE IDFT USING A DFT ALGORITHM


Taking the complex conjugate of both sides of Eq. (4-68) and multiplying the results
by MN yields
M −1 N −1
MNf * ( x, y) = ∑ ∑
u=0 v=0
F * (u, v) e − j 2 p(ux M + vy N ) (4-158)

But, we recognize the form of the right side of this result as the DFT of F * (u, v). There-
fore, Eq. (4-158) indicates that if we substitute F * (u, v) into an algorithm designed to
compute the 2-D forward Fourier transform, the result will be MNf * ( x, y). Taking
the complex conjugate and dividing this result by MN yields f ( x, y), which is the
inverse of F(u, v).
Computing the 2-D inverse from a 2-D forward DFT algorithm that is based on
successive passes of 1-D transforms (as in the previous section) is a frequent source
of confusion involving the complex conjugates and multiplication by a constant, nei-
ther of which is done in the 1-D algorithms. The key concept to keep in mind is that
we simply input F * (u, v) into whatever forward algorithm we have. The result will be
MNf * ( x, y). All we have to do with this result to obtain f ( x, y) is to take its complex
conjugate and divide it by the constant MN. Of course, when f ( x, y) is real, as typi-
cally is the case, then f * ( x, y) = f ( x, y).

THE FAST FOURIER TRANSFORM (FFT)


Work in the frequency domain would not be practical if we had to implement
Eqs. (4-67) and (4-68) directly. Brute-force implementation of these equations
requires on the order of ( MN )2 multiplications and additions. For images of moder-
ate size (say, 2048 × 2048 pixels), this means on the order of 17 trillion multiplica-
tions and additions for just one 2-D DFT, excluding the exponentials, which could be
computed once and stored in a look-up table. Without the discovery of the fast Fou-
rier transform (FFT), which reduces computations to the order of MN log 2 MN mul-
tiplications and additions, it is safe to say that the material presented in this chapter
would be of little practical value. The computational reductions afforded by the FFT
are impressive indeed. For example, computing the 2-D FFT of a 2048 × 2048 image
would require on the order of 92 million multiplication and additions, which is a
significant reduction from the one trillion computations mentioned above.
Although the FFT is a topic covered extensively in the literature on signal pro-
cessing, this subject matter is of such significance in our work that this chapter would
be incomplete if we did not provide an introduction explaining why the FFT works
as it does. The algorithm we selected to accomplish this objective is the so-called
successive-doubling method, which was the original algorithm that led to the birth
of an entire industry. This particular algorithm assumes that the number of samples
is an integer power of 2, but this is not a general requirement of other approaches

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 304 6/16/2017 2:06:38 PM


4.11 The Fast Fourier Transform 305

(Brigham [1988]).We know from the previous section that 2-D DFTs can be imple-
mented by successive passes of the 1-D transform, so we need to focus only on the
FFT of one variable.
In derivations of the FFT, it is customary to express Eq. (4-44) in the form
M −1
F (u ) = ∑ f ( x ) WMux (4-159)
x=0

for u = 0, 1, 2, … , M − 1, where

WM = e − j 2p M
(4-160)

and M is assumed to be of the form

M = 2p (4-161)

where p is a positive integer. Then it follows that M can be expressed as

M = 2K (4-162)

with K being a positive integer also. Substituting Eq. (4-162) into Eq. (4-159) yields
2 K −1
F (u ) = ∑
x=0
f ( x) W2uxK
(4-163)
K −1 K −1
f (2 x) W2 K( ) 1) W2 K(
u 2 x + 1)
= ∑
x=0
u 2x
+ ∑ f (2 x +
x=0

However, it can be shown using Eq. (4-160) that W22Kux = WKux , so Eq. (4-163) can be
written as

K −1 K −1
F (u ) = ∑
x=0
f (2 x)WKux + ∑
x=0
f (2 x + 1) WKux W2uK (4-164)

Defining
K −1
Feven (u) = ∑
x=0
f (2 x) WKux (4-165)

for u = 0, 1, 2, … , K − 1, and
K −1
Fodd (u) = ∑
x=0
f (2 x + 1)WKux (4-166)

for u = 0, 1, 2, … , K − 1, reduces Eq. (4-164) to

F (u) = Feven (u) + Fodd (u)W2uK (4-167)

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 305 6/16/2017 2:06:39 PM


306 Chapter 4 Filtering in the Frequency Domain

Also, because WMu+ K = WKu and W2uK+ K = −W2uK , it follows that

F (u + K ) = Feven (u) − Fodd (u)W2uK (4-168)

Analysis of Eqs. (4-165) through (4-168) reveals some important (and surprising)
properties of these expressions. An M-point DFT can be computed by dividing the
original expression into two parts, as indicated in Eqs. (4-167) and (4-168). Comput-
ing the first half of F (u) requires evaluation of the two (M 2)-point transforms giv-
en in Eqs. (4-165) and (4-166). The resulting values of Feven (u) and Fodd (u) are then
substituted into Eq. (4-167) to obtain F (u) for u = 0, 1, 2, … , (M 2 − 1). The other
half then follows directly from Eq. (4-168) without additional transform evaluations.
It is of interest to examine the computational implications of the preceding pro-
cedure. Let ᒊ( p) and ᑾ( p) represent the number of complex multiplications and
additions, respectively, required to implement the method. As before, the number
of samples is 2 p , where p is a positive integer. Suppose first that p = 1 so that the
number of samples is two. A two-point transform requires the evaluation of F(0);
then F(1) follows from Eq. (4-168). To obtain F(0) requires computing Feven (0) and
Fodd (0). In this case K = 1 and Eqs. (4-165) and (4-166) are one-point transforms.
However, because the DFT of a single sample point is the sample itself, no multipli-
cations or additions are required to obtain Feven (0) and Fodd (0). One multiplication
of Fodd (0) by W20 and one addition yields F(0) from Eq. (4-167). Then F(1) follows
from Eq. (4-168) with one more addition (subtraction is considered to be the same
as addition). Because Fodd (0)W20 has been computed already, the total number of
operations required for a two-point transform consists of ᒊ(1) = 1 multiplication
and ᑾ(1) = 2 additions.
The next allowed value for p is 2. According to the preceding development, a four-
point transform can be divided into two parts.The first half of F (u) requires evaluation
of two, two-point transforms, as given in Eqs. (4-165) and (4-166) for K = 2. A two-point
transform requires ᒊ(1) multiplications and ᑾ(1) additions. Therefore, evaluation of
these two equations requires a total of 2ᒊ(1) multiplications and 2ᑾ(1) additions. Two
further multiplications and additions are necessary to obtain F(0) and F(1) from Eq.
(4-167). Because Fodd (u)W2uK has been computed already for u = {0, 1} , two more
additions give F(2) and F(3). The total is then ᒊ(2) = 2ᒊ(1) + 2 and ᑾ(2) = 2ᑾ(1) + 4.
When p is equal to 3, two four-point transforms are needed to evaluate Feven (u)
and Fodd (u). They require 2ᒊ(2) multiplications and 2ᑾ(2) additions. Four more
multiplications and eight more additions yield the complete transform. The total
then is then ᒊ(3) = 2ᒊ(2) + 4 multiplication and ᑾ(3) = 2ᑾ(2) + 8 additions.
Continuing this argument for any positive integer p leads to recursive expressions
for the number of multiplications and additions required to implement the FFT:

ᒊ( p) = 2ᒊ( p − 1) + 2 p−1 p≥1 (4-169)

and

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 306 6/16/2017 2:06:43 PM


4.11 The Fast Fourier Transform 307

ᑾ( p) = 2ᑾ( p − 1) + 2 p p≥1 (4-170)

where ᒊ(0) = 0 and ᑾ(0) = 0 because the transform of a single point does not
require any multiplication or additions.
The method just developed is called the successive doubling FFT algorithm
because it is based on computing a two-point transform from two one-point trans-
forms, a four-point transform from two two-point transforms, and so on, for any M
equal to an integer power of 2. It is left as an exercise (see Problem 4.63) to show
that

1
ᒊ( p) = M log 2 M (4-171)
2
and

ᑾ(n) = M log 2 M (4-172)

where M = 2 p.
The computational advantage of the FFT over a direct implementation of the 1-D
DFT is defined as

M2
C( M ) =
M log 2 M
(4-173)
M
=
log 2 M

where M 2 is the number of operations required for a “brute force” implementation


of the 1-D DFT. Because it is assumed that M = 2 p , we can write Eq. (4-173) in
terms of p:
2p
C( p) = (4-174)
p

A plot of this function (Fig. 4.67) shows that the computational advantage increases
rapidly as a function of p. For example, when p = 15 (32,768 points), the FFT has
nearly a 2,200 to 1 advantage over a brute-force implementation of the DFT. Thus,
we would expect that the FFT can be computed nearly 2,200 times faster than the
DFT on the same machine. As you learned in Section 4.1, the FFT also offers signifi-
cant computational advantages over spatial filtering, with the cross-over between
the two approaches being for relatively small kernels.
There are many excellent sources that cover details of the FFT so we will not
dwell on this topic further (see, for example, Brigham [1988]). Most comprehensive
signal and image processing software packages contain generalized implementa-
tions of the FFT that do not require the number of points to be an integer power

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 307 6/16/2017 2:06:44 PM


308 Chapter 4 Filtering in the Frequency Domain

FIGURE 4.67 2400


Computational
advantage of the
FFT over a direct 1800
implementation
of the 1-D DFT.
The number of
samples is M = 2 p. C(p) 1200
The computational
advantage increases 2p
rapidly as a C( p) =
600 p
function of p.

0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
p

of 2 (at the expense of slightly less efficient computation). Free FFT programs also
are readily available, principally over the internet.

Summary, References, and Further Reading


The material in this chapter is a progression from sampling to the Fourier transform, and then to filtering in the
frequency domain. Some of the concepts, such as the sampling theorem, make very little sense if not explained in
the context of the frequency domain. The same is true of effects such as aliasing. Thus, the material developed in
the preceding sections is a solid foundation for understanding the fundamentals of 2-D digital signal processing. We
took special care to develop the material starting with basic principles, so that any reader with a modest mathemati-
cal background would be in a position not only to absorb the material, but also to apply it.
For complementary reading on the 1-D and 2-D continuous Fourier transforms, see the books by Bracewell
[1995, 2003]. These two books, together with Castleman [1996], Petrou and Petrou [2010], Brigham [1988], and
Smith [2003], provide additional background for the material in Sections 4.2 through 4.6. Sampling phenomena
such as aliasing and moiré patterns are topics amply illustrated in books on computer graphics, as exemplified by
Hughes and Andries [2013]. For additional general background on the material in Sections 4.7 through 4.11 see
Hall [1979], Jain [1989], Castleman [1996], and Pratt [2014]. For details on the software aspects of many of the ex-
amples in this chapter, see Gonzalez, Woods, and Eddins [2009].

Problems
Solutions to the problems marked with an asterisk (*) are in the DIP4E Student Support Package (consult the book
website: www.ImageProcessingPlace.com)

4.1 Answer the following: f (t ) = A for 0 ≤ t < T and f (t ) = 0 for all other
(a) * Give an equation similar to Eq. (4-10), but values of t. Explain the reason for any differences
for an impulse located at t = t0 . between your results and the results in the exam-
ple.
(b) Repeat for Eq. (4-15).
4.3 What is the convolution of two, 1-D impulses:
(c) * Is it correct to say that d(t − a) = d(a − t ) in
general? Explain. (a) * d(t ) and d(t − t0 )?

4.2 Repeat Example 4.1, but using the function (b) d(t − t0 ) and d(t + t0 )?

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 308 6/16/2017 2:06:45 PM


Problems 309

4.4 * Use the sifting property of the impulse to show Fig. 4.6, and answer the following questions based
that convolving a 1-D continuous function, f (t ), on your diagram (assume that sampling starts at
with an impulse located at t0 shifts the function t = 0).
so that its origin is moved to the location of the (a) * What is the period of f (t )?
impulse (if the impulse is at the origin, the func-
tion is not shifted). (b) * What is the frequency of f (t )?

4.5 * With reference to Fig. 4.9, give a graphical illustra- (c) * What would the sampled function and its
tion of an aliased pair of functions that are not Fourier transform look like in general if f (t )
periodic. is sampled at a rate higher than the Nyquist
rate?
4.6 With reference to Fig. 4.11:
(d) What would the sampled function look like
(a) * Redraw the figure, showing what the dots in general if f (t ) is sampled at a rate lower
would look like for a sampling rate that than the Nyquist rate?
exceeds the Nyquist rate slightly.
(e) What would the sampled function look like
(b) What is the approximate sampling rate repre- if f (t ) is sampled at the Nyquist rate, with
sented by the large dots in Fig. 4.11? samples taken at t = 0, ± T , ±2T ,… ?
(c) Approximately, what would be the lowest 4.11 * Prove the validity of the convolution theorem of
sampling rate that you would use so that (1) one continuous variable, as given in Eqs. (4-25)
the Nyquist rate is satisfied, and (2) the sam- and (4-26).
ples look like a sine wave?
4.12 We explained in the paragraph after Eq. (4-36) that
4.7 A function, f (t ), is formed by the sum of three arbitrarily limiting the duration of a band-limit-
functions, f1 (t ) = A sin(pt ), f2 (t ) = B sin(4pt ), ed function by multiplying it by a box function
and f3 (t ) = C cos(8pt ). would cause the function to cease being band
(a) Assuming that the functions extend to infin- limited. Show graphically why this is so by limit-
ity in both directions, what is the highest fre- ing the duration of the function f (t ) = cos(2pm0 t )
quency of f (t )? (Hint: Start by finding the [the Fourier transform of this function is given in
period of the sum of the three functions.) Problem 4.9(a)]. (Hint: The transform of a box
function is given in Example 4.1. Use that result
(b) * What is the Nyquist rate corresponding to
in your solution, and also the fact that convolu-
your result in (a)? (Give a numerical answer.)
tion of a function with an impulse shifts the func-
(c) At what rate would you sample f (t ) so that tion to the location of the impulse, in the sense
perfect recovery of the function from its discussed in the solution of Problem 4.4.)
samples is possible?
4.13 * Complete the steps that led from Eq. (4-37) to
4.8 * Show that ᑣ{e j 2 pt0 t } = d(m − t0 ), where t0 is a con- Eq. (4-38).
stant. (Hint: Study Example 4.2.)  m) in Eq. (4-40) is infinitely periodic
4.14 Show that F(
4.9 Show that the following expressions are true. in both directions, with period 1 T .
(Hint: Make use of the solution to Problem 4.8):
4.15 Do the following:
1
(a) * ᑣ {cos(2pm0 t )} = [ d(m − m0 ) + d(m + m0 )] (a) Show that Eqs. (4-42) and (4-43) are a Fou-
2
1 rier transform pair: fn ⇔ Fm .
(b) ᑣ {sin(2pm0 t )} = [ d(m − m0 ) − d(m + m0 )]
2j (b) * Show that Eqs. (4-44) and (4-45) also are a
Fourier transform pair: f ( x) ⇔ F (u).
4.10 Consider the function f (t ) = sin(2pnt ), where
n is an integer. Its Fourier transform, F(m), is You will need the following orthogonality prop-
purely imaginary (see Problem 4.9). Because the erty in both parts of this problem:
 m), of sampled data consists of peri-
transform, F(
 m) will also M −1
⎧M if r = u
odic copies of F(m), it follows that F(
∑ e j 2 prx M e − j 2 pux M =⎨
be purely imaginary. Draw a diagram similar to x=0 ⎩0 otherwise

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 309 6/16/2017 2:06:47 PM


310 Chapter 4 Filtering in the Frequency Domain

4.16 Show that both F (u) and f ( x) in Eqs. (4-44) and same size are four pixels wide. Sketch what
(4-45) are infinitely periodic with period M; that is, the spectrum of the image would look like,
F (u) = F (u + kM ) and f ( x) = f ( x + M ), where k including only the dc term and the two high-
is an integer. [See Eqs. (4-46) and (4-47).] est-value frequency terms, which correspond
to the two spikes in the spectrum above.
4.17 Demonstrate the validity of the translation (shift)
properties of the following 1-D, discrete Fourier (b) Why are the components of the spectrum
transform pairs. (Hint: It is easier in part (b) to limited to the horizontal axis?
work with the IDFT.) (c) What would the spectrum look like for an
(a) * f ( x) e j 2 pu0 x M
⇔ F (u − u0 ) image of the same size but having stripes that
are one pixel wide? Explain the reason for
(b) f ( x − x0 ) ⇔ F (u) e − j 2 pux0 M
your answer.
4.18 Show that the 1-D convolution theorem given in (d) Are the dc terms in (a) and (c) the same, or
Eqs. (4-25) and (4-26) also holds for discrete vari- are they different? Explain.
ables, but with the right side of Eq. (4-26) multi- 4.22 A high-technology company specializes in devel-
plied by 1 M. That is, show that oping imaging systems for digitizing images of
(a) * ( f 夹 h)( x) ⇔ (F i H )(u), and commercial cloth. The company has a new order
1 for 1,000 systems for digitizing cloth consisting of
(b) ( f i h)( x) ⇔ (F 夹 H )(u) repeating black and white vertical stripes, each
M
4.19 * Extend the expression for 1-D convolution [see of width 2 cm. Optical and mechanical engineers
Eq. (4-24)] to two continuous variables. Use t and have already designed the front-end optics and
z for the variables on the left side of the expression mechanical positioning mechanisms so that you
and a and b for the variables in the 2-D integral. are guaranteed that every image your system digi-
tizes starts with a complete black vertical stripe
4.20 Use the sifting property of the 2-D impulse to
and ends with a complete white stripe. Every
show that convolution of a 2-D continuous func-
image acquired will contain exactly 250 vertical
tion, f (t, z), with an impulse shifts the function
stripes. Noise and optical distortions are negligi-
so that its origin is located at the location of the
ble. Having learned of your success in taking an
impulse. (If the impulse is at the origin, the func-
image processing course, the company employs
tion is copied exactly as it was.) (Hint: Study the
you to specify the resolution of the imaging chip
solution to Problem 4.4).
to be used in the new system. The optics can be
4.21 The image on the left in the figure below consists adjusted to project the field of view accurately
of alternating stripes of black/white, each stripe onto the area defined by the size of the chip you
specify. Your design will be implemented in hun-
dreds of locations, so cost is an important consid-
eration. What resolution chip (in terms of number
of imaging elements per horizontal line) would
you specify to avoid aliasing?
4.23 * We know from the discussion in Section 4.5 that
zooming or shrinking a digital image generally
causes aliasing. Give an example of an image that
would be free of aliasing if it were zoomed by
being two pixels wide. The image on the right
pixel replication.
is the Fourier spectrum of the image on the left,
showing the dc term and the frequency terms cor- 4.24 With reference to the discussion on linearity in
responding to the stripes. (Remember, the spec- Section 2.6, demonstrate that
trum is symmetric so all components, other than (a) * The 2-D continuous Fourier transform is a
the dc term, appear in two symmetric locations.) linear operator.
(a) * Suppose that the stripes of an image of the (b) The 2-D DFT is a linear operator also.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 310 6/16/2017 2:06:49 PM


Problems 311

4.25 With reference to Eqs. (4-59) and (4-60), show the 4.30 What is period and frequency of each of following
validity of the following translation (shift) prop- digital sequences (Hint: Think of these as square
erties of 2-D, continuous Fourier transform pairs. waves.)
(Hint: Study the solutions to Problem 4.11.) (a) * 0 1 0 1 0 1 0 1 . . .
(a) * f (t , z) e j 2 p( m0 t + n0 z) ⇔ F (m − m0 , n − n0 ) (b) 0 0 1 0 0 1 0 0 1 . . . .
(b) f (t − t0 , z − z0 ) ⇔ F (m, n) e − j 2 p(t0 m + z0 n ) (c) 0 0 1 1 0 0 1 1 0 0 1 1 . . .
4.26 Show the validity of the following 2-D continuous 4.31 With reference to the 1-D sequences in Example
Fourier transform pairs. 4.10:
(a) * d(t , z) ⇔ 1 (a) * When M is even, why is the point at M 2 in
(b) * 1 ⇔ d(m, n) an even sequence always arbitrary?

(c) * d(t − t0 , z − z0 ) ⇔ e − j 2 p(t0 m + z0 n ) (b) When M is even, why is the point at M 2 in


an odd sequence always 0?
(d) e j 2 p(t0 t + z0 z) ⇔ d(m − t0 , n − z0 )
4.32 We mentioned in Example 4.10 that embedding a
(e) * cos(2pm0 t + 2pn0 z) ⇔ 2-D array of even (odd) dimensions into a larger
(1 2)[ d(m − m0 , n − n0 ) + d(m + m0 , n + n0 )] array of zeros of even (odd) dimensions keeps the
(f) sin( 2pm0 t + 2pn0 z) ⇔ symmetry of the original array, provided that the
centers coincide. Show that this is true also for
(1 2 j )[ d(m − m0 , n − n0 ) − d(m + m0 , n + n0 )] the following 1-D arrays (i.e., show that the larger
4.27 With reference to Eqs. (4-71) and (4-72), dem- arrays have the same symmetry as the smaller
onstrate the validity of the following translation arrays). For arrays of even length, use arrays of
(shifting) properties of 2-D, discrete Fourier trans- 0’s ten elements long. For arrays of odd lengths,
form pairs from Table 4.4. (Hint: Study the solu- use arrays of 0’s nine elements long.
tions to Problem 4.17.) (a) * {a, b, c, c, b}
(a) f ( x, y) e j 2 p( u0 x M + v0 y N )
⇔ F (u − u0 , v − v0 ) (b) {0, − b, − c, 0, c, b}
(b) * f ( x − x0 , y − y0 ) ⇔ F (u, v) e − j 2 p( x0 u M + y0 v N )
(c) {a, b, c, d, c, b}
4.28 Show the validity of the following 2-D discrete (d) {0, − b, − c, c, b}
Fourier transform pairs from Table 4.4:
4.33 In Example 4.10 we showed a Sobel kernel
(a) * d(x, y) ⇔ 1 embedded in a field of zeros. The kernel is of size
(b) * 1 ⇔ MNd(u, v) 3 × 3 and its structure appears to be odd. However,
its first element is −1, and we know that in order
(c) d( x − x0 , y − y0 ) ⇔ e − j 2 p(ux0 M + vy0 N )
to be odd, the first (top, left) element a 2-D array
j 2 p( u0 x M + v0 y N )
(d) * e ⇔ MN d(u − u0 , v − v0 ) must be zero. Show the smallest field of zeros in
(e) cos(2pm0 x M + 2pn0 y N ) ⇔ which you can embed the Sobel kernel so that it
satisfies the condition of oddness.
(MN 2) [ d(u + m0 , v + v0 ) + d(u − u0 , v − v0 )]
4.34 Do the following:
(f) * sin(2pm0 x M + 2pn0 y N ) ⇔
(a) * Show that the 6 × 6 array in Example 4.10 is
( jMN 2) [ d(u + m0 , v + v0 ) − d(u − u0 , v − v0 )]
odd.
4.29 You are given a “canned” program that computes
(b) What would happen if the minus signs are
the 2-D, DFT pair. However, it is not known
changed to pluses?
in which of the two equations the 1 MN term
is included or if it was split as two constants, (c) Explain why, as stated at the end of the exam-
1 MN , in front of both the forward and inverse ple, adding to the array another row of 0’s on
transforms. How can you find where the term(s) the top and column of 0’s to the left would
is (are) included if this information is not avail- give a result that is neither even nor odd.
able in the documentation? (d) Suppose that the row is added to the bot-

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 311 6/16/2017 2:06:51 PM


312 Chapter 4 Filtering in the Frequency Domain

tom and the column to the right? Would that ed it by a border of zeros instead (see image on
change your answer in (c)? the right), but without changing the total number
of zeros used? Explain.
4.35 The following problems are related to the proper-
ties in Table 4.1.
(a) * Demonstrate the validity of property 2.
(b) * Demonstrate the validity of property 4.
(c) Demonstrate the validity of property 5.
(d) * Demonstrate the validity of property 7.
(e) Demonstrate the validity of property 9.
4.36 You know from Table 4.3 that the dc term, F(0, 0),
of a DFT is proportional to the average value of 4.42 * The two Fourier spectra shown are of the same
its corresponding spatial image. Assume that the image. The spectrum on the left corresponds to
image is of size M × N . Suppose that you pad the the original image, and the spectrum on the right
image with zeros to size P × Q, where P and Q was obtained after the image was padded with
are given in Eqs. (4-102) and (4-103). Let Fp (0, 0) zeros. Explain the significant increase in signal
denote the dc term of the DFT of the padded strength along the vertical and horizontal axes of
function. the spectrum shown on the right.
(a) * What is the ratio of the average values of the
original and padded images?
(b) Is Fp (0, 0) = F (0, 0)? Support your answer
mathematically.
4.37 Demonstrate the validity of the periodicity prop-
erties (entry 8) in Table 4.3.
4.38 With reference to the 2-D discrete convolution
theorem in Eqs. (4-95) and (4-96) (entry 6 in
Table 4.4), show that
(a) ( f 夹 h)( x, y) ⇔ (F i H )(u, v)
(b) * ( f i h)( x, y) ⇔ (1 MN )[(F 夹 H )(u, v)]
4.43 Consider the images shown. The image on the
(Hint: Study the solution to Problem 4.18.) right was obtained by: (a) multiplying the image
4.39 With reference to the 2-D discrete correlation on the left by (−1)x + y ; (b) computing the DFT; (c)
theorem (entry 7 in Table 4.4), show that taking the complex conjugate of the transform;
(a) * ( f 夽 h)( x, y) ⇔ (F *i H )(u, v) (d) computing the inverse DFT; and (e) multiply-
ing the real part of the result by (−1)x + y . Explain
(b) ( f *i h)( x, y) ⇔ (1 MN )[(F 夽 H )(u, v)] (mathematically) why the image on the right
4.40 * Demonstrate validity of the differentiation pairs appears as it does.
in entry 12 of Table 4.4.
4.41 We discussed in Section 4.6 the need for image
padding when filtering in the frequency domain.
We showed in that section that images could be
padded by appending zeros to the ends of rows
and columns in the image (see the following
image, on the left). Do you think it would make a
difference if we centered the image and surround-

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 312 6/16/2017 2:06:52 PM


Problems 313

4.44 * The image in Fig. 4.34(b) was obtained by mul- the filter. Can you predict (without doing the
tiplying by −1 the phase angle of the image in experiment) what the result (image) will be
Fig. 4.34(a), and then computing the IDFT. With for a sufficiently large value of K? If so, what
reference to Eq. (4-86) and entry 5 in Table 4.1, is that result?
explain why this operation caused the image to be (b) Let cmin denote the smallest positive num-
reflected about both coordinate axes. ber representable in the machine in which
4.45 In Fig. 4.34(b) we saw that multiplying the phase the proposed experiment will be conducted
angle by −1 flipped the image with respect to both (any number < cmin is automatically set to 0).
coordinate axes. Suppose that instead we multi- Derive an expression (in terms of cmin ) for
plied the magnitude of the transform by −1 and the minimum value of K that will guarantee
then took the inverse DFT using the equation: the result that you predicted in (a).
{
g( x, y) = ᑣ−1 − F (u, v) e jf( u,v ) . } 4.50 As explained in Section 3.6, first-order deriva-
(a) * What would be the difference between the tives can be approximated by the spatial differ-
two images g( x, y) and f ( x, y)? [Remember, ences g x = ∂f ( x, y) ∂x = f ( x + 1, y) − f ( x, y) and
F(u, v) is the DFT of f ( x, y).] g y = ∂f ( x, y) ∂y = f ( x, y + 1) − f ( x, y).
(b) Assuming that they are both 8-bit images, (a) Find the equivalent filter transfer func-
what would g( x, y) look like in terms of tions H x (u, v) and H y (u, v) in the frequency
f ( x, y) if we scaled the intensity values of domain.
g( x, y) using Eqs. (2-31) and (2-32), with (b) Show that these are highpass filter transfer
K = 255? functions.
4.46 What is the source of the nearly periodic bright (Hint: Study the solution to Problem 4.47.)
spots on the horizontal axis of Fig. 4.40(b)? 4.51 Find the equivalent frequency-domain filter
4.47 * Consider a 3 × 3 spatial kernel that averages transfer function for the Laplacian kernel shown
the four closest neighbors of a point ( x, y), but in Fig. 3.45(a). Show that your result behaves as a
excludes the point itself from the average. highpass filter transfer function. (Hint: Study the
solution to Problem 4.47.)
(a) Find the equivalent filter transfer function,
H(u, v), in the frequency domain. 4.52 Do the following:
(b) Show that your result is a lowpass filter trans- (a) Show that the Laplacian of a continuous
fer function. function f (t , z) of two continuous variables,
t and z, satisfies the following Fourier trans-
4.48 * A continuous Gaussian lowpass filter in the con-
form pair:
tinuous frequency domain has the transfer func-
tion 2
f (t, z) ⇔ −4p2 (m 2 + n 2 )F (m, n)
2
+ n2 ) 2 s 2
H (m, n) = Ae −( m (Hint: See Eq. (3-50) and study entry 12 in
Table 4.4.)
Show that the corresponding filter kernel in the
continuous spatial domain is (b) * The result in (a) is valid only for continuous
2 2 2 2
variables. How would you implement the
h(t , z) = A2ps 2 e −2 p s (t + z )
continuous frequency domain transfer func-
tion H(m, n) = −4p 2 (m2 + n 2 ) for discrete
4.49 Given an image of size M × N , you are asked to variables?
perform an experiment that consists of repeat-
(c) As you saw in Example 4.21, the Laplacian
edly lowpass filtering the image in the frequency
result in the frequency domain was similar to
domain using a Gaussian lowpass filter transfer
the result in Fig. 3.46(d), which was obtained
function with a cutoff frequency, D0 . You may
using a spatial kernel with a center coeffi-
ignore computational round-off errors.
cient equal to −8. Explain why the frequency
(a) * Let K denote the number of applications of domain result was not similar instead to the

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 313 6/16/2017 2:06:55 PM


314 Chapter 4 Filtering in the Frequency Domain
result in Fig. 3.46(c), which was obtained dark, since a highpass filter eliminates the dc
using a kernel with a center coefficient of −4. term and reduces low frequencies?
4.53 * Can you think of a way to use the Fourier trans- (b) Do you think the result would have been dif-
form to compute (or partially compute) the ferent if the order of the filtering process had
magnitude of the gradient [Eq. (3-58)] for use in been reversed?
image differentiation? If your answer is yes, give 4.58 Consider the sequence of images shown below.
a method to do it. If your answer is no, explain The image on the top left is a segment of an X-ray
why. image of a commercial printed circuit board. The
4.54 As explained in Eq. (4-118), it is possible to obtain images following it are, respectively, the results of
the transfer function of a highpass filter from the subjecting the image to 1, 10, and 100 passes of a
transfer function of a lowpass filter by subtract- Gaussian highpass filter with D0 = 30. The images
ing the latter from 1. What is the highpass spatial are of size 330 × 334 pixels, with each pixel being
kernel corresponding to the lowpass Gaussian represented by 8 bits of gray. The images were
transfer function given in Problem 4.48? scaled for display, but this has no effect on the
problem statement.
4.55 Each spatial highpass kernel in Fig. 4.52 has a
strong spike in the center. Explain the source of
this spikes.
4.56 * Show how the Butterworth highpass filter trans-
fer function in Eq. (4-121) follows from its low-
pass counterpart in Eq. (4-117).
4.57 Consider the hand X-ray images shown below.
The image on the right was obtained by lowpass

(Original image courtesy of Mr. Joseph E. Pascente, Lixi, Inc.)


(Original image courtesy of Dr. Thomas R. Gest, Division
of Anatomical Sciences, University of Michigan Medical
School.) (a) It appears from the images that changes will
cease to take place after a finite number of
filtering the image on the left with a Gaussian passes. Show whether or not this is the case.
lowpass filter, and then highpass filtering the You may ignore computational round-off
result with a Gaussian highpass filter. The images errors. Let cmin denote the smallest positive
are of size 420 × 344 pixels and D0 = 25 was used number representable in the machine in
for both filter transfer functions. which the computations are conducted.

(a) * Explain why the center part of the finger ring (b) If you determined in (a) that changes would
in the figure on the right appears so bright cease after a finite number of iterations,
and solid, considering that the dominant determine the minimum value of that num-
characteristic of the filtered image consists ber.
of edges of the fingers and wrist bones, with (Hint: Study the solution to Problem 4.49.)
darker areas in between. In other words,
would you not expect the highpass filter to 4.59 As illustrated in Fig. 4.57, combining high-fre-
render the constant area inside the ring as quency emphasis and histogram equalization is

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 314 6/16/2017 2:06:55 PM


Problems 315
an effective method for achieving edge sharpen- 4.62 How would you generate an image of only the
ing and contrast enhancement. interference pattern visible in Fig. 4.64(a)?
(a) * Show whether or not it matters which pro- 4.63 * Show the validity of Eqs. (4-171) and (4-172).
cess is applied first. (Hint: Use proof by induction.)
(b) If the order does matter, give a rationale for 4.64 A skilled medical technician is assigned the job of
using one or the other method first. inspecting a set of images generated by an elec-
tron microscope experiment. In order to simplify
4.60 Use a Butterworth highpass filter to construct a
the inspection task, the technician decides to use
homomorphic filter transfer function that has the
digital image enhancement and, to this end, exam-
same general shape as the function in Fig. 4.59.
ines a set of representative images and finds the
4.61 Suppose that you are given a set of images gener- following problems: (1) bright, isolated dots that
ated by an experiment dealing with the analysis of are of no interest; (2) lack of sharpness; (3) not
stellar events. Each image contains a set of bright, enough contrast in some images; and (4) shifts
widely scattered dots corresponding to stars in in the average intensity to values other than A0 ,
a sparsely occupied region of the universe. The which is the average value required to perform
problem is that the stars are barely visible as a correctly certain intensity measurements. The
result of superimposed illumination from atmo- technician wants to correct these problems and
spheric dispersion. If these images are modeled as then display in white all intensities in a band
the product of a constant illumination component between intensities I1 and I 2 , while keeping nor-
with a set of impulses, give an enhancement pro- mal tonality in the remaining intensities. Propose
cedure based on homomorphic filtering designed a sequence of processing steps that the technician
to bring out the image components due to the can follow to achieve the desired goal. You may
stars themselves. use techniques from both Chapters 3 and 4.

www.EBooksWorld.ir

DIP4E_GLOBAL_Print_Ready.indb 315 6/16/2017 2:06:56 PM

You might also like