Chapter 2 Digital Image Fundamentals
Chapter 2 Digital Image Fundamentals
Processing
Third Edition
Rafael C. Gonzalez
University of Tennessee
Richard E. Woods
MedData Interactive
All rights reserved. No part of this book may be reproduced, in any form, or by any means, without
permission in writing from the publisher.
Pearson Prentice Hall® is a trademark of Pearson Education, Inc.
The authors and publisher of this book have used their best efforts in preparing this book. These efforts include
the development, research, and testing of the theories and programs to determine their effectiveness. The authors
and publisher make no warranty of any kind, expressed or implied, with regard to these programs or the
documentation contained in this book. The authors and publisher shall not be liable in any event for incidental or
consequential damages with, or arising out of, the furnishing, performance, or use of these programs.
Printed in the United States of America.
10 9 8 7 6 5 4 3 2 1
ISBN 0-13-168728-x
978-0-13-168728-8
Pearson Education Ltd., London
Pearson Education Australia Pty. Ltd., Sydney
Pearson Education Singapore, Pte., Ltd.
Pearson Education North Asia Ltd., Hong Kong
Pearson Education Canada, Inc., Toronto
Pearson Educación de Mexico, S.A. de C.V.
Pearson Education—Japan, Tokyo
Pearson Education Malaysia, Pte. Ltd.
Pearson Education, Inc., Upper Saddle River, New Jersey
2 Digital Image
Fundamentals
Preview
The purpose of this chapter is to introduce you to a number of basic concepts
in digital image processing that are used throughout the book. Section 2.1
summarizes the mechanics of the human visual system, including image for-
mation in the eye and its capabilities for brightness adaptation and discrimi-
nation. Section 2.2 discusses light, other components of the electromagnetic
spectrum, and their imaging characteristics. Section 2.3 discusses imaging
sensors and how they are used to generate digital images. Section 2.4 intro-
duces the concepts of uniform image sampling and intensity quantization.
Additional topics discussed in that section include digital image representa-
tion, the effects of varying the number of samples and intensity levels in an
image, the concepts of spatial and intensity resolution, and the principles of
image interpolation. Section 2.5 deals with a variety of basic relationships
between pixels. Finally, Section 2.6 is an introduction to the principal math-
ematical tools we use throughout the book. A second objective of that sec-
tion is to help you begin developing a “feel” for how these tools are used in
a variety of basic image processing tasks. The scope of these tools and their
application are expanded as needed in the remainder of the book.
35
36 Chapter 2 ■ Digital Image Fundamentals
Lens
Ciliary fibers
Visual axis
Vitreous humor
Retina
Blind spot
Fovea
Sclera
Choroid
Ner
ve &
she
ath
2.1 ■ Elements of Visual Perception 37
the anterior surface of the eye. Continuous with the cornea, the sclera is an
opaque membrane that encloses the remainder of the optic globe.
The choroid lies directly below the sclera. This membrane contains a net-
work of blood vessels that serve as the major source of nutrition to the eye.
Even superficial injury to the choroid, often not deemed serious, can lead to
severe eye damage as a result of inflammation that restricts blood flow. The
choroid coat is heavily pigmented and hence helps to reduce the amount of ex-
traneous light entering the eye and the backscatter within the optic globe. At
its anterior extreme, the choroid is divided into the ciliary body and the iris.
The latter contracts or expands to control the amount of light that enters the
eye. The central opening of the iris (the pupil) varies in diameter from approx-
imately 2 to 8 mm. The front of the iris contains the visible pigment of the eye,
whereas the back contains a black pigment.
The lens is made up of concentric layers of fibrous cells and is suspended by
fibers that attach to the ciliary body. It contains 60 to 70% water, about 6% fat,
and more protein than any other tissue in the eye. The lens is colored by a
slightly yellow pigmentation that increases with age. In extreme cases, exces-
sive clouding of the lens, caused by the affliction commonly referred to as
cataracts, can lead to poor color discrimination and loss of clear vision. The
lens absorbs approximately 8% of the visible light spectrum, with relatively
higher absorption at shorter wavelengths. Both infrared and ultraviolet light
are absorbed appreciably by proteins within the lens structure and, in exces-
sive amounts, can damage the eye.
The innermost membrane of the eye is the retina, which lines the inside of
the wall’s entire posterior portion. When the eye is properly focused, light
from an object outside the eye is imaged on the retina. Pattern vision is afford-
ed by the distribution of discrete light receptors over the surface of the retina.
There are two classes of receptors: cones and rods. The cones in each eye num-
ber between 6 and 7 million. They are located primarily in the central portion
of the retina, called the fovea, and are highly sensitive to color. Humans can re-
solve fine details with these cones largely because each one is connected to its
own nerve end. Muscles controlling the eye rotate the eyeball until the image
of an object of interest falls on the fovea. Cone vision is called photopic or
bright-light vision.
The number of rods is much larger: Some 75 to 150 million are distributed
over the retinal surface. The larger area of distribution and the fact that sever-
al rods are connected to a single nerve end reduce the amount of detail dis-
cernible by these receptors. Rods serve to give a general, overall picture of the
field of view. They are not involved in color vision and are sensitive to low lev-
els of illumination. For example, objects that appear brightly colored in day-
light when seen by moonlight appear as colorless forms because only the rods
are stimulated. This phenomenon is known as scotopic or dim-light vision.
Figure 2.2 shows the density of rods and cones for a cross section of the
right eye passing through the region of emergence of the optic nerve from the
eye. The absence of receptors in this area results in the so-called blind spot (see
Fig. 2.1). Except for this region, the distribution of receptors is radially sym-
metric about the fovea. Receptor density is measured in degrees from the
38 Chapter 2 ■ Digital Image Fundamentals
90,000
45,000
fovea (that is, in degrees off axis, as measured by the angle formed by the visu-
al axis and a line passing through the center of the lens and intersecting the
retina). Note in Fig. 2.2 that cones are most dense in the center of the retina (in
the center area of the fovea). Note also that rods increase in density from the
center out to approximately 20° off axis and then decrease in density out to the
extreme periphery of the retina.
The fovea itself is a circular indentation in the retina of about 1.5 mm in di-
ameter. However, in terms of future discussions, talking about square or rec-
tangular arrays of sensing elements is more useful. Thus, by taking some
liberty in interpretation, we can view the fovea as a square sensor array of size
1.5 mm * 1.5 mm. The density of cones in that area of the retina is approxi-
mately 150,000 elements per mm2. Based on these approximations, the number
of cones in the region of highest acuity in the eye is about 337,000 elements.
Just in terms of raw resolving power, a charge-coupled device (CCD) imaging
chip of medium resolution can have this number of elements in a receptor
array no larger than 5 mm * 5 mm. While the ability of humans to integrate
intelligence and experience with vision makes these types of number compar-
isons somewhat superficial, keep in mind for future discussions that the basic
ability of the eye to resolve detail certainly is comparable to current electronic
imaging sensors.
FIGURE 2.3
Graphical
C
representation of
15 m
the eye looking at
a palm tree. Point
C is the optical
center of the lens.
100 m 17 mm
lens for distant or near objects, respectively. The distance between the center
of the lens and the retina along the visual axis is approximately 17 mm. The
range of focal lengths is approximately 14 mm to 17 mm, the latter taking
place when the eye is relaxed and focused at distances greater than about 3 m.
The geometry in Fig. 2.3 illustrates how to obtain the dimensions of an
image formed on the retina. For example, suppose that a person is looking at a
tree 15 m high at a distance of 100 m. Letting h denote the height of that object
in the retinal image, the geometry of Fig. 2.3 yields 15>100 = h>17 or
h = 2.55 mm. As indicated in Section 2.1.1, the retinal image is focused pri-
marily on the region of the fovea. Perception then takes place by the relative
excitation of light receptors, which transform radiant energy into electrical im-
pulses that ultimately are decoded by the brain.
FIGURE 2.4
Glare limit
Range of
subjective
brightness
sensations
Subjective brightness
showing a
Adaptation range
Ba particular
adaptation level.
Bb
Scotopic
Scotopic Photopic
threshold
6 4 2 0 2 4
Log of intensity (mL)
40 Chapter 2 ■ Digital Image Fundamentals
I
2.1 ■ Elements of Visual Perception 41
0.5
1.0
1.5
2.0
4 3 2 1 0 1 2 3 4
log I
A plot of log ¢Ic>I as a function of log I has the general shape shown in
Fig. 2.6. This curve shows that brightness discrimination is poor (the Weber
ratio is large) at low levels of illumination, and it improves significantly (the
Weber ratio decreases) as background illumination increases. The two branch-
es in the curve reflect the fact that at low levels of illumination vision is carried
out by the rods, whereas at high levels (showing better discrimination) vision is
the function of cones.
If the background illumination is held constant and the intensity of the
other source, instead of flashing, is now allowed to vary incrementally from
never being perceived to always being perceived, the typical observer can dis-
cern a total of one to two dozen different intensity changes. Roughly, this re-
sult is related to the number of different intensities a person can see at any one
point in a monochrome image. This result does not mean that an image can be
represented by such a small number of intensity values because, as the eye
roams about the image, the average background changes, thus allowing a
different set of incremental changes to be detected at each new adaptation
level. The net consequence is that the eye is capable of a much broader range
of overall intensity discrimination. In fact, we show in Section 2.4.3 that the eye
is capable of detecting objectionable contouring effects in monochrome im-
ages whose overall intensity is represented by fewer than approximately two
dozen levels.
Two phenomena clearly demonstrate that perceived brightness is not a
simple function of intensity. The first is based on the fact that the visual sys-
tem tends to undershoot or overshoot around the boundary of regions of dif-
ferent intensities. Figure 2.7(a) shows a striking example of this phenomenon.
Although the intensity of the stripes is constant, we actually perceive a bright-
ness pattern that is strongly scalloped near the boundaries [Fig. 2.7(c)]. These
seemingly scalloped bands are called Mach bands after Ernst Mach, who first
described the phenomenon in 1865.
The second phenomenon, called simultaneous contrast, is related to the fact
that a region’s perceived brightness does not depend simply on its intensity, as
Fig. 2.8 demonstrates. All the center squares have exactly the same intensity.
42 Chapter 2 ■ Digital Image Fundamentals
a
b
c
FIGURE 2.7
Illustration of the
Mach band effect.
Perceived
intensity is not a
simple function of
Actual intensity
actual intensity.
Perceived intensity
However, they appear to the eye to become darker as the background gets
lighter. A more familiar example is a piece of paper that seems white when
lying on a desk, but can appear totally black when used to shield the eyes while
looking directly at a bright sky.
Other examples of human perception phenomena are optical illusions, in
which the eye fills in nonexisting information or wrongly perceives geometri-
cal properties of objects. Figure 2.9 shows some examples. In Fig. 2.9(a), the
outline of a square is seen clearly, despite the fact that no lines defining such a
figure are part of the image. The same effect, this time with a circle, can be seen
in Fig. 2.9(b); note how just a few lines are sufficient to give the illusion of a
a b c
FIGURE 2.8 Examples of simultaneous contrast. All the inner squares have the same
intensity, but they appear progressively darker as the background becomes lighter.
2.2 ■ Light and the Electromagnetic Spectrum 43
a b
c d
FIGURE 2.9 Some
well-known
optical illusions.
complete circle. The two horizontal line segments in Fig. 2.9(c) are of the same
length, but one appears shorter than the other. Finally, all lines in Fig. 2.9(d) that
are oriented at 45° are equidistant and parallel.Yet the crosshatching creates the
illusion that those lines are far from being parallel. Optical illusions are a char-
acteristic of the human visual system that is not fully understood.
Frequency (Hz)
21 20 19 18 17 16 15
10 10 10 10 10 10 10 1014 1013 1012 1011 1010 109 108 107 106 105
Wavelength (meters)
12 11 10 9 8 7
10 10 10 10 10 10 106 105 104 103 102 101 1 101 102 103
Visible spectrum
FIGURE 2.10 The electromagnetic spectrum. The visible spectrum is shown zoomed to facilitate explanation,
but note that the visible spectrum is a rather narrow portion of the EM spectrum.
where c is the speed of light (2.998 * 108 m>s). The energy of the various com-
ponents of the electromagnetic spectrum is given by the expression
E = hn (2.2-2)
where h is Planck’s constant. The units of wavelength are meters, with the terms
microns (denoted m and equal to 10-6 m) and nanometers (denoted nm and
equal to 10 -9 m) being used just as frequently. Frequency is measured in Hertz
(Hz), with one Hertz being equal to one cycle of a sinusoidal wave per second.
A commonly used unit of energy is the electron-volt.
Electromagnetic waves can be visualized as propagating sinusoidal waves
with wavelength l (Fig. 2.11), or they can be thought of as a stream of massless
particles, each traveling in a wavelike pattern and moving at the speed of light.
Each massless particle contains a certain amount (or bundle) of energy. Each
FIGURE 2.11 l
Graphical
representation of
one wavelength.
2.2 ■ Light and the Electromagnetic Spectrum 45
bundle of energy is called a photon. We see from Eq. (2.2-2) that energy is
proportional to frequency, so the higher-frequency (shorter wavelength) elec-
tromagnetic phenomena carry more energy per photon. Thus, radio waves
have photons with low energies, microwaves have more energy than radio
waves, infrared still more, then visible, ultraviolet, X-rays, and finally gamma
rays, the most energetic of all. This is the reason why gamma rays are so dan-
gerous to living organisms.
Light is a particular type of electromagnetic radiation that can be sensed by
the human eye. The visible (color) spectrum is shown expanded in Fig. 2.10 for
the purpose of discussion (we consider color in much more detail in Chapter 6).
The visible band of the electromagnetic spectrum spans the range from approxi-
mately 0.43 m (violet) to about 0.79 m (red). For convenience, the color spec-
trum is divided into six broad regions: violet, blue, green, yellow, orange, and red.
No color (or other component of the electromagnetic spectrum) ends abruptly,
but rather each range blends smoothly into the next, as shown in Fig. 2.10.
The colors that humans perceive in an object are determined by the nature
of the light reflected from the object. A body that reflects light relatively bal-
anced in all visible wavelengths appears white to the observer. However, a
body that favors reflectance in a limited range of the visible spectrum exhibits
some shades of color. For example, green objects reflect light with wavelengths
primarily in the 500 to 570 nm range while absorbing most of the energy at
other wavelengths.
Light that is void of color is called monochromatic (or achromatic) light.
The only attribute of monochromatic light is its intensity or amount. Because
the intensity of monochromatic light is perceived to vary from black to grays
and finally to white, the term gray level is used commonly to denote mono-
chromatic intensity. We use the terms intensity and gray level interchangeably
in subsequent discussions. The range of measured values of monochromatic
light from black to white is usually called the gray scale, and monochromatic
images are frequently referred to as gray-scale images.
Chromatic (color) light spans the electromagnetic energy spectrum from
approximately 0.43 to 0.79 m, as noted previously. In addition to frequency,
three basic quantities are used to describe the quality of a chromatic light
source: radiance, luminance, and brightness. Radiance is the total amount of
energy that flows from the light source, and it is usually measured in watts
(W). Luminance, measured in lumens (lm), gives a measure of the amount of
energy an observer perceives from a light source. For example, light emitted
from a source operating in the far infrared region of the spectrum could have
significant energy (radiance), but an observer would hardly perceive it; its lu-
minance would be almost zero. Finally, as discussed in Section 2.1, brightness is
a subjective descriptor of light perception that is practically impossible to
measure. It embodies the achromatic notion of intensity and is one of the key
factors in describing color sensation.
Continuing with the discussion of Fig. 2.10, we note that at the short-
wavelength end of the electromagnetic spectrum, we have gamma rays and
X-rays. As discussed in Section 1.3.1, gamma radiation is important for medical
and astronomical imaging, and for imaging radiation in nuclear environments.
46 Chapter 2 ■ Digital Image Fundamentals
Energy a
b
Filter c
FIGURE 2.12
(a) Single imaging
Sensing material
Power in sensor.
(b) Line sensor.
(c) Array sensor.
Voltage waveform out
Housing
48 Chapter 2 ■ Digital Image Fundamentals
Linear motion
One image line out
per increment of rotation
and full linear displacement
of sensor from left to right
Imaged area
Image
reconstruction
Cross-sectional images
Linear motion of 3-D object
Sensor strip
3-D object
X-ray source
tion
ar mo
L ine
Sensor ring
a b
FIGURE 2.14 (a) Image acquisition using a linear sensor strip. (b) Image acquisition using a circular sensor strip.
flies at a constant altitude and speed over the geographical area to be imaged.
One-dimensional imaging sensor strips that respond to various bands of the
electromagnetic spectrum are mounted perpendicular to the direction of
flight. The imaging strip gives one line of an image at a time, and the motion of
the strip completes the other dimension of a two-dimensional image. Lenses
or other focusing schemes are used to project the area to be scanned onto the
sensors.
Sensor strips mounted in a ring configuration are used in medical and in-
dustrial imaging to obtain cross-sectional (“slice”) images of 3-D objects, as
Fig. 2.14(b) shows. A rotating X-ray source provides illumination and the sen-
sors opposite the source collect the X-ray energy that passes through the ob-
ject (the sensors obviously have to be sensitive to X-ray energy). This is the
basis for medical and industrial computerized axial tomography (CAT) imag-
ing as indicated in Sections 1.2 and 1.3.2. It is important to note that the output
of the sensors must be processed by reconstruction algorithms whose objective
is to transform the sensed data into meaningful cross-sectional images (see
Section 5.11). In other words, images are not obtained directly from the sen-
sors by motion alone; they require extensive processing. A 3-D digital volume
consisting of stacked images is generated as the object is moved in a direction
50 Chapter 2 ■ Digital Image Fundamentals
Illumination (energy)
source
Imaging system
Scene element
a
c d e
b
FIGURE 2.15 An example of the digital image acquisition process. (a) Energy (“illumination”) source. (b) An
element of a scene. (c) Imaging system. (d) Projection of the scene onto the image plane. (e) Digitized image.
EXAMPLE 2.1: ■ The values given in Eqs. (2.3-3) and (2.3-4) are theoretical bounds. The fol-
Some typical lowing average numerical figures illustrate some typical ranges of i (x, y) for
values of visible light. On a clear day, the sun may produce in excess of 90,000 lm>m2
illumination and
reflectance. of illumination on the surface of the Earth. This figure decreases to less than
10,000 lm>m2 on a cloudy day. On a clear evening, a full moon yields about
0.1 lm>m2 of illumination. The typical illumination level in a commercial office
is about 1000 lm>m2. Similarly, the following are typical values of r (x, y): 0.01
for black velvet, 0.65 for stainless steel, 0.80 for flat-white wall paint, 0.90 for
silver-plated metal, and 0.93 for snow. ■
a b
c d
A B FIGURE 2.16
Generating a
digital image.
(a) Continuous
image. (b) A scan
line from A to B
A B in the continuous
image, used to
illustrate the
concepts of
sampling and
quantization.
(c) Sampling and
A B A B quantization.
(d) Digital
scan line.
Quantization
Sampling
a b
FIGURE 2.17 (a) Continuous image projected onto a sensor array. (b) Result of image
sampling and quantization.
2.4 ■ Image Sampling and Quantization 55
f (x, y) a
b c
FIGURE 2.18
(a) Image plotted
as a surface.
(b) Image
displayed as a
visual intensity
array.
(c) Image shown
as a 2-D
y numerical array
x (0, .5, and 1
represent black,
gray, and white,
Origin Origin respectively).
y 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 .5 .5 .5 0 0 0
0 0 0 .5 .5 0 0 0
.5
1 1 1
1 1
0 0 0 1 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
x
56 Chapter 2 ■ Digital Image Fundamentals
and the third axis being the values of f (intensities) as a function of the two spa-
tial variables x and y. Although we can infer the structure of the image in this
example by looking at the plot, complex images generally are too detailed and
difficult to interpret from such plots. This representation is useful when work-
ing with gray-scale sets whose elements are expressed as triplets of the form
(x, y, z), where x and y are spatial coordinates and z is the value of f at coordi-
nates (x, y). We work with this representation in Section 2.6.4.
The representation in Fig. 2.18(b) is much more common. It shows f(x, y)
as it would appear on a monitor or photograph. Here, the intensity of each
point is proportional to the value of f at that point. In this figure, there are only
three equally spaced intensity values. If the intensity is normalized to the in-
terval [0, 1], then each point in the image has the value 0, 0.5, or 1. A monitor
or printer simply converts these three values to black, gray, or white, respec-
tively, as Fig. 2.18(b) shows. The third representation is simply to display the
numerical values of f(x, y) as an array (matrix). In this example, f is of size
600 * 600 elements, or 360,000 numbers. Clearly, printing the complete array
would be cumbersome and convey little information. When developing algo-
rithms, however, this representation is quite useful when only parts of the
image are printed and analyzed as numerical values. Figure 2.18(c) conveys
this concept graphically.
We conclude from the previous paragraph that the representations in
Figs. 2.18(b) and (c) are the most useful. Image displays allow us to view re-
sults at a glance. Numerical arrays are used for processing and algorithm devel-
opment. In equation form, we write the representation of an M * N numerical
array as
Both sides of this equation are equivalent ways of expressing a digital image
quantitatively. The right side is a matrix of real numbers. Each element of this
matrix is called an image element, picture element, pixel, or pel. The terms
image and pixel are used throughout the book to denote a digital image and
its elements.
In some discussions it is advantageous to use a more traditional matrix no-
tation to denote a digital image and its elements:
Clearly, aij = f(x = i, y = j) = f(i, j), so Eqs. (2.4-1) and (2.4-2) are identical
matrices. We can even represent an image as a vector, v. For example, a column
vector of size MN * 1 is formed by letting the first M elements of v be the first
column of A, the next M elements be the second column, and so on. Alterna-
tively, we can use the rows instead of the columns of A to form such a vector.
Either representation is valid, as long as we are consistent.
Returning briefly to Fig. 2.18, note that the origin of a digital image is at the
top left, with the positive x-axis extending downward and the positive y-axis
extending to the right. This is a conventional representation based on the fact
that many image displays (e.g., TV monitors) sweep an image starting at the
top left and moving to the right one row at a time. More important is the fact
that the first element of a matrix is by convention at the top left of the array, so
choosing the origin of f(x, y) at that point makes sense mathematically. Keep
in mind that this representation is the standard right-handed Cartesian coordi-
nate system with which you are familiar.† We simply show the axes pointing
downward and to the right, instead of to the right and up.
Expressing sampling and quantization in more formal mathematical terms
can be useful at times. Let Z and R denote the set of integers and the set of
real numbers, respectively. The sampling process may be viewed as partition-
ing the xy-plane into a grid, with the coordinates of the center of each cell in
the grid being a pair of elements from the Cartesian product Z2, which is the
set of all ordered pairs of elements (zi, zj), with zi and zj being integers from
Z. Hence, f(x, y) is a digital image if (x, y) are integers from Z2 and f is a
function that assigns an intensity value (that is, a real number from the set
of real numbers, R) to each distinct pair of coordinates (x, y). This functional
assignment is the quantization process described earlier. If the intensity lev-
els also are integers (as usually is the case in this and subsequent chapters),
Z replaces R, and a digital image then becomes a 2-D function whose coor-
dinates and amplitude values are integers.
This digitization process requires that decisions be made regarding the val-
ues for M, N, and for the number, L, of discrete intensity levels. There are no
restrictions placed on M and N, other than they have to be positive integers.
However, due to storage and quantizing hardware considerations, the number
Often, it is useful for
of intensity levels typically is an integer power of 2: computation or for
algorithm development
L = 2k (2.4-3) purposes to scale the L
intensity values to the
We assume that the discrete levels are equally spaced and that they are inte- range [0, 1], in which case
they cease to be integers.
gers in the interval [0, L - 1]. Sometimes, the range of values spanned by the However, in most cases
gray scale is referred to informally as the dynamic range. This is a term used in these values are scaled
back to the integer range
different ways in different fields. Here, we define the dynamic range of an imag- [0, L - 1] for image
ing system to be the ratio of the maximum measurable intensity to the minimum storage and display.
†
Recall that a right-handed coordinate system is such that, when the index of the right hand points in the di-
rection of the positive x-axis and the middle finger points in the (perpendicular) direction of the positive
y-axis, the thumb points up. As Fig. 2.18(a) shows, this indeed is the case in our image coordinate system.
58 Chapter 2 ■ Digital Image Fundamentals
FIGURE 2.19 An
image exhibiting
saturation and Saturation
noise. Saturation is
the highest value
beyond which all
intensity levels are
clipped (note how
the entire
saturated area has
a high, constant Noise
intensity level).
Noise in this case
appears as a grainy
texture pattern.
Noise, especially in
the darker regions
of an image (e.g.,
the stem of the
rose) masks the
lowest detectable
true intensity level.
detectable intensity level in the system. As a rule, the upper limit is determined
by saturation and the lower limit by noise (see Fig. 2.19). Basically, dynamic
range establishes the lowest and highest intensity levels that a system can repre-
sent and, consequently, that an image can have. Closely associated with this con-
cept is image contrast, which we define as the difference in intensity between
the highest and lowest intensity levels in an image. When an appreciable num-
ber of pixels in an image have a high dynamic range, we can expect the image
to have high contrast. Conversely, an image with low dynamic range typically
has a dull, washed-out gray look. We discuss these concepts in more detail in
Chapter 3.
The number, b, of bits required to store a digitized image is
b = M * N * k (2.4-4)
b = N2k (2.4-5)
Table 2.1 shows the number of bits required to store square images with vari-
ous values of N and k. The number of intensity levels corresponding to each
value of k is shown in parentheses. When an image can have 2 k intensity levels,
it is common practice to refer to the image as a “k-bit image.” For example, an
image with 256 possible discrete intensity values is called an 8-bit image. Note
that storage requirements for 8-bit images of size 1024 * 1024 and higher are
not insignificant.
2.4 ■ Image Sampling and Quantization 59
TABLE 2.1
Number of storage bits for various values of N and k. L is the number of intensity levels.
EXAMPLE 2.2: ■ Figure 2.20 shows the effects of reducing spatial resolution in an image.
Illustration of the The images in Figs. 2.20(a) through (d) are shown in 1250, 300, 150, and 72
effects of reducing dpi, respectively. Naturally, the lower resolution images are smaller than the
image spatial
resolution. original. For example, the original image is of size 3692 * 2812 pixels, but the
72 dpi image is an array of size 213 * 162. In order to facilitate comparisons,
all the smaller images were zoomed back to the original size (the method
used for zooming is discussed in Section 2.4.4). This is somewhat equivalent to
“getting closer” to the smaller images so that we can make comparable state-
ments about visible details.
There are some small visual differences between Figs. 2.20(a) and (b), the
most notable being a slight distortion in the large black needle. For the most
part, however, Fig. 2.20(b) is quite acceptable. In fact, 300 dpi is the typical
minimum image spatial resolution used for book publishing, so one would
not expect to see much difference here. Figure 2.20(c) begins to show visible
degradation (see, for example, the round edges of the chronometer and the
small needle pointing to 60 on the right side). Figure 2.20(d) shows degrada-
tion that is visible in most features of the image. As we discuss in Section
4.5.4, when printing at such low resolutions, the printing and publishing in-
dustry uses a number of “tricks” (such as locally varying the pixel size) to
produce much better results than those in Fig. 2.20(d). Also, as we show in
Section 2.4.4, it is possible to improve on the results of Fig. 2.20 by the choice
of interpolation method used. ■
2.4 ■ Image Sampling and Quantization 61
a b
c d
FIGURE 2.20 Typical effects of reducing spatial resolution. Images shown at: (a) 1250
dpi, (b) 300 dpi, (c) 150 dpi, and (d) 72 dpi. The thin black borders were added for
clarity. They are not part of the data.
62 Chapter 2 ■ Digital Image Fundamentals
EXAMPLE 2.3: ■ In this example, we keep the number of samples constant and reduce the
Typical effects of number of intensity levels from 256 to 2, in integer powers of 2. Figure 2.21(a)
varying the
is a 452 * 374 CT projection image, displayed with k = 8 (256 intensity levels).
number of
intensity levels in Images such as this are obtained by fixing the X-ray source in one position,
a digital image. thus producing a 2-D image in any desired direction. Projection images are
used as guides to set up the parameters for a CT scanner, including tilt, number
of slices, and range.
Figures 2.21(b) through (h) were obtained by reducing the number of bits
from k = 7 to k = 1 while keeping the image size constant at 452 * 374 pixels.
The 256-, 128-, and 64-level images are visually identical for all practical pur-
poses. The 32-level image in Fig. 2.21(d), however, has an imperceptible set of
a b
c d
FIGURE 2.21
(a) 452 * 374,
256-level image.
(b)–(d) Image
displayed in 128,
64, and 32
intensity levels,
while keeping the
image size
constant.
2.4 ■ Image Sampling and Quantization 63
e f
g h
FIGURE 2.21
(Continued)
(e)–(h) Image
displayed in 16, 8,
4, and 2 intensity
levels. (Original
courtesy of
Dr. David R.
Pickens,
Department of
Radiology &
Radiological
Sciences,
Vanderbilt
University
Medical Center.)
64 Chapter 2 ■ Digital Image Fundamentals
a b c
FIGURE 2.22 (a) Image with a low level of detail. (b) Image with a medium level of detail. (c) Image with a
relatively large amount of detail. (Image (b) courtesy of the Massachusetts Institute of Technology.)
The results in Examples 2.2 and 2.3 illustrate the effects produced on image
quality by varying N and k independently. However, these results only partially
answer the question of how varying N and k affects images because we have not
considered yet any relationships that might exist between these two parame-
ters. An early study by Huang [1965] attempted to quantify experimentally the
effects on image quality produced by varying N and k simultaneously. The ex-
periment consisted of a set of subjective tests. Images similar to those shown in
Fig. 2.22 were used. The woman’s face is representative of an image with rela-
tively little detail; the picture of the cameraman contains an intermediate
amount of detail; and the crowd picture contains, by comparison, a large amount
of detail.
Sets of these three types of images were generated by varying N and k, and
observers were then asked to rank them according to their subjective quality.
Results were summarized in the form of so-called isopreference curves in the
Nk-plane. (Figure 2.23 shows average isopreference curves representative of
curves corresponding to the images in Fig. 2.22.) Each point in the Nk-plane
represents an image having values of N and k equal to the coordinates of that
point. Points lying on an isopreference curve correspond to images of equal
subjective quality. It was found in the course of the experiments that the iso-
preference curves tended to shift right and upward, but their shapes in each of
the three image categories were similar to those in Fig. 2.23. This is not unex-
pected, because a shift up and right in the curves simply means larger values
for N and k, which implies better picture quality.
The key point of interest in the context of the present discussion is that iso-
preference curves tend to become more vertical as the detail in the image in-
creases. This result suggests that for images with a large amount of detail
only a few intensity levels may be needed. For example, the isopreference
curve in Fig. 2.23 corresponding to the crowd is nearly vertical. This indicates
that, for a fixed value of N, the perceived quality for this type of image is
2.4 ■ Image Sampling and Quantization 65
FIGURE 2.23
Typical
isopreference
5 curves for the
three types of
images in
Fig. 2.22.
Face
k
Cameraman
Crowd
4
32 64 128 256
N
nearly independent of the number of intensity levels used (for the range of in-
tensity levels shown in Fig. 2.23). It is of interest also to note that perceived
quality in the other two image categories remained the same in some intervals
in which the number of samples was increased, but the number of intensity
levels actually decreased. The most likely reason for this result is that a de-
crease in k tends to increase the apparent contrast, a visual effect that humans
often perceive as improved quality in an image.
where the sixteen coefficients are determined from the sixteen equations in
sixteen unknowns that can be written using the sixteen nearest neighbors of
point (x, y). Observe that Eq. (2.4-7) reduces in form to Eq. (2.4-6) if the lim-
its of both summations in the former equation are 0 to 1. Generally, bicubic in-
terpolation does a better job of preserving fine detail than its bilinear
counterpart. Bicubic interpolation is the standard used in commercial image
editing programs, such as Adobe Photoshop and Corel Photopaint.
EXAMPLE 2.4: ■ Figure 2.24(a) is the same image as Fig. 2.20(d), which was obtained by re-
Comparison of ducing the resolution of the 1250 dpi image in Fig. 2.20(a) to 72 dpi (the size
interpolation shrank from the original size of 3692 * 2812 to 213 * 162 pixels) and then
approaches for
image shrinking zooming the reduced image back to its original size. To generate Fig. 2.20(d)
and zooming. we used nearest neighbor interpolation both to shrink and zoom the image. As
we commented before, the result in Fig. 2.24(a) is rather poor. Figures 2.24(b)
and (c) are the results of repeating the same procedure but using, respectively,
bilinear and bicubic interpolation for both shrinking and zooming. The result
obtained by using bilinear interpolation is a significant improvement over near-
est neighbor interpolation. The bicubic result is slightly sharper than the bilin-
ear image. Figure 2.24(d) is the same as Fig. 2.20(c), which was obtained using
nearest neighbor interpolation for both shrinking and zooming. We comment-
ed in discussing that figure that reducing the resolution to 150 dpi began show-
ing degradation in the image. Figures 2.24(e) and (f) show the results of using
2.4 ■ Image Sampling and Quantization 67
a b c
d e f
FIGURE 2.24 (a) Image reduced to 72 dpi and zoomed back to its original size (3692 * 2812 pixels) using
nearest neighbor interpolation. This figure is the same as Fig. 2.20(d). (b) Image shrunk and zoomed using
bilinear interpolation. (c) Same as (b) but using bicubic interpolation. (d)–(f) Same sequence, but shrinking
down to 150 dpi instead of 72 dpi [Fig. 2.24(d) is the same as Fig. 2.20(c)]. Compare Figs. 2.24(e) and (f),
especially the latter, with the original image in Fig. 2.20(a).
bilinear and bicubic interpolation, respectively, to shrink and zoom the image.
In spite of a reduction in resolution from 1250 to 150, these last two images
compare reasonably favorably with the original, showing once again the
power of these two interpolation methods. As before, bicubic interpolation
yielded slightly sharper results. ■
68 Chapter 2 ■ Digital Image Fundamentals
0 1 1 0 1 1 0 1 1
0 1 0 0 1 0 0 1 0
0 0 1 0 0 1 0 0 1
1 1 1 0 0 0 0 0 0 0 0
1 0 1 Ri 0 1 1 0 0 0 1 0
0 1 0 0 1 1 0 0 0 1 0
0 0 1 0 1 1 1 0 0 1 0
1 1 1 Rj 0 1 1 1 0 0 1 0
1 1 1 0 0 0 0 0 0 0 0
a b c
d e f
FIGURE 2.25 (a) An arrangement of pixels. (b) Pixels that are 8-adjacent (adjacency is
shown by dashed lines; note the ambiguity). (c) m-adjacency. (d) Two regions (of 1s) that
are adjacent if 8-adjecency is used. (e) The circled point is part of the boundary of the
1-valued pixels only if 8-adjacency between the region and background is used. (f) The
inner boundary of the 1-valued region does not form a closed path, but its outer
boundary does.
70 Chapter 2 ■ Digital Image Fundamentals
†
We make this assumption to avoid having to deal with special cases. This is done without loss of gener-
ality because if one or more regions touch the border of an image, we can simply pad the image with a
1-pixel-wide border of background values.
2.5 ■ Some Basic Relationships between Pixels 71
Note that the D4 and D8 distances between p and q are independent of any
paths that might exist between the points because these distances involve only
the coordinates of the points. If we elect to consider m-adjacency, however, the
Dm distance between two points is defined as the shortest m-path between the
points. In this case, the distance between two pixels will depend on the values
of the pixels along the path, as well as the values of their neighbors. For in-
stance, consider the following arrangement of pixels and assume that p, p2, and
p4 have value 1 and that p1 and p3 can have a value of 0 or 1:
p3 p4
p1 p2
p
Suppose that we consider adjacency of pixels valued 1 (i.e., V = 516). If p1
and p3 are 0, the length of the shortest m-path (the Dm distance) between p
and p4 is 2. If p1 is 1, then p2 and p will no longer be m-adjacent (see the defi-
nition of m-adjacency) and the length of the shortest m-path becomes 3 (the
path goes through the points pp1p2p4). Similar comments apply if p3 is 1 (and
p1 is 0); in this case, the length of the shortest m-path also is 3. Finally, if both
p1 and p3 are 1, the length of the shortest m-path between p and p4 is 4. In this
case, the path goes through the sequence of points pp1p2p3p4.
where a i , aj , fi (x, y), and fj (x, y) are arbitrary constants and images (of the
same size), respectively. Equation (2.6-2) indicates that the output of a linear
operation due to the sum of two inputs is the same as performing the opera-
tion on the inputs individually and then summing the results. In addition, the
output of a linear operation to a constant times an input is the same as the out-
put of the operation due to the original input multiplied by that constant. The
first property is called the property of additivity and the second is called the
property of homogeneity.
As a simple example, suppose that H is the sum operator, ©; that is, the
function of this operator is simply to sum its inputs. To test for linearity, we
start with the left side of Eq. (2.6-2) and attempt to prove that it is equal to the
right side:
= ai gi (x, y) + aj gj (x, y)
where the first step follows from the fact that summation is distributive. So, an
expansion of the left side is equal to the right side of Eq. (2.6-2), and we con-
clude that the sum operator is linear.
74 Chapter 2 ■ Digital Image Fundamentals
On the other hand, consider the max operation, whose function is to find
the maximum value of the pixels in an image. For our purposes here, the sim-
plest way to prove that this operator is nonlinear, is to find an example that
fails the test in Eq. (2.6-2). Consider the following two images
0 2 6 5
f1 = B R and f2 = B R
2 3 4 7
and suppose that we let a1 = 1 and a2 = -1. To test for linearity, we again
start with the left side of Eq. (2.6-2):
0 2 6 5 -6 -3
max b (1) B R + (-1) B R r = max b B Rr
2 3 4 7 -2 -4
= -2
Working next with the right side, we obtain
0 2 6 5
(1) max b B R r + (-1) max b B R r = 3 + (-1)7
2 3 4 7
= -4
The left and right sides of Eq. (2.6-2) are not equal in this case, so we have
proved that in general the max operator is nonlinear.
As you will see in the next three chapters, especially in Chapters 4 and 5, lin-
ear operations are exceptionally important because they are based on a large
body of theoretical and practical results that are applicable to image process-
ing. Nonlinear systems are not nearly as well understood, so their scope of ap-
plication is more limited. However, you will encounter in the following
chapters several nonlinear image processing operations whose performance
far exceeds what is achievable by their linear counterparts.
where, as usual, M and N are the row and column sizes of the images. Clearly,
s, d, p, and v are images of size M * N also. Note that image arithmetic in the
manner just defined involves images of the same size. The following examples
are indicative of the important role played by arithmetic operations in digital
image processing.
■ Let g(x, y) denote a corrupted image formed by the addition of noise, EXAMPLE 2.5:
h(x, y), to a noiseless image f(x, y); that is, Addition
(averaging) of
noisy images for
g(x, y) = f(x, y) + h(x, y) (2.6-4) noise reduction.
where the assumption is that at every pair of coordinates (x, y) the noise is un-
correlated† and has zero average value. The objective of the following proce-
dure is to reduce the noise content by adding a set of noisy images, 5gi (x, y)6.
This is a technique used frequently for image enhancement.
If the noise satisfies the constraints just stated, it can be shown (Problem 2.20)
that if an image g(x, y) is formed by averaging K different noisy images,
1 K
K ia
g(x, y) = gi (x, y) (2.6-5)
=1
and
1 2
sq2g(x,y) = s (2.6-7)
K h(x,y)
where E5g(x, y)6 is the expected value of g, and sq2g(x,y) and sh(x,y)2
are the
variances of g and h, respectively, all at coordinates (x, y). The standard devia-
tion (square root of the variance) at any point in the average image is
1
sqg(x,y) = sh(x,y) (2.6-8)
2K
As K increases, Eqs. (2.6-7) and (2.6-8) indicate that the variability (as measured
by the variance or the standard deviation) of the pixel values at each location
(x, y) decreases. Because E5g(x, y)6 = f(x, y), this means that g(x, y) ap-
proaches f(x, y) as the number of noisy images used in the averaging process
increases. In practice, the images gi (x, y) must be registered (aligned) in order to
avoid the introduction of blurring and other artifacts in the output image.
†
Recall that the variance of a random variable z with mean m is defined as E[(z - m)2], where E5 # 6 is
the expected value of the argument. The covariance of two random variables zi and zj is defined as
E[(zi - mi)(zj - mj)]. If the variables are uncorrelated, their covariance is 0.
76 Chapter 2 ■ Digital Image Fundamentals
a b c
d e f
FIGURE 2.26 (a) Image of Galaxy Pair NGC 3314 corrupted by additive Gaussian noise. (b)–(f) Results of
averaging 5, 10, 20, 50, and 100 noisy images, respectively. (Original image courtesy of NASA.)
The images shown in this An important application of image averaging is in the field of astronomy,
example are from a
galaxy pair called NGC where imaging under very low light levels frequently causes sensor noise to
3314, taken by NASA’s render single images virtually useless for analysis. Figure 2.26(a) shows an 8-bit
Hubble Space Telescope.
NGC 3314 lies about 140 image in which corruption was simulated by adding to it Gaussian noise with
million light-years from zero mean and a standard deviation of 64 intensity levels. This image, typical of
Earth, in the direction of
the southern-hemisphere noisy images taken under low light conditions, is useless for all practical pur-
constellation Hydra. The poses. Figures 2.26(b) through (f) show the results of averaging 5, 10, 20, 50, and
bright stars forming a
pinwheel shape near the 100 images, respectively. We see that the result in Fig. 2.26(e), obtained with
center of the front galaxy K = 50, is reasonably clean. The image Fig. 2.26(f), resulting from averaging
were formed from inter-
stellar gas and dust. 100 noisy images, is only a slight improvement over the image in Fig. 2.26(e).
Addition is a discrete version of continuous integration. In astronomical
observations, a process equivalent to the method just described is to use the in-
tegrating capabilities of CCD (see Section 2.3.3) or similar sensors for noise
reduction by observing the same scene over long periods of time. Cooling also
is used to reduce sensor noise.The net effect, however, is analogous to averaging
a set of noisy digital images. ■
2.6 ■ An Introduction to the Mathematical Tools Used in Digital Image Processing 77
a b c
FIGURE 2.27 (a) Infrared image of the Washington, D.C. area. (b) Image obtained by setting to zero the least
significant bit of every pixel in (a). (c) Difference of the two images, scaled to the range [0, 255] for clarity.
78 Chapter 2 ■ Digital Image Fundamentals
a b
c d
FIGURE 2.28
Digital
subtraction
angiography.
(a) Mask image.
(b) A live image.
(c) Difference
between (a) and
(b). (d) Enhanced
difference image.
(Figures (a) and
(b) courtesy of
The Image
Sciences Institute,
University
Medical Center,
Utrecht, The
Netherlands.)
the difference between (a) and (b). Some fine blood vessel structures are visi-
ble in this image. The difference is clear in Fig. 2.28(d), which was obtained by
enhancing the contrast in (c) (we discuss contrast enhancement in the next
chapter). Figure 2.28(d) is a clear “map” of how the medium is propagating
through the blood vessels in the subject’s brain. ■
a b c
FIGURE 2.29 Shading correction. (a) Shaded SEM image of a tungsten filament and support, magnified
approximately 130 times. (b) The shading pattern. (c) Product of (a) by the reciprocal of (b). (Original image
courtesy of Michael Shaffer, Department of Geological Sciences, University of Oregon, Eugene.)
fm = f - min(f) (2.6-10)
a b c
FIGURE 2.30 (a) Digital dental X-ray image. (b) ROI mask for isolating teeth with fillings (white corresponds to
1 and black corresponds to 0). (c) Product of (a) and (b).
80 Chapter 2 ■ Digital Image Fundamentals
The set universe, U, is the set of all elements in a given application. By defi-
nition, all set elements in a given application are members of the universe de-
fined for that application. For example, if you are working with the set of real
numbers, then the set universe is the real line, which contains all the real num-
bers. In image processing, we typically define the universe to be the rectangle
containing all the pixels in an image.
The complement of a set A is the set of elements that are not in A:
Ac = 5w ƒ w x A6 (2.6-18)
A - B = 5w ƒ w H A, w x B6 = A ¨ B c (2.6-19)
We see that this is the set of elements that belong to A, but not to B. We could,
for example, define Ac in terms of U and the set difference operation:
Ac = U - A.
Figure 2.31 illustrates the preceding concepts, where the universe is the set
of coordinates contained within the rectangle shown, and sets A and B are the
sets of coordinates contained within the boundaries shown. The result of the
set operation indicated in each figure is shown in gray.†
In the preceding discussion, set membership is based on position (coordi-
nates). An implicit assumption when working with images is that the intensity
of all pixels in the sets is the same, as we have not defined set operations in-
volving intensity values (e.g., we have not specified what the intensities in the
intersection of two sets is). The only way that the operations illustrated in Fig.
2.31 can make sense is if the images containing the sets are binary, in which case
we can talk about set membership based on coordinates, the assumption being
that all member of the sets have the same intensity. We discuss this in more de-
tail in the following subsection.
When dealing with gray-scale images, the preceding concepts are not ap-
plicable, because we have to specify the intensities of all the pixels resulting
from a set operation. In fact, as you will see in Sections 3.8 and 9.6, the union
and intersection operations for gray-scale values usually are defined as the
max and min of corresponding pixel pairs, respectively, while the complement
is defined as the pairwise differences between a constant and the intensity of
every pixel in an image. The fact that we deal with corresponding pixel pairs
tells us that gray-scale set operations are array operations, as defined in
Section 2.6.1. The following example is a brief illustration of set operations in-
volving gray-scale images. We discuss these concepts further in the two sec-
tions mentioned above.
†
The operations in Eqs. (2.6-12)–(2.6-19) are the basis for the algebra of sets, which starts with properties
such as the commutative laws: A ´ B = B ´ A and A ¨ B = B ¨ A, and from these develops a broad
theory based on set operations. A treatment of the algebra of sets is beyond the scope of the present dis-
cussion, but you should be aware of its existence.
82 Chapter 2 ■ Digital Image Fundamentals
a b c
d e
FIGURE 2.31
(a) Two sets of
coordinates, A and B,
in 2-D space. (b) The A
union of A and B. A B A B
(c) The intersection B
of A and B. (d) The
complement of A. U
(e) The difference
between A and B. In
(b)–(e) the shaded
areas represent the
members of the set
operation indicated.
AB
Ac
EXAMPLE 2.8: ■ Let the elements of a gray-scale image be represented by a set A whose
Set operations elements are triplets of the form (x, y, z), where x and y are spatial coordi-
involving image nates and z denotes intensity, as mentioned in Section 2.4.2. We can define
the complement of A as the set Ac = 5(x, y, K - z) ƒ (x, y, z) H A6, which
intensities.
simply denotes the set of pixels of A whose intensities have been subtracted
from a constant K. This constant is equal to 2k - 1, where k is the number of
intensity bits used to represent z. Let A denote the 8-bit gray-scale image in
Fig. 2.32(a), and suppose that we want to form the negative of A using set
a b c
FIGURE 2.32 Set
operations
involving gray-
scale images.
(a) Original
image. (b) Image
negative obtained
using set
complementation.
(c) The union of
(a) and a constant
image.
(Original image
courtesy of G.E.
Medical Systems.)
2.6 ■ An Introduction to the Mathematical Tools Used in Digital Image Processing 83
A ´ B = e max(a, b) ƒ a H A, b H B f
z
That is, the union of two gray-scale sets (images) is an array formed from the
maximum intensity between pairs of spatially corresponding elements. Again,
note that coordinates carry over, so the union of A and B is an image of the
same size as these two images. As an illustration, suppose that A again repre-
sents the image in Fig. 2.32(a), and let B denote a rectangular array of the
same size as A, but in which all values of z are equal to 3 times the mean in-
tensity, m, of the elements of A. Figure 2.32(c) shows the result of performing
the set union, in which all values exceeding 3m appear as values from A and all
other pixels have value 3m, which is a mid-gray value. ■
Logical operations
When dealing with binary images, we can think of foreground (1-valued) and
background (0-valued) sets of pixels. Then, if we define regions (objects) as
being composed of foreground pixels, the set operations illustrated in Fig. 2.31
become operations between the coordinates of objects in a binary image.
When dealing with binary images, it is common practice to refer to union, in-
tersection, and complement as the OR, AND, and NOT logical operations,
where “logical” arises from logic theory in which 1 and 0 denote true and false,
respectively.
Consider two regions (sets) A and B composed of foreground pixels. The
OR of these two sets is the set of elements (coordinates) belonging either to A
or B or to both. The AND operation is the set of elements that are common to
A and B. The NOT operation of a set A is the set of elements not in A. Be-
cause we are dealing with images, if A is a given set of foreground pixels,
NOT(A) is the set of all pixels in the image that are not in A, these pixels
being background pixels and possibly other foreground pixels. We can think
of this operation as turning all elements in A to 0 (black) and all the elements
not in A to 1 (white). Figure 2.33 illustrates these operations. Note in the
fourth row that the result of the operation shown is the set of foreground pix-
els that belong to A but not to B, which is the definition of set difference in
Eq. (2.6-19). The last row in the figure is the XOR (exclusive OR) operation,
which is the set of foreground pixels belonging to A or B, but not both. Ob-
serve that the preceding operations are between regions, which clearly can be
irregular and of different sizes. This is as opposed to the gray-scale operations
discussed earlier, which are array operations and thus require sets whose spa-
tial dimensions are the same. That is, gray-scale set operations involve com-
plete images, as opposed to regions of images.
We need be concerned in theory only with the cability to implement the AND,
OR, and NOT logic operators because these three operators are functionally
84 Chapter 2 ■ Digital Image Fundamentals
reference only.
OR
They are not part
of the result.
AND-
NOT
XOR
complete. In other words, any other logic operator can be implemented by using
only these three basic functions, as in the fourth row of Fig. 2.33, where we im-
plemented the set difference operation using AND and NOT. Logic operations
are used extensively in image morphology, the topic of Chapter 9.
Fuzzy sets
The preceding set and logical results are crisp concepts, in the sense that ele-
ments either are or are not members of a set. This presents a serious limitation
in some applications. Consider a simple example. Suppose that we wish to cat-
egorize all people in the world as being young or not young. Using crisp sets,
let U denote the set of all people and let A be a subset of U, which we call the
set of young people. In order to form set A, we need a membership function
that assigns a value of 1 or 0 to every element (person) in U. If the value as-
signed to an element of U is 1, then that element is a member of A; otherwise
it is not. Because we are dealing with a bi-valued logic, the membership func-
tion simply defines a threshold at or below which a person is considered young,
and above which a person is considered not young. Suppose that we define as
young any person of age 20 or younger. We see an immediate difficulty. A per-
son whose age is 20 years and 1 sec would not be a member of the set of young
people. This limitation arises regardless of the age threshold we use to classify a
person as being young. What we need is more flexibility in what we mean by
“young,” that is, we need a gradual transition from young to not young. The the-
ory of fuzzy sets implements this concept by utilizing membership functions
2.6 ■ An Introduction to the Mathematical Tools Used in Digital Image Processing 85
that are gradual between the limit values of 1 (definitely young) to 0 (definite-
ly not young). Using fuzzy sets, we can make a statement such as a person being
50% young (in the middle of the transition between young and not young). In
other words, age is an imprecise concept, and fuzzy logic provides the tools to
deal with such concepts. We explore fuzzy sets in detail in Section 3.8.
Single-pixel operations
The simplest operation we perform on a digital image is to alter the values of
its individual pixels based on their intensity. This type of process may be ex-
pressed as a transformation function, T, of the form:
s = T(z) (2.6-20)
where z is the intensity of a pixel in the original image and s is the (mapped)
intensity of the corresponding pixel in the processed image. For example,
Fig. 2.34 shows the transformation used to obtain the negative of an 8-bit
image, such as the image in Fig. 2.32(b), which we obtained using set operations.
We discuss in Chapter 3 a number of techniques for specifying intensity trans-
formation functions.
Neighborhood operations
Let Sxy denote the set of coordinates of a neighborhood centered on an arbi-
trary point (x, y) in an image, f. Neighborhood processing generates a corres-
ponding pixel at the same coordinates in an output (processed) image, g, such
that the value of that pixel is determined by a specified operation involving the
pixels in the input image with coordinates in Sxy. For example, suppose that
the specified operation is to compute the average value of the pixels in a rec-
tangular neighborhood of size m * n centered on (x, y). The locations of pixels
a b
c d n
FIGURE 2.35
Local averaging m
using (x, y) (x, y)
neighborhood The value of this pixel
processing. The Sxy is the average value of the
procedure is pixels in Sxy
illustrated in
(a) and (b) for a
rectangular
neighborhood.
(c) The aortic
angiogram
discussed in
Section 1.3.2. Image f Image g
(d) The result of
using Eq. (2.6-21)
with m = n = 41.
The images are of
size 790 * 686
pixels.
in this region constitute the set Sxy. Figures 2.35(a) and (b) illustrate the
process. We can express this operation in equation form as
1
g(x, y) = a f(r, c)
mn (r, c)HS
(2.6-21)
xy
where r and c are the row and column coordinates of the pixels whose coordi-
nates are members of the set Sxy. Image g is created by varying the coordi-
nates (x, y) so that the center of the neighborhood moves from pixel to pixel in
image f, and repeating the neighborhood operation at each new location. For
instance, the image in Fig. 2.35(d) was created in this manner using a neigh-
borhood of size 41 * 41. The net effect is to perform local blurring in the orig-
inal image. This type of process is used, for example, to eliminate small details
and thus render “blobs” corresponding to the largest regions of an image. We
2.6 ■ An Introduction to the Mathematical Tools Used in Digital Image Processing 87
t11 t12 0
[x y 1] = [v w 1] T = [v w 1] C 21
t t22 0S (2.6-23)
t31 t32 1
TABLE 2.2
Affine transformations based on Eq. (2.6-23).
Transformation Coordinate
Affine Matrix, T Example
Name Equations
Identity 1 0 0 xv
yw y
0 1 0
0 0 1
x
Scaling cx 0 0 x cxv
0 cy 0 y cyw
0 0 1
Translation 1 0 x v tx
0
0 1 0 y w ty
tx ty 1
0 0 1
0 0 1
each location, (v, w), computing the spatial location, (x, y), of the correspond-
ing pixel in the output image using Eq. (2.6-23) directly. A problem with the
forward mapping approach is that two or more pixels in the input image can
be transformed to the same location in the output image, raising the question
of how to combine multiple output values into a single output pixel. In addi-
tion, it is possible that some output locations may not be assigned a pixel at all.
The second approach, called inverse mapping, scans the output pixel locations
and, at each location, (x, y), computes the corresponding location in the input
image using (v, w) = T-1(x, y). It then interpolates (using one of the tech-
niques discussed in Section 2.4.4) among the nearest input pixels to determine
the intensity of the output pixel value. Inverse mappings are more efficient to
implement than forward mappings and are used in numerous commercial im-
plementations of spatial transformations (for example, MATLAB uses this
approach).
2.6 ■ An Introduction to the Mathematical Tools Used in Digital Image Processing 89
a b c d
FIGURE 2.36 (a) A 300 dpi image of the letter T. (b) Image rotated 21° using nearest neighbor interpolation
to assign intensity values to the spatially transformed pixels. (c) Image rotated 21° using bilinear
interpolation. (d) Image rotated 21° using bicubic interpolation. The enlarged sections show edge detail for
the three interpolation approaches.
■ The objective of this example is to illustrate image rotation using an affine EXAMPLE 2.9:
transform. Figure 2.36(a) shows a 300 dpi image and Figs. 2.36(b)–(d) are the re- Image rotation
sults of rotating the original image by 21°, using nearest neighbor, bilinear, and and intensity
interpolation.
bicubic interpolation, respectively. Rotation is one of the most demanding geo-
metric transformations in terms of preserving straight-line features. As we see in
the figure, nearest neighbor interpolation produced the most jagged edges and, as
in Section 2.4.4, bilinear interpolation yielded significantly improved results. As
before, using bicubic interpolation produced slightly sharper results. In fact, if you
compare the enlarged detail in Figs. 2.36(c) and (d), you will notice in the middle
of the subimages that the number of vertical gray “blocks” that provide the in-
tensity transition from light to dark in Fig. 2.36(c) is larger than the correspond-
ing number of blocks in (d), indicting that the latter is a sharper edge. Similar
results would be obtained with the other spatial transformations in Table 2.2 that
require interpolation (the identity transformation does not, and neither does the
translation transformation if the increments are an integer number of pixels).
This example was implemented using the inverse mapping approach discussed in
the preceding paragraph. ■
and
y = c5v + c6w + c7vw + c8 (2.6-25)
where, during the estimation phase, (v, w) and (x, y) are the coordinates of tie
points in the input and reference images, respectively. If we have four pairs of
corresponding tie points in both images, we can write eight equations using
Eqs. (2.6-24) and (2.6-25) and use them to solve for the eight unknown coeffi-
cients, c1, c2, Á , c8. These coefficients constitute the model that transforms
the pixels of one image into the locations of the pixels of the other to achieve
registration.
Once we have the coefficients, Eqs. (2.6-24) and (2.6-25) become our vehi-
cle for transforming all the pixels in the input image to generate the desired
new image, which, if the tie points were selected correctly, should be registered
with the reference image. In situations where four tie points are insufficient to
obtain satisfactory registration, an approach used frequently is to select a larger
number of tie points and then treat the quadrilaterals formed by groups of
four tie points as subimages. The subimages are processed as above, with all
the pixels within a quadrilateral being transformed using the coefficients de-
termined from those tie points. Then we move to another set of four tie points
and repeat the procedure until all quadrilateral regions have been processed.
Of course, it is possible to use regions that are more complex than quadrilater-
als and employ more complex models, such as polynomials fitted by least
2.6 ■ An Introduction to the Mathematical Tools Used in Digital Image Processing 91
■ Figure 2.37(a) shows a reference image and Fig. 2.37(b) shows the same EXAMPLE 2.10:
image, but distorted geometrically by vertical and horizontal shear. Our objec- Image
tive is to use the reference image to obtain tie points and then use the tie registration.
points to register the images. The tie points we selected (manually) are shown
as small white squares near the corners of the images (we needed only four tie
a b
c d
FIGURE 2.37
Image
registration.
(a) Reference
image. (b) Input
(geometrically
distorted image).
Corresponding tie
points are shown
as small white
squares near the
corners.
(c) Registered
image (note the
errors in the
border).
(d) Difference
between (a) and
(c), showing more
registration
errors.
92 Chapter 2 ■ Digital Image Fundamentals
points because the distortion is linear shear in both directions). Figure 2.37(c)
shows the result of using these tie points in the procedure discussed in the pre-
ceding paragraphs to achieve registration. We note that registration was not
perfect, as is evident by the black edges in Fig. 2.37(c). The difference image in
Fig. 2.37(d) shows more clearly the slight lack of registration between the refer-
ence and corrected images.The reason for the discrepancies is error in the man-
ual selection of the tie points. It is difficult to achieve perfect matches for tie
points when distortion is so severe. ■
where z1 is the intensity of the pixel in the red image, and the other two ele-
ments are the corresponding pixel intensities in the green and blue images,
respectively. Thus an RGB color image of size M * N can be represented by
three component images of this size, or by a total of MN 3-D vectors. A general
multispectral case involving n component images (e.g., see Fig. 1.10) will result
in n-dimensional vectors. We use this type of vector representation in parts of
Chapters 6, 10, 11, and 12.
Once pixels have been represented as vectors we have at our disposal the
tools of vector-matrix theory. For example, the Euclidean distance, D, between
a pixel vector z and an arbitrary point a in n-dimensional space is defined as
the vector product
D(z, a) = C (z - a)T(z - a) D
1
2
(2.6-27)
= C (z1 - a 1) + (z2 - a 2) + Á + (zn - a n)2 D
1
2 2 2
FIGURE 2.38
Formation of a
vector from
corresponding
pixel values in
three RGB
component z1
images. z z2
z3 Component image 3 (Blue)
Component image 2 (Green)
w = A(z a) (2.6-28)
g = Hf n (2.6-29)
M-1 N-1
T(u, v) = a a f(x, y)r(x, y, u, v) (2.6-30)
x=0 y=0
where f(x, y) is the input image, r(x, y, u, v) is called the forward transforma-
tion kernel, and Eq. (2.6-30) is evaluated for u = 0, 1, 2, Á , M - 1 and
v = 0, 1, 2, Á , N - 1. As before, x and y are spatial variables, while M and N
94 Chapter 2 ■ Digital Image Fundamentals
EXAMPLE 2.11: ■ Figure 2.40 shows an example of the steps in Fig. 2.39. In this case the trans-
Image processing form used was the Fourier transform, which we mention briefly later in this
in the transform section and discuss in detail in Chapter 4. Figure 2.40(a) is an image corrupted
domain.
a b
c d
FIGURE 2.40
(a) Image corrupted
by sinusoidal
interference. (b)
Magnitude of the
Fourier transform
showing the bursts
of energy responsible
for the interference.
(c) Mask used to
eliminate the energy
bursts. (d) Result of
computing the
inverse of the
modified Fourier
transform. (Original
image courtesy of
NASA.)
2.6 ■ An Introduction to the Mathematical Tools Used in Digital Image Processing 95
and
1 M-1 N-1 j2p(ux>M + vy>N)
MN ua a T(u, v) e
f(x, y) = (2.6-37)
=0 v=0
forward and inverse kernels of a transform pair satisfy these two conditions,
and f(x, y) is a square image of size M * M, Eqs. (2.6-30) and (2.6-31) can be
expressed in matrix form:
T = AFA (2.6-38)
where F is an M * M matrix containing the elements of f(x, y) [see Eq. (2.4-2)],
A is an M * M matrix with elements aij = r1(i, j), and T is the resulting
M * M transform, with values T(u, v) for u, v = 0, 1, 2, Á , M - 1.
To obtain the inverse transform, we pre- and post-multiply Eq. (2.6-38) by
an inverse transformation matrix B:
If B = A-1,
F = BTB (2.6-40)
indicating that F [whose elements are equal to image f(x, y)] can be recov-
ered completely from its forward transform. If B is not equal to A-1, then use
of Eq. (2.6-40) yields an approximation:
N = BAFAB
F (2.6-41)
a p(zk) = 1 (2.6-43)
k=0
Once we have p(zk), we can determine a number of important image charac-
teristics. For example, the mean (average) intensity is given by
L-1
m = a zk p(zk) (2.6-44)
k=0
2.6 ■ An Introduction to the Mathematical Tools Used in Digital Image Processing 97
The variance is a measure of the spread of the values of z about the mean, so it
is a useful measure of image contrast. In general, the nth moment of random
variable z about the mean is defined as
L-1
mn(z) = a (zk - m)n p(zk) (2.6-46)
k=0
We see that m0(z) = 1, m1(z) = 0, and m2(z) = s2. Whereas the mean and The units of the variance
are in intensity values
variance have an immediately obvious relationship to visual properties of an squared. When compar-
image, higher-order moments are more subtle. For example, a positive third ing contrast values, we
usually use the standard
moment indicates that the intensities are biased to values higher than the deviation, s (square root
mean, a negative third moment would indicate the opposite condition, and a of the variance), instead
because its dimensions
zero third moment would tell us that the intensities are distributed approxi- are directly in terms of
mately equally on both sides of the mean. These features are useful for com- intensity values.
putational purposes, but they do not tell us much about the appearance of an
image in general.
■ Figure 2.41 shows three 8-bit images exhibiting low, medium, and high con- EXAMPLE 2.12:
trast, respectively. The standard deviations of the pixel intensities in the three Comparison of
images are 14.3, 31.6, and 49.2 intensity levels, respectively. The corresponding standard
deviation values
variance values are 204.3, 997.8, and 2424.9, respectively. Both sets of values as measures of
tell the same story but, given that the range of possible intensity values in image intensity
these images is [0, 255], the standard deviation values relate to this range much contrast.
more intuitively than the variance. ■
As you will see in progressing through the book, concepts from probability
play a central role in the development of image processing algorithms. For ex-
ample, in Chapter 3 we use the probability measure in Eq. (2.6-42) to derive in-
tensity transformation algorithms. In Chaper 5, we use probability and matrix
formulations to develop image restoration algorithms. In Chapter 10, probabil-
ity is used for image segmentation, and in Chapter 11 we use it for texture de-
scription. In Chapter 12, we derive optimum object recognition techniques
based on a probabilistic formulation.
a b c
FIGURE 2.41
Images exhibiting
(a) low contrast,
(b) medium
contrast, and
(c) high contrast.
98 Chapter 2 ■ Digital Image Fundamentals
Thus far, we have addressed the issue of applying probability to a single ran-
dom variable (intensity) over a single 2-D image. If we consider sequences of
images, we may interpret the third variable as time. The tools needed to handle
this added complexity are stochastic image processing techniques (the word
stochastic is derived from a Greek word meaning roughly “to aim at a target,”
implying randomness in the outcome of the process). We can go a step further
and consider an entire image (as opposed to a point) to be a spatial random
event. The tools needed to handle formulations based on this concept are tech-
niques from random fields. We give one example in Section 5.8 of how to treat
entire images as random events, but further discussion of stochastic processes
and random fields is beyond the scope of this book.The references at the end of
this chapter provide a starting point for reading about these topics.
Summary
The material in this chapter is primarily background for subsequent discussions. Our treat-
ment of the human visual system, although brief, provides a basic idea of the capabilities of
the eye in perceiving pictorial information.The discussion on light and the electromagnetic
spectrum is fundamental in understanding the origin of the many images we use in this
book. Similarly, the image model developed in Section 2.3.4 is used in the Chapter 4 as the
basis for an image enhancement technique called homomorphic filtering.
The sampling and interpolation ideas introduced in Section 2.4 are the foundation
for many of the digitizing phenomena you are likely to encounter in practice. We will
return to the issue of sampling and many of its ramifications in Chapter 4, after you
have mastered the Fourier transform and the frequency domain.
The concepts introduced in Section 2.5 are the basic building blocks for processing
techniques based on pixel neighborhoods. For example, as we show in the following
chapter, and in Chapter 5, neighborhood processing methods are at the core of many
image enhancement and restoration procedures. In Chapter 9, we use neighborhood
operations for image morphology; in Chapter 10, we use them for image segmentation;
and in Chapter 11 for image description. When applicable, neighborhood processing is
favored in commercial applications of image processing because of their operational
speed and simplicity of implementation in hardware and/or firmware.
The material in Section 2.6 will serve you well in your journey through the book. Al-
though the level of the discussion was strictly introductory, you are now in a position to
conceptualize what it means to process a digital image. As we mentioned in that section,
the tools introduced there are expanded as necessary in the following chapters. Rather
than dedicate an entire chapter or appendix to develop a comprehensive treatment of
mathematical concepts in one place, you will find it considerably more meaningful to
learn the necessary extensions of the mathematical tools from Section 2.6 in later chap-
ters, in the context of how they are applied to solve problems in image processing.
The area of image sensing is quite broad and very fast moving. An excellent source
of information on optical and other imaging sensors is the Society for Optical Engi-
neering (SPIE). The following are representative publications by the SPIE in this area:
Blouke et al. [2001], Hoover and Doty [1996], and Freeman [1987].
The image model presented in Section 2.3.4 is from Oppenheim, Schafer, and
Stockham [1968]. A reference for the illumination and reflectance values used in that
section is the IESNA Lighting Handbook [2000]. For additional reading on image
sampling and some of its effects, such as aliasing, see Bracewell [1995]. We discuss this
topic in more detail in Chapter 4. The early experiments mentioned in Section 2.4.3
on perceived image quality as a function of sampling and quatization were reported
by Huang [1965]. The issue of reducing the number of samples and intensity levels in
an image while minimizing the ensuing degradation is still of current interest, as ex-
emplified by Papamarkos and Atsalakis [2000]. For further reading on image shrink-
ing and zooming, see Sid-Ahmed [1995], Unser et al. [1995], Umbaugh [2005], and
Lehmann et al. [1999]. For further reading on the topics covered in Section 2.5, see
Rosenfeld and Kak [1982], Marchand-Maillet and Sharaiha [2000], and Ritter and
Wilson [2001].
Additional reading on linear systems in the context of image processing (Section 2.6.2)
may be found in Castleman [1996]. The method of noise reduction by image averaging
(Section 2.6.3) was first proposed by Kohler and Howell [1963]. See Peebles [1993] re-
garding the expected value of the mean and variance of a sum of random variables.
Image subtraction (Section 2.6.3) is a generic image processing tool used widely for
change detection. For image subtraction to make sense, it is necessary that the images
being subtracted be registered or, alternatively, that any artifacts due to motion be
identified. Two papers by Meijering et al. [1999, 2001] are illustrative of the types of
techniques used to achieve these objectives.
A basic reference for the material in Section 2.6.4 is Cameron [2005]. For more ad-
vanced reading on this topic, see Tourlakis [2003]. For an introduction to fuzzy sets, see
Section 3.8 and the corresponding references in Chapter 3. For further details on single-
point and neighborhood processing (Section 2.6.5), see Sections 3.2 through 3.4 and the
references on these topics in Chapter 3. For geometric spatial transformations, see Wol-
berg [1990].
Noble and Daniel [1988] is a basic reference for matrix and vector operations
(Section 2.6.6). See Chapter 4 for a detailed discussion on the Fourier transform
(Section 2.6.7), and Chapters 7, 8, and 11 for examples of other types of transforms
used in digital image processing. Peebles [1993] is a basic introduction to probability
and random variables (Section 2.6.8) and Papoulis [1991] is a more advanced treat-
ment of this topic. For foundation material on the use of stochastic and random
fields for image processing, see Rosenfeld and Kak [1982], Jähne [2002], and Won
and Gray [2004].
For details of software implementation of many of the techniques illustrated in this
chapter, see Gonzalez, Woods, and Eddins [2004].
Problems
2.1 Using the background information provided in Section 2.1, and thinking purely Detailed solutions to the
problems marked with a
in geometric terms, estimate the diameter of the smallest printed dot that the star can be found in the
eye can discern if the page on which the dot is printed is 0.2 m away from the book Web site. The site
eyes. Assume for simplicity that the visual system ceases to detect the dot when also contains suggested
projects based on the ma-
the image of the dot on the fovea becomes smaller than the diameter of one re- terial in this chapter.
ceptor (cone) in that area of the retina. Assume further that the fovea can be
100 Chapter 2 ■ Digital Image Fundamentals
modeled as a square array of dimensions 1.5 mm * 1.5 mm, and that the cones
and spaces between the cones are distributed uniformly throughout this array.
2.2 When you enter a dark theater on a bright day, it takes an appreciable interval
of time before you can see well enough to find an empty seat. Which of the visual
processes explained in Section 2.1 is at play in this situation?
2.3 Although it is not shown in Fig. 2.10, alternating current certainly is part of the
electromagnetic spectrum. Commercial alternating current in the United States
has a frequency of 60 Hz. What is the wavelength in kilometers of this compo-
nent of the spectrum?
2.4 You are hired to design the front end of an imaging system for studying the
boundary shapes of cells, bacteria, viruses, and protein. The front end consists, in
this case, of the illumination source(s) and corresponding imaging camera(s).
The diameters of circles required to enclose individual specimens in each of
these categories are 50, 1, 0.1, and 0.01 m, respectively.
(a) Can you solve the imaging aspects of this problem with a single sensor and
camera? If your answer is yes, specify the illumination wavelength band and
the type of camera needed. By “type,” we mean the band of the electromag-
netic spectrum to which the camera is most sensitive (e.g., infrared).
(b) If your answer in (a) is no, what type of illumination sources and corre-
sponding imaging sensors would you recommend? Specify the light sources
and cameras as requested in part (a). Use the minimum number of illumina-
tion sources and cameras needed to solve the problem.
By “solving the problem,” we mean being able to detect circular details of diam-
eter 50, 1, 0.1, and 0.01 m, respectively.
2.5 A CCD camera chip of dimensions 7 * 7 mm, and having 1024 * 1024 ele-
ments, is focused on a square, flat area, located 0.5 m away. How many line
pairs per mm will this camera be able to resolve? The camera is equipped with
a 35-mm lens. (Hint: Model the imaging process as in Fig. 2.3, with the focal
length of the camera lens substituting for the focal length of the eye.)
2.6 An automobile manufacturer is automating the placement of certain compo-
nents on the bumpers of a limited-edition line of sports cars. The components
are color coordinated, so the robots need to know the color of each car in order
to select the appropriate bumper component. Models come in only four colors:
blue, green, red, and white. You are hired to propose a solution based on imag-
ing. How would you solve the problem of automatically determining the color of
each car, keeping in mind that cost is the most important consideration in your
choice of components?
2.7 Suppose that a flat area with center at (x0, y0) is illuminated by a light source
with intensity distribution
2
+ (y - y0)2]
i(x, y) = Ke-[(x - x0)
Assume for simplicity that the reflectance of the area is constant and equal to
1.0, and let K = 255. If the resulting image is digitized with k bits of intensity
resolution, and the eye can detect an abrupt change of eight shades of intensity
between adjacent pixels, what value of k will cause visible false contouring?
2.8 Sketch the image in Problem 2.7 for k = 2.
2.9 A common measure of transmission for digital data is the baud rate, defined as
the number of bits transmitted per second. Generally, transmission is accomplished
■ Problems 101
in packets consisting of a start bit, a byte (8 bits) of information, and a stop bit.
Using these facts, answer the following:
(a) How many minutes would it take to transmit a 1024 * 1024 image with 256
intensity levels using a 56K baud modem?
(b) What would the time be at 3000K baud, a representative medium speed of a
phone DSL (Digital Subscriber Line) connection?
2.10 High-definition television (HDTV) generates images with 1125 horizontal TV
lines interlaced (where every other line is painted on the tube face in each of two
fields, each field being 1>60th of a second in duration). The width-to-height as-
pect ratio of the images is 16:9. The fact that the number of horizontal lines is
fixed determines the vertical resolution of the images. A company has designed
an image capture system that generates digital images from HDTV images. The
resolution of each TV (horizontal) line in their system is in proportion to vertical
resolution, with the proportion being the width-to-height ratio of the images.
Each pixel in the color image has 24 bits of intensity resolution, 8 bits each for a
red, a green, and a blue image. These three “primary” images form a color image.
How many bits would it take to store a 2-hour HDTV movie?
2.11 Consider the two image subsets, S1 and S2, shown in the following figure. For
V = 516, determine whether these two subsets are (a) 4-adjacent, (b) 8-adjacent,
or (c) m-adjacent.
S1 S2
0 0 0 0 0 0 0 1 1 0
1 0 0 1 0 0 1 0 0 1
1 0 0 1 0 1 1 0 0 0
0 0 1 1 1 0 0 0 0 0
0 0 1 1 1 0 0 1 1 1
2 2 0 2
1 2 1 1
( p) 1 0 1 2
102 Chapter 2 ■ Digital Image Fundamentals
2.16 (a) Give the condition(s) under which the D4 distance between two points p
and q is equal to the shortest 4-path between these points.
(b) Is this path unique?
2.17 Repeat Problem 2.16 for the D8 distance.
2.18 In the next chapter, we will deal with operators whose function is to compute
the sum of pixel values in a small subimage area, S. Show that these are linear
operators.
2.19 The median, z, of a set of numbers is such that half the values in the set are
below z and the other half are above it. For example, the median of the set of
values 52, 3, 8, 20, 21, 25, 316 is 20. Show that an operator that computes the
median of a subimage area, S, is nonlinear.
2.20 Prove the validity of Eqs. (2.6-6) and (2.6-7). [Hint: Start with Eq. (2.6-4) and use
the fact that the expected value of a sum is the sum of the expected values.]
2.21 Consider two 8-bit images whose intensity levels span the full range from 0 to 255.
(a) Discuss the limiting effect of repeatedly subtracting image (2) from image
(1). Assume that the result is represented also in eight bits.
(b) Would reversing the order of the images yield a different result?
2.22 Image subtraction is used often in industrial applications for detecting missing
components in product assembly. The approach is to store a “golden” image that
corresponds to a correct assembly; this image is then subtracted from incoming
images of the same product. Ideally, the differences would be zero if the new prod-
ucts are assembled correctly. Difference images for products with missing compo-
nents would be nonzero in the area where they differ from the golden image.
What conditions do you think have to be met in practice for this method to work?
2.23 (a) With reference to Fig. 2.31, sketch the set (A ¨ B) ´ (A ´ B)c.
(b) Give expressions for the sets shown shaded in the following figure in terms
of sets A, B, and C. The shaded areas in each figure constitute one set, so
give one expression for each of the three figures.
B C
2.24 What would be the equations analogous to Eqs. (2.6-24) and (2.6-25) that would
result from using triangular instead of quadrilateral regions?
2.25 Prove that the Fourier kernels in Eqs. (2.6-34) and (2.6-35) are separable and
symmetric.
2.26 Show that 2-D transforms with separable, symmetric kernels can be computed
by (1) computing 1-D transforms along the individual rows (columns) of the
input, followed by (2) computing 1-D transforms along the columns (rows) of
the result from step (1).
■ Problems 103
2.27 A plant produces a line of translucent miniature polymer squares. Stringent qual-
ity requirements dictate 100% visual inspection, and the plant manager finds the
use of human inspectors increasingly expensive. Inspection is semiautomated. At
each inspection station, a robotic mechanism places each polymer square over a
light located under an optical system that produces a magnified image of the
square. The image completely fills a viewing screen measuring 80 * 80 mm. De-
fects appear as dark circular blobs, and the inspector’s job is to look at the screen
and reject any sample that has one or more such dark blobs with a diameter of
0.8 mm or larger, as measured on the scale of the screen. The manager believes
that if she can find a way to automate the process completely, she will increase
profits by 50%. She also believes that success in this project will aid her climb up
the corporate ladder. After much investigation, the manager decides that the way
to solve the problem is to view each inspection screen with a CCD TV camera
and feed the output of the camera into an image processing system capable of de-
tecting the blobs, measuring their diameter, and activating the accept/reject but-
tons previously operated by an inspector. She is able to find a system that can do
the job, as long as the smallest defect occupies an area of at least 2 * 2 pixels in
the digital image. The manager hires you to help her specify the camera and lens
system, but requires that you use off-the-shelf components. For the lenses, as-
sume that this constraint means any integer multiple of 25 mm or 35 mm, up to
200 mm. For the cameras, it means resolutions of 512 * 512, 1024 * 1024, or
2048 * 2048 pixels. The individual imaging elements in these cameras are
squares measuring 8 * 8 m, and the spaces between imaging elements are
2 m. For this application, the cameras cost much more than the lenses, so the
problem should be solved with the lowest-resolution camera possible, based on
the choice of lenses. As a consultant, you are to provide a written recommenda-
tion, showing in reasonable detail the analysis that led to your conclusion. Use
the same imaging geometry suggested in Problem 2.5.