Digital Image Processing
Digital Image Processing
a c
b
e d f
FIGURE 4.53Top row: The image from Fig. 4.40(a) filteredwith 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.
b c
a
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.
93
b c
a
FIGURE 4.55(a) Smudged thumbprint. (b) Result ofhighpass filtering (a). (c) Result of
thresholding (b). (Original
image courtesy of the U.S. National Institute of Standards and Technology.)
mudging. Enhancement of the ridges is accomplished by the fact that their boundaries are
s
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.
94
In Section 3.6, we used the Laplacian for image sharpening in the spatial domain. In
this section, we revisit the Laplacian and show that it yields equivalent results using
frequency domain techniques. It can be shown (see Problem 4.52) that the Laplacian
can be implemented in the frequency domain using the filter transfer function
or, with respect to the center of the frequency rectangle, using the
transfer function
2
H(u,v)= - 4π [(𝑢 − 𝑝 /2)2 + (𝑣 − 𝑄/ 2)2]
2 2
= -4π 𝐷 (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 xy ( , ), is obtained in the familiar manner:
2 −1
∆ f(x,y)=ϑ [H(u,v) F(u,v)]
2
g(x,y)= f(x,y) + c∆ f(x,y) (4-126)
2
Here, c = −1 because H( , u v) is negative. In Chapter 3, f(x,y) and∆ f(x,y)had
2
omparable values. However, computing∆ 𝑓( 𝑥, 𝑦) with Eq. (4-125) introduces DFT
c
scaling factors that can be several orders of magnitude larger than the maximum
value of f. Thus, the differences between f and its Laplacian must be brought into
95
comparable ranges. The easiest way to handle this problem is to normalize the val-
2
es of f(x,y to the range [0,1] before computing its DFT and divide∆ 𝑓( 𝑥, 𝑦) (,) by
u
its maximum value, which will bring it to the approximate range [ -1,1 ]. (Remember,
the Laplacian has negative values.) Equation (4-126) can then be used.
We can write Eq. (4-126) directly in the frequency domain as
−1
g(x,y)=ℑ {𝐹( 𝑢, 𝑣) − 𝐻( 𝑢, 𝑣)𝐹( 𝑢, 𝑣)}
−1
=ℑ {[1 − 𝐻(𝑢, 𝑣)] 𝐹(𝑢, 𝑣)}
−1
=ℑ
{[1 − 𝐻( 𝑢, 𝑣)]𝐹( 𝑢, 𝑣)}
lthough this result is elegant, it has the same scaling issues just mentioned, com-
A
pounded by the fact that the normalizing factor is not as easily computed. For this
2
r eason, Eq. (4-126) is the preferred implementation in the frequency domain, with∆ 𝑓( 𝑥, 𝑦)
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.
igure 4.56(a) is the same as Fig. 3.46(a), and Fig. 4.56(b) shows the result of using Eq.
F
(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
96
b
A
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.)
ncompasses a very small neighborhood, while the formulation in Eqs. (4-125) and
e
(4-126) encompasses
the entire image.
In this section, we discuss frequency domain formulations of the unsharp mask-
ing and high-boost filtering image sharpening techniques introduced in Section 3.6.
Using frequency domain methods, the mask defined in Eq. (3-55) is given by
With
−1
𝑓𝐿𝑃(𝑥, 𝑦)=ℑ [𝐻𝐿𝑃(𝑢, 𝑣) 𝑓(𝑢, 𝑣)]
here HLP(,) u v is a lowpass filter transfer function, and F( , u v) is the DFT of f(x,y).
w
Here,𝑓𝐿𝑃(𝑥, 𝑦)is a smoothed image analogous tof xy (,) in Eq. (3-55). Then, as in
97
We can express this result in terms of a highpass filter using Eq. (4-118):
g(x,y)=ℑ
−1
{[1 + 𝑘𝐻 (𝑢, 𝑣) ]𝑓( 𝑢, 𝑣)}
𝐿𝑃
−1
g(x,y)=ℑ {[𝑘1 + 𝑘2 𝐻 𝐻𝑃(𝑢, 𝑣)]𝑓(𝑢, 𝑣}
here k1 ≥ 0 offsets the value the transfer function so as not to zero-out the dc term
w
[see Fig. 4.30(c)], and k2 > 0 controls the contribution of high frequencies.
igure 4.57(a) shows a 503 720 × -pixel chest X-ray image with a narrow range of intensity
F
levels. The objective of this example is to enhance the image using high-frequency-emphasis
filtering. X-rays can- not be focused in the same manner that optical lenses can, and the
resulting images generally tend to be slightly blurred. Because the intensities in this particular
image are biased toward the dark end of the
98
b
A
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.)
ray scale, we also take this opportunity to give an example of how spatial domain processing
g
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). Asexpected, the image is rather
featureless, but the important boundaries (e.g., the edges of the ribs) areclearly 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.
99
s we discussed in Section 3.3, an image characterized by intensity levels in a narrow range of
A
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
f(x,y)=i(x,y)r(x,y)
his equation cannot be used directly to operate on the frequency components of
T
illumination and reflectance because the Fourier transform of a product is not the
product of the transforms:
z(x,y)=In f(x,y)
= In i(x,y) + In r(x,y)
Then
ℑ[𝑧(𝑥, 𝑦)] =ℑ[𝐼𝑛𝑓(𝑥, 𝑦) ]
=ℑ[In I(x,y)] +ℑ[ In r(x,y)]
Or
where𝐹𝑖(
𝑢, 𝑣)and 𝐹𝑟(
𝑢, 𝑣)are the Fouriertransforms of ln(x,y) and ln(x,y)
respectively.
100
We can filter Z(u,v) using a filter transfer function H(u,v) so that
−1
s(x,y) =ℑ [ S (u,v)]
−1 −1
=ℑ [𝐻(𝑢, 𝑣)𝐹𝑖(
𝑢, 𝑣)] +ℑ [H(u,v)𝐹𝑟(
𝑢, 𝑣)]
By defining
' −1
𝑖(𝑥, 𝑦) =ℑ [H(u,v)𝐹𝑖(
𝑢, 𝑣)]
And
' −1
𝑟(x,y) =ℑ [H(u,v)𝐹𝑟(
𝑢, 𝑣) ]
we can express Eq. (4-140) in the form
' '
s(x,y) =𝑖(x,y) +𝑟(x,y)
inally, because z(x,y) was formed by taking the natural logarithm of the input
F
image, we reverse the process by taking the exponential of the filtered result to form
the output image:
𝑠(𝑥,𝑦)
g(x,y) =𝑒
𝑖'(𝑥,𝑦) 𝑟'( 𝑥,𝑦)
𝑒
= 𝑒
=𝑖0(
𝑥,
𝑦
) 𝑟0(
𝑥, 𝑦)
Where
𝑖'(𝑥,𝑦)
𝑖0( x,y) =𝑒
And
𝑟'(𝑥,𝑦)
𝑟0(
𝑥, 𝑦) =𝑒
IGURE 4.58
F
Summary of
steps
in
homomorphic
filtering.
nd reflectance components achieved in the form shown in Eq. (4-138). The homo-
a
morphic filter transfer function, H(u,v), then can operate on these components sepa-
rately, as indicated by Eq. (4-139).
good deal of control can be gained over the illumination and reflectance com-
A
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
transfer function. For example, using a slightly modified form of the GHPF function
yields the homomorphic function
2 2
−𝑐𝐷 (𝑢,𝑣) /𝐷0
H(u,v) = (γ𝐻 − γ𝐿) [ 1 -𝑒 ] +γ𝐿
here D(u, v) is defined in Eq. (4-112) and constant c controls the sharpness of the
w
slope of the function as it transitions betweenγ𝐿a
ndγ𝐻 . This filter transfer function is similarto
the high-frequency-emphasis function discussed in the previous section.
102
FIGURE
.59Radial
4
cross
section of a
homomorphic
filter transfer
function..
IGURE 4.60
F
(a) Full body PET
scan. (b) Image
enhanced using
homomorphic
filtering. (Original
image courtesy
of Dr. Michael E.
Casey, CTI Pet
Systems.)
103
igure 4.60(a) shows a full body PET (Positron Emission Tomography) scan of size 1162 746 ×
F
pixels.The image is slightly blurred and many of its low-intensity features are obscured by the
high intensity of the “hot spots” dominating the dynamic range of the display. (These hot spots
were caused by a tumor in the brain and one in the lungs.) Figure 4.60(b) was obtained by
homomorphic filtering Fig. 4.60(a) using the filter transfer function in Eq. (4-147) withγ𝐿 = 04. ,
γ𝐻 = 3 0. , c = 5, and𝐷0 = 20. A radialcross sec- tion of this function looks just like Fig. 4.59, but
ith a much sharper slope, and the transition between low and high frequencies much closer to
w
the origin. Note in Fig. 4.60(b) how much sharper the hot spots, the brain, and the skeleton are
in the processed image, and how much more detail is visible in this image, including, for
example, some of the organs, the shoulders, and the pelvis region. By reducing the effects of
the dominant illumination components (the hot spots), it became possible for the dynamic range
of the display to allow lower intensities to become more visible. Similarly, because the high
frequencies are enhanced by homomorphic filtering, the reflec- tance components of the image
(edge information) were sharpened considerably. The enhanced image in Fig. 4.60(b) is a
significant improvement over the original.
SELECTIVE FILTERING
he filters discussed in the previous two sections operate over the entire frequency
T
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
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.
s you learned in Section 3.7, bandpass and bandreject filter transfer functions in
A
the frequency domain can be constructed by combining lowpass and highpass filter
transfer functions, with the latter also being derivable from lowpass functions (see
Fig. 3.52). In other words, lowpass filter transfer functions are the basis for forming
highpass, bandreject, and bandpass filter functions. Furthermore, a bandpass filter
transfer function is obtained from a bandreject function in the same manner that we
obtained a highpass from a lowpass transfer function:
igure 4.61(a) shows how to construct an ideal bandreject filter (IBRF) transfer
F
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,𝐶0 , of the band. An equationfor the IBRF function is easily
btained by inspection from Fig, 4.61(a), as the leftmost entry in Table 4.7 shows.
o
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𝐶0f rom the origin (center) of the function;and (3) we must be able to specify
value for W. Clearly, the IBRF function just developed satisfies these requirements.
a
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𝐶0. We could
b
a
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𝐶0.)(c) Radial plot of Eq. (4-149).(The minimum is 0 and is properly aligned with
𝐶0, 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.
ABLE 4.7
T
Bandreject filter transfer functions.𝐶0i s thecenter of the band, W is the width of the band, and
( , u v) is the dis-
D
tance from the center of the transfer function to a point (u, v) in the frequency rectangle.
105
ffset the function and scale it so that values fall in the range [0, 1] but finding an
o
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𝐶0. The only alternativesare trial-and-error or numerical methods.
ortunately, instead of adding lowpass and highpass transfer function, an alterna-
F
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) =𝐶0in Eq. (4-120):
2
⎡ 𝐷( 𝑢,𝑣) −𝐶0 ) ⎤
−⎢ 2 ⎥
𝑊
⎣ ⎦
H(u,v)= 1-𝑒
A plot of this function [Fig. 4.61(c)] shows that, below𝐶0, the function behaves as a
lowpass Gaussian function, at𝐶0the functionwill always be 0, and for values higher
than𝐶0t he function behaves as a highpass Gaussianfunction. Parameter W is pro-
ortional to the standard deviation and thus controls the “width” of the band. The
p
only problem remaining is that the function is not always 1 at the origin. A simple
modification of Eq. (4-149) removes this shortcoming:
⎡ 𝐷2(𝑢,𝑣)− 22
𝐶
⎤
− ⎢⎢ 𝐷( 𝑢,𝑣) 𝑊0 ⎥
⎥
⎢ ⎥
⎣ ⎦
H(u,v)= 1-𝑒
ow, the exponent is infinite when D(u, v) , = 0 which makes the exponential term go
N
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.
106
t first glance the Gaussian and Butterworth functions appear to be about the same,
A
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
A b c
IGURE 4.62Perspective plots of (a) ideal, (b) modifiedGaussian, and (c) modified Butterworth
F
(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
otch filters are the most useful of the selective filters. A notch filter rejects (or
N
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(𝑢0, 𝑣0) must have a
corresponding notch at location (-𝑢0, − 𝑣0)Notch reject filter transfer functions are
onstructed as products of highpass filter transfer functions whose centers have
c
been translated to the centers of the notches. The general form is:
𝑄
𝐻𝑁𝑅(𝑢, 𝑣)= ∏ 𝐻𝐾 = (𝑢, 𝑣) 𝐻−𝐾(
𝑢, 𝑣)
𝑘=1
where𝐻𝑘(
𝑢, 𝑣) and𝐻−𝑘(
𝑢, 𝑣) are highpassfilter transfer functions whose centers are
at (𝑢𝑘, 𝑣𝑘) and (-𝑢𝑘, − 𝑣𝑘) 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
107
umber of rows and columns in the input image. Thus, the distance computations for
n
each filter transfer function are given by
300 Chapter 4 Filtering in the Frequency Domain
And
or example, the following is a Butterworth notch reject filter transfer function of order n,
F
containing three notch pairs:
3 ⎡ ⎤⎡
1 1 ⎤
𝐻𝑁𝑅(𝑢, 𝑣) = ∏ ⎢ ⎥⎢ ⎥
1⎢ 1+[𝐷0𝑘/ 𝐷𝑘(𝑢,𝑣) ]
𝑘=
𝑛
⎥⎣ 1+[𝐷0𝑘 /𝐷−𝑘( 𝑢,𝑣) ] ⎥⎦
⎢ 2
⎣ ⎦
s the next two examples show, one of the principal applications of notch filter ing is for
A
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.
XAMPLE 4.24 : Using notch filtering to remove moiré patterns from digitized printed media
E
images.
igure 4.64(a) is the scanned newspaper image used in Fig. 4.21, showing a prominent moiré
F
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
109
b
a
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.
igure 4.65(a) shows an image of part of the rings surrounding the planet Saturn. This image
F
was cap tured by Cassini, the first spacecraft to enter the planet’s orbit. The nearly sinusoidal
110
attern visible in the image was caused by an AC signal superimposed on the camera video
p
signal just prior to digitizing the image. This was an unexpected problem that corrupted some
images from the mission. Fortunately, this type of interference is fairly easy to correct by
postprocessing. One approach is to use notch filtering. Figure 4.65(b) shows the DFT spectrum.
Careful analysis of the vertical axis reveals a series of small bursts of energy near the origin
which correspond to the nearly sinusoidal interference. A simple approach is to use a narrow
notch rectangle filter starting with the lowest frequency burst, and extending for the remainder of
the vertical axis. Figure 4.65(c) shows the transfer function of such a filter (white represents 1
and black 0). Figure 4.65(d) shows the result of processing the corrupted image with this filter.
This result is a significant improvement over the original image. To obtain and image of just the
interference pattern, we isolated the frequencies in the vertical axis using a notch pass transfer
function, obtained by subtracting the notch reject function from 1 [see Fig. 4.66(a)]. Then, as
Fig. 4.66(b) shows, the IDFT of the filtered image is the spatial interference pattern.
b
a
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.)
111
b
A
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).
e have focused attention thus far on theoretical concepts and on examples of fil tering in the
W
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.
𝑚−1 𝑁−
1
−𝑗2π
𝑢𝑥/𝑀 −𝑗2
π𝑣𝑦/𝑁
F(u,v) = ∑ 𝑒 ∑ 𝑓(𝑥, 𝑦) 𝑒
𝑥=
0 𝑦−
0
𝑀−1
−𝑗2π
𝑣𝑦/𝑁
= ∑ 𝐹(𝑥, 𝑣)𝑒
𝑥=0
Where
𝑁−
1
−𝑗2
π𝑣𝑦/𝑁
F(x,v) = ∑ 𝑓(𝑥, 𝑦) 𝑒
𝑦=
0
112
or one value of x, and for v= − 012 1 , , , , , …N we see that Fx ( , ) v is the 1-D DFT of one row
F
of f(x,y). By varying x from 0 to M−1 in Eq. (4-157), we compute a set of 1-D DFTs for all rows of
f(x,y ). The computations in Eq. (4-156) similarly are 1-D transforms of the columns of F(x,v)
Thus, we conclude that the 2-D DFT of f (x,y ) can be obtained by computing the 1-D transform
of each row of f (x,y) and then computing the 1-D transform along each column of the result.
This is an important simplification because we have to deal only with one variable at a time. A
similar development applies to computing the 2-D IDFT using the 1-D IDFT. However, as we
show in the following section, we can compute the IDFT using an algorithm 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.
aking the complex conjugate of both sides of Eq. (4-68) and multiplying the results by MN
T
yields
𝑀−1𝑁−1
* * −𝑗2
π(𝑢𝑥/𝑀+
𝑣
𝑌/𝑁)
MN𝑓 (𝑥, 𝑦)= ∑ ∑ 𝑓 (𝑢, 𝑣)𝑒
𝑢=0 𝑣=
0
ut, we recognize the form of the right side of this result as the DFT of F*(u,v) There fore, Eq.
B
(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 MN𝑓 (𝑥, 𝑦)). 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 *( , ). 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 xy cally is the case, then f *(x ,y )=f (x ,y ).
Work in the frequency domain would not be practical if we had to implement Eqs. (4-67) and
2
( 4-68) directly. Brute-force implementation of these equations requires on the order of𝑀𝑁
multiplications and additions. For images of moder ate size (say, 2048 2048 × pixels), this
means on the order of 17 trillion multiplica tions and additions for just one 2-D DFT, excluding
the exponentials, which could be computed once and stored in a look-up table. Without the
discovery of the fast Fou rier transform (FFT), which reduces computations to the order of MN
𝑙𝑜𝑔2 mul tiplications and additions, it is safeto say that the material presented in this chapter
ould be of little practical value. The computational reductions afforded by the FFT are
w
impressive indeed. For example, computing the 2-D FFT of a 2048 2048 MN × image would
require on the order of 92 million multiplication and additions, which is a significant reduction
from the one trillion computations mentioned above. Although the FFT is a topic covered
113
xtensively in the literature on signal pro cessing, this subject matter is of such significance in
e
our work that this chapter would be incomplete if we did not provide an introduction explaining
why the FFT works as it does. The algorithm we selected to accomplish this objective is the
so-called successive-doubling method, which was the original algorithm that led to the birth of
an entire industry. This particular algorithm assumes that the number of samples is an integer
power of 2, but this is not a general requirement of other approaches (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
𝑀−1
𝑢𝑥
F(u)= ∑ f(x)𝑊𝑀
𝑥=0
for u= 0,1,2 , …M-1 where
−𝑗2
π/𝑀
𝑊𝑀 = 𝑒
and M is assumed to be of the form
𝑝
M=2
M= 2K
with K being a positive integer also. Substituting Eq. (4-162) into Eq. (4-159) yields
2𝐾−1
𝑢𝑥
F(u) = ∑ 𝑓(𝑥) 𝑊2𝐾
𝑥=0
𝑘−1 𝐾−1
𝑢(2𝑥) 𝑢(2𝑥+
1)
=∑ 𝑓(2𝑥
)𝑊2𝐾 + ∑ 𝑓(2𝑥
+ 1) 𝑊2𝐾
𝑥=0 𝑥=0
2𝑢𝑥 𝑢𝑥
However, it can be shown using Eq. (4-160) that𝑊2𝐾 =𝑊𝐾 , so Eq. (4-163) can be written as
𝐾−1 𝐾−1
𝑢𝑥 𝑢𝑥 2𝐾
F(u) = ∑ 𝑓(2𝑥
)𝑊𝐾 + ∑ 𝑓(2𝑥
+ 1) 𝑊𝐾 𝑊𝑢
𝑥=0 𝑥=0
Defining
𝐾−1
𝑢𝑥
𝐹𝑒𝑣𝑒𝑛(𝑢)= ∑ 𝑓(2𝑥
)𝑊𝐾
𝑥=0
𝐾−
1
𝑢𝑥
𝐹𝑜𝑑𝑑(𝑢) = ∑ 𝑓(2𝑋
+ 1) 𝑊𝐾
𝑥=
0
𝑢
F(u) =𝐹𝑒𝑣𝑒𝑛(𝑢) + 𝑓
𝑜𝑑𝑑(𝑢)𝑊2𝐾
𝑢
F(u+k) =𝐹𝑒𝑣𝑒𝑛(𝑢) -𝐹𝑜𝑑𝑑(𝑢)𝑊2𝐾
nalysis of Eqs. (4-165) through (4-168) reveals some important (and surprising)
A
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 given in Eqs.
(4-165) and (4-166). The resulting values of𝐹𝑒𝑣𝑒𝑛(𝑢) and𝐹𝑜𝑑𝑑(𝑢) are then
ubstituted into Eq. (4-167) to obtain F(u) for u = − 0,1,2,. ... M The other
s
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 m(p) andα(p) represent the numberof complex multiplications and
additions, respectively, required to implement the method. As before, the number
𝑃
f samples is2 ,where p is a positive integer.Suppose first that p = 1 so that the
o
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𝐹𝑒𝑣𝑒𝑛(0) and
𝐹𝑜𝑑𝑑(0) In this case K = 1 and Eqs. (4-165) and(4-166) are one-point transforms.
owever, because the DFT of a single sample point is the sample itself, no multipli-
H
cations or additions are required to obtain𝐹𝑒𝑣𝑒𝑛(0) and𝐹𝑜𝑑𝑑(0) One multiplication
0
of𝐹𝑜𝑑𝑑(0) by𝑊2 and one addition yieldsF( ) 0 from Eq. (4-167). Then F(1 ) follows
from Eq. (4-168) with one more addition (subtraction is considered to be the same
0
as addition). Because𝐹𝑜𝑑𝑑(0) 𝑊2h
as beencomputed already, the total number of
perations required for a two-point transform consists of m(1)=1 multiplication
o
andα(1) = 2 additions.The next allowed value forp 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 m(1) multiplications andα(1) additions. Therefore, evaluation of
these two equations requires a total of 2m(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𝐹𝑜𝑑𝑑(𝑢)𝑊2𝐾 has been computedalready for u = { 0 ,1} two more
115
dditions give F( 2) and F(3 ). The total is then m (2 ) = 2m(1) +2 and α ( 1) +4.
a
When p is equal to 3, two four-point transforms are needed to evaluate𝐹𝑒𝑣𝑒𝑛(𝑢)
and𝐹𝑜𝑑𝑑(𝑢). They require 2m (2 ) multiplicationsand 2α ( 2) additions. Four more
ultiplications and eight more additions yield the complete transform. The total
m
then is then ( )3 224 = + ( ) multiplication and α(3) = 2α(2) + 8a
dditions.
Continuing this argument for any positive integer p leads to recursive expressions
for the number of multiplications and additions required to implement the FFT:
𝑝−1
M(p) =2m(p-1) +2 p≥
1
And
𝑝
α(𝑝) = 2α
(𝑝 − 1) + 2 p≥
1
here m(0) = 0 andα(0) = 0 because the transformof a single point does not
w
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
m(p) = 2 𝑀𝑙 𝑜𝑔2𝑀
And
𝑝
here M=2
W
The computational advantage of the FFT over a direct implementation of the 1-D
DFT is defined as
2
𝑀
C(M)= 𝑀𝑙𝑜𝑔 𝑀
2
𝑀
𝑙𝑜𝑔 𝑀
=
2
2
here𝑀 is the number of operations requiredfor a “brute force” implementation
w
of the 1-D DFT. Because it is assumed that M p = 2 , we can write Eq. (4-173) in
terms of p:
116
𝑝
2
C(p)= 𝑝
plot of this function (Fig. 4.67) shows that the computational advantage increases
A
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
IGURE 4.67
F
Computational
advantage of the
FFT over a direct
implementation
of the 1-D DFT.
The number of
samples is M p = 2
The computational
advantage
increases rapidly
as a function of p.
f 2 (at the expense of slightly less efficient computation). Free FFT programs also
o
are readily available, principally over the internet.
he material in this chapter is a progression from sampling to the Fourier transform, and then to
T
filtering in the frequency domain. Some of the concepts, such as the sampling theorem, make
very little sense if not explained in the context of the frequency domain. The same is true of
effects such as aliasing. Thus, the material developed in the preceding sections is a solid
foundation for understanding the fundamentals of 2-D digital signal processing. We took special
117
are to develop the material starting with basic principles, so that any reader with a modest
c
mathemati-cal background would be in a position not only to absorb the material, but also to
apply it.For complementary reading on the 1-D and 2-D continuous Fourier transforms, see the
books by Bracewell[1995, 2003]. These two books, together with Castleman [1996], Petrou and
Petrou [2010], Brigham [1988], and Smith [2003], provide additional background for the material
in Sections 4.2 through 4.6. Sampling phenomena such as aliasing and moiré patterns are
topics amply illustrated in books on computer graphics, as exemplified by Hughes and Andries
[2013]. For additional general background on the material in Sections 4.7 through 4.11 see
Hall [1979], Jain [1989], Castleman [1996], and Pratt [2014]. For details on the software aspects
of many of the ex-amples in this chapter, see Gonzalez, Woods, and Eddins [2009].