Buku Gonzales-Halaman
Buku Gonzales-Halaman
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.
203
www.EBooksWorld.ir
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.
www.EBooksWorld.ir
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.
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
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.
www.EBooksWorld.ir
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,
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,
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
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).
www.EBooksWorld.ir
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)
x x
0 x0 . . . 3X 2X X 0 X 2X 3X . . .
www.EBooksWorld.ir
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.
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
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.
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
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.
www.EBooksWorld.ir
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
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.
www.EBooksWorld.ir
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)
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
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.
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
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 ...
{ }
F (m) = ᑣ f (t ) = ᑣ { f (t )sT (t )}
(4-29)
= (F 夹 S )(m)
www.EBooksWorld.ir
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.
†
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
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
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
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
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
... ...
m
m max 0 m max
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
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
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
~
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 ).
www.EBooksWorld.ir
...
... 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.
www.EBooksWorld.ir
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.
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.
www.EBooksWorld.ir
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
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)
†
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
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).
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
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.
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
⎧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
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
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
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.
www.EBooksWorld.ir
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)
... ...
t z
... Z T ...
www.EBooksWorld.ir
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.
www.EBooksWorld.ir
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
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.
www.EBooksWorld.ir
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.
www.EBooksWorld.ir
www.EBooksWorld.ir
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.)
www.EBooksWorld.ir
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
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.
In this section, we introduce several properties of the 2-D discrete Fourier transform
and its inverse.
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
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.
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,
www.EBooksWorld.ir
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
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)
we ( x, y) = we (− x, − y) (4-80)
and
www.EBooksWorld.ir
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.
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
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
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
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
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.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
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
www.EBooksWorld.ir
1/ 2
F (u, v) = ⎡⎣ R 2 (u, v) + I 2 (u, v)⎤⎦ (4-87)
⎡ 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:
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
F (0, 0) = MN f (4-93)
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
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
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
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.
www.EBooksWorld.ir
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
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
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
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
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) ⎦
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
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
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
In this section, we lay the groundwork for all the filtering techniques discussed in the
remainder of the chapter.
www.EBooksWorld.ir
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).
{ }
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
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
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
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
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
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
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.
www.EBooksWorld.ir
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.
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
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.
www.EBooksWorld.ir
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
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)
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
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
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.
www.EBooksWorld.ir
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.
⎧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
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
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
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
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.
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
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.
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
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
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
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.
www.EBooksWorld.ir
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
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
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.
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
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
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
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
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
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
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.
H (u, v) = − 4p 2 (u 2 + v 2 ) (4-123)
www.EBooksWorld.ir
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)
g( x, y) = f ( x, y) + c∇ 2 f ( x, y) (4-126)
{
= ᑣ−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
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.
with
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
We can express this result in terms of a highpass filter using Eq. (4-118):
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.
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
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)
ᑣ [ z( x, y)] = ᑣ [ ln f ( x, y)]
(4-137)
= ᑣ [ ln i( x, y)] + ᑣ [ ln r( x, y)]
www.EBooksWorld.ir
or
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
By defining
and
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
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.
gL
D(u, v)
www.EBooksWorld.ir
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.)
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
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.
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
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
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.
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
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
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
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
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
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
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).
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.
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
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.
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).
www.EBooksWorld.ir
(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)
M = 2p (4-161)
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)
www.EBooksWorld.ir
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:
and
www.EBooksWorld.ir
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
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
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
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.
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
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
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
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?
www.EBooksWorld.ir
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
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
(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
www.EBooksWorld.ir