After CT DIP-417-547-1-67
After CT DIP-417-547-1-67
It is only after years of preparation that the young artist should touch
color—not color used descriptively, that is, but as a means of
personal expression. Henri Matisse
Preview
The use of color in image processing is motivated by two principal factors.
First, color is a powerful descriptor that often simplifies object identification
and extraction from a scene. Second, humans can discern thousands of color
shades and intensities, compared to about only two dozen shades of gray. This
second factor is particularly important in manual (i.e., when performed by hu-
mans) image analysis.
Color image processing is divided into two major areas: full-color and
pseudocolor processing. In the first category, the images in question typically
are acquired with a full-color sensor, such as a color TV camera or color scan-
ner. In the second category, the problem is one of assigning a color to a partic-
ular monochrome intensity or range of intensities. Until relatively recently,
most digital color image processing was done at the pseudocolor level. How-
ever, in the past decade, color sensors and hardware for processing color im-
ages have become available at reasonable prices. The result is that full-color
image processing techniques are now used in a broad range of applications, in-
cluding publishing, visualization, and the Internet.
It will become evident in the discussions that follow that some of the gray-scale
methods covered in previous chapters are directly applicable to color images.
394
6.1 ■ Color Fundamentals 395
FIGURE 6.2 Wavelengths comprising the visible range of the electromagnetic spectrum.
(Courtesy of the General Electric Co., Lamp Business Division.)
396 Chapter 6 ■ Color Image Processing
Purplish blue
Blue
Blue green
Green
Yellowish green
Yellow
Orange
Reddish orange
Red
6.1 ■ Color Fundamentals 397
human eye, colors are seen as variable combinations of the so-called primary
colors red (R), green (G), and blue (B). For the purpose of standardization, the
CIE (Commission Internationale de l’Eclairage—the International Commis-
sion on Illumination) designated in 1931 the following specific wavelength val-
ues to the three primary colors: blue = 435.8 nm, green = 546.1 nm, and
red = 700 nm. This standard was set before the detailed experimental curves
shown in Fig. 6.3 became available in 1965. Thus, the CIE standards correspond
only approximately with experimental data. We note from Figs. 6.2 and 6.3 that
no single color may be called red, green, or blue. Also, it is important to keep in
mind that having three specific primary color wavelengths for the purpose of
standardization does not mean that these three fixed RGB components acting
alone can generate all spectrum colors. Use of the word primary has been widely
misinterpreted to mean that the three standard primaries, when mixed in vari-
ous intensity proportions, can produce all visible colors. As you will see shortly,
this interpretation is not correct unless the wavelength also is allowed to vary,
in which case we would no longer have three fixed, standard primary colors.
The primary colors can be added to produce the secondary colors of light—
magenta (red plus blue), cyan (green plus blue), and yellow (red plus green).
Mixing the three primaries, or a secondary with its opposite primary color, in
the right intensities produces white light. This result is shown in Fig. 6.4(a),
which also illustrates the three primary colors and their combinations to pro-
duce the secondary colors.
a
MIXTURES OF LIGHT b
(Additive primaries)
GREEN FIGURE 6.4
Primary and
secondary colors
YELLOW CYAN of light and
WHITE pigments.
(Courtesy of the
RED BLUE General Electric
MAGENTA
Co., Lamp
Business
Division.)
MIXTURES OF PIGMENTS
(Subtractive primaries)
YELLOW
RED GREEN
BLACK
MAGENTA CYAN
BLUE
Differentiating between the primary colors of light and the primary colors
of pigments or colorants is important. In the latter, a primary color is defined
as one that subtracts or absorbs a primary color of light and reflects or trans-
mits the other two. Therefore, the primary colors of pigments are magenta,
cyan, and yellow, and the secondary colors are red, green, and blue. These col-
ors are shown in Fig. 6.4(b). A proper combination of the three pigment pri-
maries, or a secondary with its opposite primary, produces black.
Color television reception is an example of the additive nature of light col-
ors. The interior of CRT (cathode ray tube) color TV screens is composed of a
large array of triangular dot patterns of electron-sensitive phosphor. When ex-
cited, each dot in a triad produces light in one of the primary colors. The inten-
sity of the red-emitting phosphor dots is modulated by an electron gun inside
the tube, which generates pulses corresponding to the “red energy” seen by
the TV camera. The green and blue phosphor dots in each triad are modulated
in the same manner. The effect, viewed on the television receiver, is that the
three primary colors from each phosphor triad are “added” together and re-
ceived by the color-sensitive cones in the eye as a full-color image. Thirty suc-
cessive image changes per second in all three colors complete the illusion of a
continuous image display on the screen.
CRT displays are being replaced by “flat panel” digital technologies, such as
liquid crystal displays (LCDs) and plasma devices. Although they are funda-
mentally different from CRTs, these and similar technologies use the same
principle in the sense that they all require three subpixels (red, green, and
blue) to generate a single color pixel. LCDs use properties of polarized light to
block or pass light through the LCD screen and, in the case of active matrix
display technology, thin film transistors (TFTs) are used to provide the proper
signals to address each pixel on the screen. Light filters are used to produce
the three primary colors of light at each pixel triad location. In plasma units,
pixels are tiny gas cells coated with phosphor to produce one of the three pri-
mary colors. The individual cells are addressed in a manner analogous to
LCDs. This individual pixel triad coordinate addressing capability is the foun-
dation of digital displays.
The characteristics generally used to distinguish one color from another are
brightness, hue, and saturation. As indicated earlier in this section, brightness
embodies the achromatic notion of intensity. Hue is an attribute associated
with the dominant wavelength in a mixture of light waves. Hue represents
dominant color as perceived by an observer. Thus, when we call an object red,
orange, or yellow, we are referring to its hue. Saturation refers to the relative
purity or the amount of white light mixed with a hue. The pure spectrum colors
are fully saturated. Colors such as pink (red and white) and lavender (violet
and white) are less saturated, with the degree of saturation being inversely
proportional to the amount of white light added.
Hue and saturation taken together are called chromaticity, and, therefore, a
color may be characterized by its brightness and chromaticity. The amounts of
red, green, and blue needed to form any particular color are called the
6.1 ■ Color Fundamentals 399
†
The use of x, y, z in this context follows notational convention. These should not be confused with the
use of (x, y) to denote spatial coordinates in other sections of the book.
400 Chapter 6 ■ Color Image Processing
FIGURE 6.5
Chromaticity
diagram.
(Courtesy of the
General Electric
Co., Lamp
Business
Division.)
energy to any point on the boundary of the chart will define all the shades of
that particular spectrum color.
Extension of this procedure to three colors is straightforward. To determine
the range of colors that can be obtained from any three given colors in the
chromaticity diagram, we simply draw connecting lines to each of the three
color points. The result is a triangle, and any color on the boundary or inside
the triangle can be produced by various combinations of the three initial col-
ors. A triangle with vertices at any three fixed colors cannot enclose the entire
color region in Fig. 6.5. This observation supports graphically the remark made
earlier that not all colors can be obtained with three single, fixed primaries.
The triangle in Figure 6.6 shows a typical range of colors (called the color
gamut) produced by RGB monitors. The irregular region inside the triangle
is representative of the color gamut of today’s high-quality color printing
6.2 ■ Color Models 401
.9 FIGURE 6.6
Typical color
520 gamut of color
monitors
.8 530
(triangle) and
color printing
510 540
G
devices (irregular
.7
region).
550
560
.6
570
500
.5
580
y-axis
590
.4
600
610
R 620
.3 490
640
780
.2
480
.1
470
460
B
450 380
0
0 .1 .2 .3 .4 .5 .6 .7 .8
x-axis
devices. The boundary of the color printing gamut is irregular because color
printing is a combination of additive and subtractive color mixing, a process
that is much more difficult to control than that of displaying colors on a
monitor, which is based on the addition of three highly controllable light
primaries.
FIGURE 6.7 B
Schematic of the
RGB color cube.
Points along the
main diagonal (0, 0, 1)
Blue Cyan
have gray values,
from black at the
origin to white at Magenta
White
point (1, 1, 1).
(1, 0, 0)
Red Yellow
R
6.2 ■ Color Models 403
■ The cube shown in Fig. 6.8 is a solid, composed of the (28)3 = 16,777,216 EXAMPLE 6.1:
colors mentioned in the preceding paragraph. A convenient way to view these Generating the
hidden face
colors is to generate color planes (faces or cross sections of the cube). This is planes and a cross
accomplished simply by fixing one of the three colors and allowing the other section of the
two to vary. For instance, a cross-sectional plane through the center of the cube RGB color cube.
and parallel to the GB-plane in Fig. 6.8 is the plane (127, G, B) for
G, B = 0, 1, 2, Á , 255. Here we used the actual pixel values rather than the
mathematically convenient normalized values in the range [0, 1] because the
former values are the ones actually used in a computer to generate colors.
Figure 6.9(a) shows that an image of the cross-sectional plane is viewed simply
by feeding the three individual component images into a color monitor. In the
component images, 0 represents black and 255 represents white (note that
these are gray-scale images). Finally, Fig. 6.9(b) shows the three hidden surface
planes of the cube in Fig. 6.8, generated in the same manner.
It is of interest to note that acquiring a color image is basically the process
shown in Fig. 6.9 in reverse. A color image can be acquired by using three fil-
ters, sensitive to red, green, and blue, respectively. When we view a color scene
with a monochrome camera equipped with one of these filters, the result is a
monochrome image whose intensity is proportional to the response of that fil-
ter. Repeating this process with each filter produces three monochrome im-
ages that are the RGB component images of the color scene. (In practice,
RGB color image sensors usually integrate this process into a single device.)
Clearly, displaying these three RGB component images in the form shown in
Fig. 6.9(a) would yield an RGB color rendition of the original color scene. ■
404 Chapter 6 ■ Color Image Processing
a
b
FIGURE 6.9 Red
(a) Generating
the RGB image of
the cross-sectional
color plane (127,
G, B). (b) The
three hidden
Green RGB
surface planes in Color
the color cube of monitor
Fig. 6.8.
Blue
(R 0) (G 0) (B 0)
TABLE 6.1
Number System Color Equivalents
Valid values of
Hex 00 33 66 99 CC FF each RGB
Decimal 0 51 102 153 204 255 component in a
safe color.
Each of the 216 safe colors is formed from three RGB values as before, but
each value can only be 0, 51, 102, 153, 204, or 255. Thus, RGB triplets of these
values give us (6)3 = 216 possible values (note that all values are divisible by
3). It is customary to express these values in the hexagonal number system, as
shown in Table 6.1. Recall that hex numbers 0, 1, 2, Á , 9, A, B, C, D, E, F
correspond to decimal numbers 0, 1, 2, Á , 9, 10, 11, 12, 13, 14, 15. Recall
also that (0)16 = (0000)2 and (F)16 = (1111)2. Thus, for example,
(FF)16 = (255)10 = (11111111)2 and we see that a grouping of two hex num-
bers forms an 8-bit byte.
Since it takes three numbers to form an RGB color, each safe color is
formed from three of the two digit hex numbers in Table 6.1. For example, the
purest red is FF0000. The values 000000 and FFFFFF represent black and
white, respectively. Keep in mind that the same result is obtained by using the
more familiar decimal notation. For instance, the brightest red in decimal no-
tation has R = 255 (FF) and G = B = 0.
Figure 6.10(a) shows the 216 safe colors, organized in descending RGB val-
ues. The square in the top left array has value FFFFFF (white), the second
square to its right has value FFFFCC, the third square has value FFFF99, and
a
b
FIGURE 6.10
(a) The 216 safe
RGB colors.
(b) All the grays
in the 256-color
RGB system
(grays that are
part of the safe
color group are
shown
underlined).
AAAAAA
DDDDDD
BBBBBB
CCCCCC
EEEEEE
FFFFFF
000000
111111
222222
333333
444444
555555
666666
777777
888888
999999
406 Chapter 6 ■ Color Image Processing
so on for the first row. The second row of that same array has values FFCCFF,
FFCCCC, FFCC99, and so on. The final square of that array has value FF0000
(the brightest possible red). The second array to the right of the one just ex-
amined starts with value CCFFFF and proceeds in the same manner, as do the
other remaining four arrays. The final (bottom right) square of the last array
has value 000000 (black). It is important to note that not all possible 8-bit gray
colors are included in the 216 safe colors. Figure 6.10(b) shows the hex codes
for all the possible gray colors in a 256-color RGB system. Some of these val-
ues are outside of the safe color set but are represented properly (in terms of
their relative intensities) by most display systems. The grays from the safe
color group, (KKKKKK)16, for K = 0, 3, 6, 9, C, F, are shown underlined in
Fig. 6.10(b).
Figure 6.11 shows the RGB safe-color cube. Unlike the full-color cube in
Fig. 6.8, which is solid, the cube in Fig. 6.11 has valid colors only on the sur-
face planes. As shown in Fig. 6.10(a), each plane has a total of 36 colors, so
the entire surface of the safe-color cube is covered by 216 different colors, as
expected.
C 1 R
CMS = C1S - CGS (6.2-1)
Y 1 B
where, again, the assumption is that all color values have been normalized to
the range [0, 1]. Equation (6.2-1) demonstrates that light reflected from a
FIGURE 6.11
The RGB safe-
color cube.
6.2 ■ Color Models 407
surface coated with pure cyan does not contain red (that is, C = 1 - R in the
equation). Similarly, pure magenta does not reflect green, and pure yellow
does not reflect blue. Equation (6.2-1) also reveals that RGB values can be
obtained easily from a set of CMY values by subtracting the individual CMY
values from 1. As indicated earlier, in image processing this color model is
used in connection with generating hardcopy output, so the inverse opera-
tion from CMY to RGB generally is of little practical interest.
According to Fig. 6.4, equal amounts of the pigment primaries, cyan, ma-
genta, and yellow should produce black. In practice, combining these colors
for printing produces a muddy-looking black. So, in order to produce true
black (which is the predominant color in printing), a fourth color, black, is
added, giving rise to the CMYK color model. Thus, when publishers talk about
“four-color printing,” they are referring to the three colors of the CMY color
model plus black.
a b
FIGURE 6.12 White White
Conceptual
relationships
between the RGB
and HSI color Magenta Magenta
models. Cyan Yellow Cyan Yellow
Black Black
6.2 ■ Color Models 409
The key point to keep in mind regarding the cube arrangement in Fig. 6.12
and its corresponding HSI color space is that the HSI space is represented by a
vertical intensity axis and the locus of color points that lie on planes
perpendicular to this axis. As the planes move up and down the intensity axis,
the boundaries defined by the intersection of each plane with the faces of the
cube have either a triangular or hexagonal shape. This can be visualized much
more readily by looking at the cube down its gray-scale axis, as shown in
Fig. 6.13(a). In this plane we see that the primary colors are separated by 120°.
The secondary colors are 60° from the primaries, which means that the angle
between secondaries also is 120°. Figure 6.13(b) shows the same hexagonal
shape and an arbitrary color point (shown as a dot). The hue of the point is de-
termined by an angle from some reference point. Usually (but not always) an
angle of 0° from the red axis designates 0 hue, and the hue increases counter-
clockwise from there. The saturation (distance from the vertical axis) is the
length of the vector from the origin to the point. Note that the origin is defined
by the intersection of the color plane with the vertical intensity axis. The impor-
tant components of the HSI color space are the vertical intensity axis, the
length of the vector to a color point, and the angle this vector makes with the
red axis. Therefore, it is not unusual to see the HSI planes defined is terms of
the hexagon just discussed, a triangle, or even a circle, as Figs. 6.13(c) and (d)
show. The shape chosen does not matter because any one of these shapes can
be warped into one of the other two by a geometric transformation. Figure 6.14
shows the HSI model based on color triangles and also on circles.
Green Yellow
Blue Magenta
Green Yellow Green Yellow
Green
S S
H H
Cyan Red Cyan S Yellow Cyan Red
H
a
b c d
FIGURE 6.13 Hue and saturation in the HSI color model. The dot is an arbitrary color
point. The angle from the red axis gives the hue, and the length of the vector is the
saturation. The intensity of all colors in any of these planes is given by the position of
the plane on the vertical intensity axis.
410 Chapter 6 ■ Color Image Processing
a White
b
FIGURE 6.14 The I 0.75
HSI color model
based on
(a) triangular and I
(b) circular color
planes. The Green
triangles and Cyan Yellow
circles are H
perpendicular to S
I 0.5 Blue Red
the vertical Magenta
intensity axis.
Black
White
I 0.75
Green Yellow
I 0.5 Cyan H
S Red
Blue Magenta
Black
with†
1
2 [(R - G) + (R - B)]
u = cos b -1
r
[(R - G) + (R - B)(G - B)]1>2
2
Given values of HSI in the interval [0, 1], we now want to find the correspond-
ing RGB values in the same range. The applicable equations depend on the
values of H. There are three sectors of interest, corresponding to the 120° in-
tervals in the separation of primaries (see Fig. 6.13). We begin by multiplying
H by 360°, which returns the hue to its original range of [0°, 360°].
d
S cos H
R = Ic1 + (6.2-6)
cos(60° - H)
and
G = 3I - (R + B) (6.2-7)
†
It is good practice to add a small number in the denominator of this expression to avoid dividing by 0
when R = G = B, in which case u will be 90°. Note that when all RGB components are equal, Eq. (6.2-3)
gives S = 0. In addition, the conversion from HSI back to RGB in Eqs. (6.2-5) through (6.2-7) will give
R = G = B = I, as expected, because when R = G = B, we are dealing with a gray-scale image.
412 Chapter 6 ■ Color Image Processing
d
S cos H
G = Ic1 + (6.2-10)
cos(60° - H)
and
B = 3I - (R + G) (6.2-11)
d
S cos H
B = Ic1 + (6.2-14)
cos(60° - H)
and
R = 3I - (G + B) (6.2-15)
Uses of these equations for image processing are discussed in several of the
following sections.
EXAMPLE 6.2: ■ Figure 6.15 shows the hue, saturation, and intensity images for the RGB
The HSI values values shown in Fig. 6.8. Figure 6.15(a) is the hue image. Its most distinguishing
corresponding to feature is the discontinuity in value along a 45° line in the front (red) plane of
the image of the
RGB color cube. the cube. To understand the reason for this discontinuity, refer to Fig. 6.8, draw
a line from the red to the white vertices of the cube, and select a point in the
middle of this line. Starting at that point, draw a path to the right, following the
cube around until you return to the starting point. The major colors encoun-
tered in this path are yellow, green, cyan, blue, magenta, and back to red. Ac-
cording to Fig. 6.13, the values of hue along this path should increase from 0°
a b c
FIGURE 6.15 HSI components of the image in Fig. 6.8. (a) Hue, (b) saturation, and (c) intensity images.
6.2 ■ Color Models 413
to 360° (i.e., from the lowest to highest possible values of hue). This is precise-
ly what Fig. 6.15(a) shows because the lowest value is represented as black and
the highest value as white in the gray scale. In fact, the hue image was original-
ly normalized to the range [0, 1] and then scaled to 8 bits; that is, it was con-
verted to the range [0, 255], for display.
The saturation image in Fig. 6.15(b) shows progressively darker values to-
ward the white vertex of the RGB cube, indicating that colors become less and
less saturated as they approach white. Finally, every pixel in the intensity
image shown in Fig. 6.15(c) is the average of the RGB values at the corre-
sponding pixel in Fig. 6.8. ■
a b
c d
FIGURE 6.16
(a) RGB image
and the com-
ponents of its
corresponding
HSI image:
(b) hue,
(c) saturation, and
(d) intensity.
414 Chapter 6 ■ Color Image Processing
a b
c d
FIGURE 6.17
(a)–(c) Modified
HSI component
images.
(d) Resulting
RGB image. (See
Fig. 6.16 for the
original HSI
images.)
To change the individual color of any region in the RGB image, we change
the values of the corresponding region in the hue image of Fig. 6.16(b). Then
we convert the new H image, along with the unchanged S and I images, back to
RGB using the procedure explained in connection with Eqs. (6.2-5) through
(6.2-15). To change the saturation (purity) of the color in any region, we follow
the same procedure, except that we make the changes in the saturation image
in HSI space. Similar comments apply to changing the average intensity of any
region. Of course, these changes can be made simultaneously. For example, the
image in Fig. 6.17(a) was obtained by changing to 0 the pixels corresponding to
the blue and green regions in Fig. 6.16(b). In Fig. 6.17(b) we reduced by half
the saturation of the cyan region in component image S from Fig. 6.16(c). In
Fig. 6.17(c) we reduced by half the intensity of the central white region in the
intensity image of Fig. 6.16(d). The result of converting this modified HSI
image back to RGB is shown in Fig. 6.17(d). As expected, we see in this figure
that the outer portions of all circles are now red; the purity of the cyan region
was diminished, and the central region became gray rather than white. Al-
though these results are simple, they illustrate clearly the power of the HSI
color model in allowing independent control over hue, saturation, and intensi-
ty, quantities with which we are quite familiar when describing colors.
from the processes associated with true color images, a topic discussed starting
in Section 6.4. The principal use of pseudocolor is for human visualization and
interpretation of gray-scale events in an image or sequence of images. As noted
at the beginning of this chapter, one of the principal motivations for using color
is the fact that humans can discern thousands of color shades and intensities,
compared to only two dozen or so shades of gray.
(Black) 0 y
x
416 Chapter 6 ■ Color Image Processing
FIGURE 6.19 An
alternative
representation of c2
the intensity-
slicing technique.
Color
c1
0 li L1
Intensity levels
where ck is the color associated with the kth intensity interval Vk defined by
the partitioning planes at l = k - 1 and l = k.
The idea of planes is useful primarily for a geometric interpretation of the
intensity-slicing technique. Figure 6.19 shows an alternative representation
that defines the same mapping as in Fig. 6.18. According to the mapping func-
tion shown in Fig. 6.19, any input intensity level is assigned one of two colors,
depending on whether it is above or below the value of li. When more levels
are used, the mapping function takes on a staircase form.
EXAMPLE 6.3: ■ A simple, but practical, use of intensity slicing is shown in Fig. 6.20. Figure
Intensity slicing. 6.20(a) is a monochrome image of the Picker Thyroid Phantom (a radiation
test pattern), and Fig. 6.20(b) is the result of intensity slicing this image into
eight color regions. Regions that appear of constant intensity in the mono-
chrome image are really quite variable, as shown by the various colors in the
sliced image. The left lobe, for instance, is a dull gray in the monochrome
image, and picking out variations in intensity is difficult. By contrast, the color
image clearly shows eight different regions of constant intensity, one for each
of the colors used. ■
a b
FIGURE 6.20
(a) Monochrome
image of the Picker
Thyroid Phantom.
(b) Result of
density slicing into
eight colors.
(Courtesy of Dr.
J. L. Blankenship,
Instrumentation
and Controls
Division, Oak
Ridge National
Laboratory.)
6.3 ■ Pseudocolor Image Processing 417
In the preceding simple example, the gray scale was divided into intervals and
a different color was assigned to each region, without regard for the meaning of
the gray levels in the image. Interest in that case was simply to view the different
gray levels constituting the image. Intensity slicing assumes a much more mean-
ingful and useful role when subdivision of the gray scale is based on physical
characteristics of the image. For instance, Fig. 6.21(a) shows an X-ray image of a
weld (the horizontal dark region) containing several cracks and porosities (the
bright, white streaks running horizontally through the middle of the image). It
is known that when there is a porosity or crack in a weld, the full strength of the
X-rays going through the object saturates the imaging sensor on the other side of
the object.Thus, intensity values of 255 in an 8-bit image coming from such a sys-
tem automatically imply a problem with the weld. If a human were to be the ulti-
mate judge of the analysis, and manual processes were employed to inspect welds
(still a common procedure today), a simple color coding that assigns one color to
a
b
FIGURE 6.21
(a) Monochrome
X-ray image of a
weld. (b) Result
of color coding.
(Original image
courtesy of
X-TEK Systems,
Ltd.)
418 Chapter 6 ■ Color Image Processing
level 255 and another to all other intensity levels would simplify the inspector’s
job considerably. Figure 6.21(b) shows the result. No explanation is required to
arrive at the conclusion that human error rates would be lower if images were
displayed in the form of Fig. 6.21(b), instead of the form shown in Fig. 6.21(a). In
other words, if the exact intensity value or range of values one is looking for is
known, intensity slicing is a simple but powerful aid in visualization, especially if
numerous images are involved. The following is a more complex example.
EXAMPLE 6.4: ■ Measurement of rainfall levels, especially in the tropical regions of the
Use of color to Earth, is of interest in diverse applications dealing with the environment. Accu-
highlight rainfall rate measurements using ground-based sensors are difficult and expensive to
levels.
acquire, and total rainfall figures are even more difficult to obtain because a
significant portion of precipitation occurs over the ocean. One approach for ob-
taining rainfall figures is to use a satellite. The TRMM (Tropical Rainfall Mea-
suring Mission) satellite utilizes, among others, three sensors specially designed
to detect rain: a precipitation radar, a microwave imager, and a visible and in-
frared scanner (see Sections 1.3 and 2.3 regarding image sensing modalities).
The results from the various rain sensors are processed, resulting in esti-
mates of average rainfall over a given time period in the area monitored by the
sensors. From these estimates, it is not difficult to generate gray-scale images
whose intensity values correspond directly to rainfall, with each pixel repre-
senting a physical land area whose size depends on the resolution of the sen-
sors. Such an intensity image is shown in Fig. 6.22(a), where the area monitored
by the satellite is the slightly lighter horizontal band in the middle one-third of
the picture (these are the tropical regions). In this particular example, the rain-
fall values are average monthly values (in inches) over a three-year period.
Visual examination of this picture for rainfall patterns is quite difficult, if
not impossible. However, suppose that we code intensity levels from 0 to 255
using the colors shown in Fig. 6.22(b). Values toward the blues signify low val-
ues of rainfall, with the opposite being true for red. Note that the scale tops out
at pure red for values of rainfall greater than 20 inches. Figure 6.22(c) shows
the result of color coding the gray image with the color map just discussed. The
results are much easier to interpret, as shown in this figure and in the zoomed
area of Fig. 6.22(d). In addition to providing global coverage, this type of data
allows meteorologists to calibrate ground-based rain monitoring systems with
greater precision than ever before. ■
a b
c d
FIGURE 6.22 (a) Gray-scale image in which intensity (in the lighter horizontal band shown) corresponds to
average monthly rainfall. (b) Colors assigned to intensity values. (c) Color-coded image. (d) Zoom of the
South American region. (Courtesy of NASA.)
FIGURE 6.23
Red Functional block
fR (x, y)
transformation diagram for
pseudocolor
image processing.
fR, fG, and fB are
Green fed into the
f(x, y) fG (x, y) corresponding
transformation
red, green, and
blue inputs of an
RGB color
monitor.
Blue
fB (x, y)
transformation
420 Chapter 6 ■ Color Image Processing
EXAMPLE 6.5: ■ Figure 6.24(a) shows two monochrome images of luggage obtained from an
Use of airport X-ray scanning system. The image on the left contains ordinary articles.
pseudocolor for The image on the right contains the same articles, as well as a block of simulated
highlighting
explosives plastic explosives. The purpose of this example is to illustrate the use of intensi-
contained in ty level to color transformations to obtain various degrees of enhancement.
luggage. Figure 6.25 shows the transformation functions used. These sinusoidal func-
tions contain regions of relatively constant value around the peaks as well as
regions that change rapidly near the valleys. Changing the phase and frequen-
cy of each sinusoid can emphasize (in color) ranges in the gray scale. For in-
stance, if all three transformations have the same phase and frequency, the
output image will be monochrome. A small change in the phase between the
three transformations produces little change in pixels whose intensities corre-
spond to peaks in the sinusoids, especially if the sinusoids have broad profiles
(low frequencies). Pixels with intensity values in the steep section of the sinu-
soids are assigned a much stronger color content as a result of significant dif-
ferences between the amplitudes of the three sinusoids caused by the phase
displacement between them.
a
b c
FIGURE 6.24
Pseudocolor
enhancement by
using the gray
level to color
transformations in
Fig. 6.25.
(Original image
courtesy of
Dr. Mike Hurwitz,
Westinghouse.)
6.3 ■ Pseudocolor Image Processing 421
a
L1 b
FIGURE 6.25
Red Transformation
functions used to
obtain the images
L1 in Fig. 6.24.
Green
L1
Blue
Intensity
0 L1
Explosive Garment Background
bag
L1
Red
L1
Green
L1
Blue
Intensity
0 L1
Explosive Garment Background
bag
The image shown in Fig. 6.24(b) was obtained with the transformation
functions in Fig. 6.25(a), which shows the gray-level bands corresponding to
the explosive, garment bag, and background, respectively. Note that the ex-
plosive and background have quite different intensity levels, but they were
both coded with approximately the same color as a result of the periodicity of
the sine waves. The image shown in Fig. 6.24(c) was obtained with the trans-
formation functions in Fig. 6.25(b). In this case the explosives and garment
bag intensity bands were mapped by similar transformations and thus re-
ceived essentially the same color assignments. Note that this mapping allows
an observer to “see” through the explosives. The background mappings were
about the same as those used for Fig. 6.24(b), producing almost identical color
assignments. ■
422 Chapter 6 ■ Color Image Processing
g K (x, y)
f K (x, y) Transformation TK hB (x, y)
EXAMPLE 6.6: ■ Figures 6.27(a) through (d) show four spectral satellite images of Washing-
Color coding of ton, D.C., including part of the Potomac River. The first three images are in the
multispectral visible red, green, and blue, and the fourth is in the near infrared (see Table 1.1
images.
and Fig. 1.10). Figure 6.27(e) is the full-color image obtained by combining the
first three images into an RGB image. Full-color images of dense areas are dif-
ficult to interpret, but one notable feature of this image is the difference in
color in various parts of the Potomac River. Figure 6.27(f) is a little more in-
teresting.This image was formed by replacing the red component of Fig. 6.27(e)
with the near-infrared image. From Table 1.1, we know that this band is strong-
ly responsive to the biomass components of a scene. Figure 6.27(f) shows quite
clearly the difference between biomass (in red) and the human-made features
in the scene, composed primarily of concrete and asphalt, which appear bluish
in the image.
The type of processing just illustrated is quite powerful in helping visualize
events of interest in complex images, especially when those events are beyond
our normal sensing capabilities. Figure 6.28 is an excellent illustration of this.
These are images of the Jupiter moon Io, shown in pseudocolor by combining
several of the sensor images from the Galileo spacecraft, some of which are in
spectral regions not visible to the eye. However, by understanding the physical
and chemical processes likely to affect sensor response, it is possible to combine
the sensed images into a meaningful pseudocolor map. One way to combine the
sensed image data is by how they show either differences in surface chemical
composition or changes in the way the surface reflects sunlight. For example, in
the pseudocolor image in Fig. 6.28(b), bright red depicts material newly ejected
6.3 ■ Pseudocolor Image Processing 423
FIGURE 6.27 (a)–(d) Images in bands 1–4 in Fig. 1.10 (see Table 1.1). (e) Color a b
composite image obtained by treating (a), (b), and (c) as the red, green, blue com- c d
ponents of an RGB image. (f) Image obtained in the same manner, but using in the e f
red channel the near-infrared image in (d). (Original multispectral images courtesy
of NASA.)
424 Chapter 6 ■ Color Image Processing
a
b
FIGURE 6.28
(a) Pseudocolor
rendition of
Jupiter Moon Io.
(b) A close-up.
(Courtesy of
NASA.)
from an active volcano on Io, and the surrounding yellow materials are older
sulfur deposits. This image conveys these characteristics much more readily
than would be possible by analyzing the component images individually. ■
three components, color pixels are vectors. For example, in the RGB system,
each color point can be interpreted as a vector extending from the origin to
that point in the RGB coordinate system (see Fig. 6.7).
Let c represent an arbitrary vector in RGB color space:
cR R
c = C GS = CGS
c (6.4-1)
cB B
This equation indicates that the components of c are simply the RGB compo-
nents of a color image at a point. We take into account the fact that the color
components are a function of coordinates (x, y) by using the notation
cR (x, y) R(x, y)
c(x, y) = C cG (x, y) S = C G(x, y) S (6.4-2)
cB (x, y) B(x, y)
For an image of size M * N, there are MN such vectors, c(x, y), for
x = 0, 1, 2, Á , M - 1; y = 0, 1, 2, Á , N - 1.
It is important to keep in mind that Eq. (6.4-2) depicts a vector whose com-
ponents are spatial variables in x and y. This is a frequent source of confusion
that can be avoided by focusing on the fact that our interest lies in spatial
processes. That is, we are interested in image processing techniques formulat-
ed in x and y. The fact that the pixels are now color pixels introduces a factor
that, in its easiest formulation, allows us to process a color image by processing
each of its component images separately, using standard gray-scale image pro-
cessing methods. However, the results of individual color component process-
ing are not always equivalent to direct processing in color vector space, in
which case we must formulate new approaches.
In order for per-color-component and vector-based processing to be equiv-
alent, two conditions have to be satisfied: First, the process has to be applicable
to both vectors and scalars. Second, the operation on each component of a vec-
tor must be independent of the other components. As an illustration, Fig. 6.29
shows neighborhood spatial processing of gray-scale and full-color images.
a b
FIGURE 6.29
Spatial masks for
gray-scale and
RGB color
(x, y) images.
(x, y)
Spatial mask Spatial mask
6.5.1 Formulation
As with the intensity transformation techniques of Chapter 3, we model color
transformations using the expression
g(x, y) = T[f(x, y)] (6.5-1)
where f(x, y) is a color input image, g(x, y) is the transformed or processed
color output image, and T is an operator on f over a spatial neighborhood of
(x, y). The principal difference between this equation and Eq. (3.1-1) is in its
interpretation. The pixel values here are triplets or quartets (i.e., groups of
three or four values) from the color space chosen to represent the images, as il-
lustrated in Fig. 6.29(b).
Analogous to the approach we used to introduce the basic intensity trans-
formations in Section 3.2, we will restrict attention in this section to color
transformations of the form
si = Ti (r1, r2, Á , rn), i = 1, 2, Á , n (6.5-2)
where, for notational simplicity, ri and si are variables denoting the color com-
ponents of f(x, y) and g(x, y) at any point (x, y), n is the number of color com-
ponents, and 5T1, T2, Á , Tn6 is a set of transformation or color mapping
functions that operate on ri to produce si. Note that n transformations, Ti, com-
bine to implement the single transformation function, T, in Eq. (6.5-1). The
color space chosen to describe the pixels of f and g determines the value of n.
If the RGB color space is selected, for example, n = 3 and r1, r2, and r3 denote
the red, green, and blue components of the input image, respectively. If the
CMYK or HSI color spaces are chosen, n = 4 or n = 3.
6.5 ■ Color Transformations 427
Full color
of the initial CMYK scan. In these images, black represents 0 and white repre-
sents 1 in each CMYK color component. Thus, we see that the strawberries
are composed of large amounts of magenta and yellow because the images
corresponding to these two CMYK components are the brightest. Black is
used sparingly and is generally confined to the coffee and shadows within the
bowl of strawberries. When the CMYK image is converted to RGB, as shown
in the third row of the figure, the strawberries are seen to contain a large
amount of red and very little (although some) green and blue. The last row of
Fig. 6.30 shows the HSI components of the full-color image—computed using
Eqs. (6.2-2) through (6.2-4). As expected, the intensity component is a mono-
chrome rendition of the full-color original. In addition, the strawberries are
relatively pure in color; they possess the highest saturation or least dilution by
white light of any of the hues in the image. Finally, we note some difficulty in
interpreting the hue component. The problem is compounded by the fact
that (1) there is a discontinuity in the HSI model where 0° and 360° meet (see
Fig. 6.15), and (2) hue is undefined for a saturation of 0 (i.e., for white, black,
and pure grays). The discontinuity of the model is most apparent around the
strawberries, which are depicted in gray level values near both black (0) and
white (1). The result is an unexpected mixture of highly contrasting gray lev-
els to represent a single color—red.
Any of the color-space components in Fig. 6.30 can be used in conjunction
with Eq. (6.5-2). In theory, any transformation can be performed in any color
model. In practice, however, some operations are better suited to specific mod-
els. For a given transformation, the cost of converting between representations
must be factored into the decision regarding the color space in which to imple-
ment it. Suppose, for example, that we wish to modify the intensity of the full-
color image in Fig. 6.30 using
g(x, y) = kf(x, y) (6.5-3)
where 0 6 k 6 1. In the HSI color space, this can be done with the simple
transformation
s3 = kr3 (6.5-4)
where s1 = r1 and s2 = r2. Only HSI intensity component r3 is modified. In
the RGB color space, three components must be transformed:
si = kri i = 1, 2, 3 (6.5-5)
The CMY space requires a similar set of linear transformations:
si = kri + (1 - k) i = 1, 2, 3 (6.5-6)
Although the HSI transformation involves the fewest number of opera-
tions, the computations required to convert an RGB or CMY(K) image to the
HSI space more than offsets (in this case) the advantages of the simpler
transformation—the conversion calculations are more computationally in-
tense than the intensity transformation itself. Regardless of the color space
6.5 ■ Color Transformations 429
selected, however, the output is the same. Figure 6.31(b) shows the result of
applying any of the transformations in Eqs. (6.5-4) through (6.5-6) to the full-
color image of Fig. 6.30 using k = 0.7. The mapping functions themselves are
depicted graphically in Figs. 6.31(c) through (e).
It is important to note that each transformation defined in Eqs. (6.5-4)
through (6.5-6) depends only on one component within its color space. For
example, the red output component, s1, in Eq. (6.5-5) is independent of the
green (r2) and blue (r3) inputs; it depends only on the red (r1) input. Trans-
formations of this type are among the simplest and most used color process-
ing tools and can be carried out on a per-color-component basis, as
mentioned at the beginning of our discussion. In the remainder of this sec-
tion we examine several such transformations and discuss a case in which the
component transformation functions are dependent on all the color compo-
nents of the input image and, therefore, cannot be done on an individual
color-component basis.
1 1 1
k k
1k
R,G,B C,M,Y I H,S
0 1 0 1 0 1 0 1
a b
c d e
FIGURE 6.31 Adjusting the intensity of an image using color transformations.
(a) Original image. (b) Result of decreasing its intensity by 30% (i.e., letting k = 0.7).
(c)–(e) The required RGB, CMY, and HSI transformation functions. (Original image
courtesy of MedData Interactive.)
430 Chapter 6 ■ Color Image Processing
Cyan ents
plem Red
Com
Green Yellow
EXAMPLE 6.7: ■ Figures 6.33(a) and (c) show the full-color image from Fig. 6.30 and its color
Computing color complement. The RGB transformations used to compute the complement are
image plotted in Fig. 6.33(b). They are identical to the gray-scale negative transfor-
complements.
mation defined in Section 3.2.1. Note that the computed complement is remi-
niscent of conventional photographic color film negatives. Reds of the original
image are replaced by cyans in the complement. When the original image is
black, the complement is white, and so on. Each of the hues in the complement
image can be predicted from the original image using the color circle of
Fig. 6.32, and each of the RGB component transforms involved in the compu-
tation of the complement is a function of only the corresponding input color
component.
Unlike the intensity transformations of Fig. 6.31, the RGB complement
transformation functions used in this example do not have a straightforward
HSI space equivalent. It is left as an exercise for the reader (see Problem 6.18)
to show that the saturation component of the complement cannot be comput-
ed from the saturation component of the input image alone. Figure 6.33(d)
provides an approximation of the complement using the hue, saturation, and
intensity transformations given in Fig. 6.33(b). Note that the saturation com-
ponent of the input image is unaltered; it is responsible for the visual differ-
ences between Figs. 6.33(c) and (d). ■
†
The color circle originated with Sir Isaac Newton, who in the seventeenth century joined the ends of the
color spectrum to form the first color circle.
6.5 ■ Color Transformations 431
a b
1 1
c d
FIGURE 6.33
Color
complement
transformations.
R,G,B H (a) Original
0 1 0 1 image.
1 1 (b) Complement
transformation
functions.
(c) Complement
of (a) based on
the RGB mapping
S I functions. (d) An
0 1 0 1 approximation
of the RGB
complement
using HSI
transformations.
prototypical (e.g., average) color with components (a1, a2, Á , an), the neces-
sary set of transformations is
if c ƒ rj - a j ƒ 7 d
W
0.5
si = c 2 any 1 … j … n
i = 1, 2, Á , n (6.5-7)
ri otherwise
These transformations highlight the colors around the prototype by forcing all
other colors to the midpoint of the reference color space (an arbitrarily chosen
neutral point). For the RGB color space, for example, a suitable neutral point
is middle gray or color (0.5, 0.5, 0.5).
If a sphere is used to specify the colors of interest, Eq. (6.5-7) becomes
n
0.5 if a (rj - a j)2 7 R20
si = c j=1
i = 1, 2, Á , n (6.5-8)
ri otherwise
Here, R0 is the radius of the enclosing sphere (or hypersphere for n 7 3) and
(a1, a2, Á , an) are the components of its center (i.e., the prototypical color).
Other useful variations of Eqs. (6.5-7) and (6.5-8) include implementing multi-
ple color prototypes and reducing the intensity of the colors outside the region
of interest—rather than setting them to a neutral constant.
EXAMPLE 6.8: ■ Equations (6.5-7) and (6.5-8) can be used to separate the edible part of the
An illustration of strawberries in Fig. 6.31(a) from the background cups, bowl, coffee, and table.
color slicing.
Figures 6.34(a) and (b) show the results of applying both transformations. In
a b
FIGURE 6.34 Color-slicing transformations that detect (a) reds within an RGB cube of
width W = 0.2549 centered at (0.6863, 0.1608, 0.1922), and (b) reds within an RGB
sphere of radius 0.1765 centered at the same point. Pixels outside the cube and sphere
were replaced by color (0.5, 0.5, 0.5).
6.5 ■ Color Transformations 433
each case, a prototype red with RGB color coordinate (0.6863, 0.1608, 0.1922)
was selected from the most prominent strawberry; W and R0 were chosen so
that the highlighted region would not expand to undesirable portions of the
image. The actual values, W = 0.2549 and R0 = 0.1765, were determined in-
teractively. Note that the sphere-based transformation of Eq. (6.5-8) is slightly
better, in the sense that it includes more of the strawberries’ red areas. A
sphere of radius 0.1765 does not completely enclose a cube of width 0.2549 but
is itself not completely enclosed by the cube. ■
Y
L* = 116 # h ¢ ≤ - 16 (6.5-9)
YW
X Y
a* = 500 B h ¢ ≤ - h¢ ≤ R (6.5-10)
XW YW
Y Z
b* = 200 B h ¢ ≤ - h¢ ≤R (6.5-11)
YW ZW
434 Chapter 6 ■ Color Image Processing
where
23q q 7 0.008856
h(q) = b (6.5-12)
7.787q + 16>116 q … 0.008856
and XW, YW, and ZW are reference white tristimulus values—typically the
white of a perfectly reflecting diffuser under CIE standard D65 illumination
(defined by x = 0.3127 and y = 0.3290 in the CIE chromaticity diagram of
Fig. 6.5). The L * a * b* color space is colorimetric (i.e., colors perceived as
matching are encoded identically), perceptually uniform (i.e., color differences
among various hues are perceived uniformly—see the classic paper by
MacAdams [1942]), and device independent. While not a directly displayable
format (conversion to another color space is required), its gamut encompasses
the entire visible spectrum and can represent accurately the colors of any dis-
play, print, or input device. Like the HSI system, the L * a * b* system is an ex-
cellent decoupler of intensity (represented by lightness L*) and color
(represented by a* for red minus green and b* for green minus blue), making
it useful in both image manipulation (tone and contrast editing) and image
compression applications.†
The principal benefit of calibrated imaging systems is that they allow tonal
and color imbalances to be corrected interactively and independently—that is,
in two sequential operations. Before color irregularities, like over- and under-
saturated colors, are resolved, problems involving the image’s tonal range are
corrected. The tonal range of an image, also called its key type, refers to its gen-
eral distribution of color intensities. Most of the information in high-key im-
ages is concentrated at high (or light) intensities; the colors of low-key images
are located predominantly at low intensities; middle-key images lie in be-
tween. As in the monochrome case, it is often desirable to distribute the inten-
sities of a color image equally between the highlights and the shadows. The
following examples demonstrate a variety of color transformations for the cor-
rection of tonal and color imbalances.
EXAMPLE 6.9: ■ Transformations for modifying image tones normally are selected interac-
Tonal tively. The idea is to adjust experimentally the image’s brightness and con-
transformations.
trast to provide maximum detail over a suitable range of intensities. The
colors themselves are not changed. In the RGB and CMY(K) spaces, this
means mapping all three (or four) color components with the same transfor-
mation function; in the HSI color space, only the intensity component is
modified.
Figure 6.35 shows typical transformations used for correcting three com-
mon tonal imbalances—flat, light, and dark images. The S-shaped curve in the
†
Studies indicate that the degree to which the luminance (lightness) information is separated from the
color information in L * a * b* is greater than in other color models—such as CIELUV, YIQ, YUV,
YCC, and XYZ (Kasson and Plouffe [1992]).
6.5 ■ Color Transformations 435
R,G,B
Flat Corrected 0 1
R,G,B
Light Corrected 0 1
R,G,B
Dark Corrected 0 1
FIGURE 6.35 Tonal corrections for flat, light (high key), and dark (low key) color images. Adjusting the red,
green, and blue components equally does not always alter the image hues significantly.
436 Chapter 6 ■ Color Image Processing
first row of the figure is ideal for boosting contrast [see Fig. 3.2(a)]. Its mid-
point is anchored so that highlight and shadow areas can be lightened and
darkened, respectively. (The inverse of this curve can be used to correct ex-
cessive contrast.) The transformations in the second and third rows of the fig-
ure correct light and dark images and are reminiscent of the power-law
transformations in Fig. 3.6. Although the color components are discrete, as
are the actual transformation functions, the transformation functions them-
selves are displayed and manipulated as continuous quantities—typically
constructed from piecewise linear or higher order (for smoother mappings)
polynomials. Note that the keys of the images in Fig. 6.35 are directly observ-
able; they could also be determined using the histograms of the images’ color
components. ■
EXAMPLE 6.10: ■ After the tonal characteristics of an image have been properly established,
Color balancing. any color imbalances can be addressed. Although color imbalances can be de-
termined objectively by analyzing—with a color spectrometer—a known
color in an image, accurate visual assessments are possible when white areas,
where the RGB or CMY(K) components should be equal, are present. As can
be seen in Fig. 6.36, skin tones also are excellent subjects for visual color as-
sessments because humans are highly perceptive of proper skin color. Vivid
colors, such as bright red objects, are of little value when it comes to visual
color assessment.
When a color imbalance is noted, there are a variety of ways to correct
it. When adjusting the color components of an image, it is important to re-
alize that every action affects the overall color balance of the image. That
is, the perception of one color is affected by its surrounding colors. Never-
theless, the color wheel of Fig. 6.32 can be used to predict how one color
component will affect others. Based on the color wheel, for example, the
proportion of any color can be increased by decreasing the amount of the
opposite (or complementary) color in the image. Similarly, it can be in-
creased by raising the proportion of the two immediately adjacent colors
or decreasing the percentage of the two colors adjacent to the comple-
ment. Suppose, for instance, that there is an abundance of magenta in an
RGB image. It can be decreased by (1) removing both red and blue or (2) adding
green.
Figure 6.36 shows the transformations used to correct simple CMYK out-
put imbalances. Note that the transformations depicted are the functions re-
quired for correcting the images; the inverses of these functions were used
to generate the associated color imbalances. Together, the images are analo-
gous to a color ring-around print of a darkroom environment and are useful
as a reference tool for identifying color printing problems. Note, for exam-
ple, that too much red can be due to excessive magenta (per the bottom left
image) or too little cyan (as shown in the rightmost image of the second
row). ■
6.5 ■ Color Transformations 437
Original/Corrected
1 1 1 1
Heavy in Weak in Heavy in Weak in
black black cyan cyan
B B C C
0 1 0 1 0 1 0 1
1 1 1 1
Heavy in Weak in Heavy in Weak in
magenta magenta yellow yellow
M M Y Y
0 1 0 1 0 1 0 1
FIGURE 6.36 Color balancing corrections for CMYK color images.
438 Chapter 6 ■ Color Image Processing
a b 1 1
c d
FIGURE 6.37
Histogram
equalization
(followed by H S
saturation 0 1 0 1
adjustment) in the
Histogram before processing
HSI color space. 1 (median 0.36)
0.5
Histogram after processing
I (median 0.5)
0 0.36 1
6.6 ■ Smoothing and Sharpening 439
■ Figure 6.37(a) shows a color image of a caster stand containing cruets and EXAMPLE 6.11:
shakers whose intensity component spans the entire (normalized) range of Histogram
equalization in the
possible values, [0, 1]. As can be seen in the histogram of its intensity compo-
HSI color space.
nent prior to processing [Fig. 6.37(b)], the image contains a large number of
dark colors that reduce the median intensity to 0.36. Histogram equalizing the
intensity component, without altering the hue and saturation, resulted in the
image shown in Fig. 6.37(c). Note that the overall image is significantly
brighter and that several moldings and the grain of the wooden table on which
the caster is sitting are now visible. Figure 6.37(b) shows the intensity his-
togram of the new image, as well as the intensity transformation used to equal-
ize the intensity component [see Eq. (3.3-8)].
Although the intensity equalization process did not alter the values of hue
and saturation of the image, it did impact the overall color perception. Note, in
particular, the loss of vibrancy in the oil and vinegar in the cruets. Figure
6.37(d) shows the result of correcting this partially by increasing the image’s
saturation component, subsequent to histogram equalization, using the trans-
formation in Fig. 6.37(b). This type of adjustment is common when working
with the intensity component in HSI space because changes in intensity usual-
ly affect the relative appearance of colors in an image. ■
1
c (x, y) = a c(s, t)
K (s, t)HS
(6.6-1)
xy
440 Chapter 6 ■ Color Image Processing
It follows from Eq. (6.4-2) and the properties of vector addition that
1
K (s, a
R(s, t)
t)HSxy
1
c (x, y) = FK a G(s, t)V
Consult the book Web site
for a brief review of vec- (6.6-2)
tors and matrices. (s, t)HSxy
1
K (s, a
B(s, t)
t)HSxy
We recognize the components of this vector as the scalar images that would be
obtained by independently smoothing each plane of the starting RGB image
using conventional gray-scale neighborhood processing. Thus, we conclude
that smoothing by neighborhood averaging can be carried out on a per-color-
plane basis. The result is the same as when the averaging is performed using
RGB color vectors.
EXAMPLE 6.12: ■ Consider the RGB color image in Fig. 6.38(a). Its red, green, and blue com-
Color image ponent images are shown in Figs. 6.38(b) through (d). Figures 6.39(a) through
smoothing by
(c) show the HSI components of the image. Based on the discussion in the pre-
neighborhood
averaging. vious paragraph, we smoothed each component image of the RGB image in
Fig. 6.38 independently using a 5 * 5 spatial averaging mask. We then com-
bined the individually smoothed images to form the smoothed, full-color RGB
result shown in Fig. 6.40(a). Note that this image appears as we would expect
from performing a spatial smoothing operation, as in the examples given in
Section 3.5.
In Section 6.2, we noted that an important advantage of the HSI color
model is that it decouples intensity and color information. This makes it
suitable for many gray-scale processing techniques and suggests that it
might be more efficient to smooth only the intensity component of the HSI
representation in Fig. 6.39. To illustrate the merits and/or consequences of
this approach, we next smooth only the intensity component (leaving the
hue and saturation components unmodified) and convert the processed re-
sult to an RGB image for display. The smoothed color image is shown in
Fig. 6.40(b). Note that it is similar to Fig. 6.40(a), but, as you can see from
the difference image in Fig. 6.40(c), the two smoothed images are not iden-
tical. This is because in Fig. 6.40(a) the color of each pixel is the average
color of the pixels in the neighborhood. On the other hand, by smoothing
only the intensity component image in Fig. 6.40(b), the hue and saturation
of each pixel was not affected and, therefore, the pixel colors did not
change. It follows from this observation that the difference between the
two smoothing approaches would become more pronounced as a function
of increasing filter size. ■
6.6 ■ Smoothing and Sharpening 441
a b
c d
FIGURE 6.38
(a) RGB image.
(b) Red
component image.
(c) Green compo-
nent. (d) Blue
component.
a b c
FIGURE 6.39 HSI components of the RGB color image in Fig. 6.38(a). (a) Hue. (b) Saturation. (c) Intensity.
442 Chapter 6 ■ Color Image Processing
a b c
FIGURE 6.40 Image smoothing with a 5 * 5 averaging mask. (a) Result of processing each RGB
component image. (b) Result of processing the intensity component of the HSI image and converting to
RGB. (c) Difference between the two results.
§2R(x, y)
§2[c(x, y)] = C §2G(x, y) S (6.6-3)
§2B(x, y)
which, as in the previous section, tells us that we can compute the Laplacian of a
full-color image by computing the Laplacian of each component image separately.
a b c
FIGURE 6.41 Image sharpening with the Laplacian. (a) Result of processing each RGB channel. (b) Result of
processing the HSI intensity component and converting to RGB. (c) Difference between the two results.
6.7 ■ Image Segmentation Based on Color 443
■ Figure 6.41(a) was obtained using Eq. (3.6-7) and the mask in Fig. 3.37(c) to EXAMPLE 6.13:
compute the Laplacians of the RGB component images in Fig. 6.38. These re- Sharpening with
the Laplacian.
sults were combined to produce the sharpened full-color result. Figure 6.41(b)
shows a similarly sharpened image based on the HSI components in Fig. 6.39.
This result was generated by combining the Laplacian of the intensity compo-
nent with the unchanged hue and saturation components. The difference be-
tween the RGB and HSI sharpened images is shown in Fig. 6.41(c). The reason
for the discrepancies between the two images is as in Example 6.12. ■
■ Suppose that it is of interest to segment the reddish region in the lower left EXAMPLE 6.14:
of the image in Fig. 6.42(a). Although it was generated by pseudocolor meth- Segmentation in
HSI space.
ods, this image can be processed (segmented) as a full-color image without loss
of generality. Figures 6.42(b) through (d) are its HSI component images. Note
by comparing Figs. 6.42(a) and (b) that the region in which we are interested
has relatively high values of hue, indicating that the colors are on the blue-
magenta side of red (see Fig. 6.13). Figure 6.42(e) shows a binary mask gener-
ated by thresholding the saturation image with a threshold equal to 10% of the
maximum value in that image. Any pixel value greater than the threshold was
set to 1 (white). All others were set to 0 (black).
Figure 6.42(f) is the product of the mask with the hue image, and Fig.
6.42(g) is the histogram of the product image (note that the gray scale is in the
range [0, 1]). We see in the histogram that high values (which are the values of
interest) are grouped at the very high end of the gray scale, near 1.0. The result
of thresholding the product image with threshold value of 0.9 resulted in the
binary image shown in Fig. 6.42(h). The spatial location of the white points in
this image identifies the points in the original image that have the reddish hue
of interest. This was far from a perfect segmentation because there are points
in the original image that we certainly would say have a reddish hue, but that
were not identified by this segmentation method. However, it can be determined
444 Chapter 6 ■ Color Image Processing
a b
c d FIGURE 6.42 Image segmentation in HSI space. (a) Original. (b) Hue. (c) Saturation.
e f (d) Intensity. (e) Binary saturation mask (black = 0). (f) Product of (b) and (e).
g h (g) Histogram of (f). (h) Segmentation of red components in (a).
6.7 ■ Image Segmentation Based on Color 445
by experimentation that the regions shown in white in Fig. 6.42(h) are about
the best this method can do in identifying the reddish components of the orig-
inal image. The segmentation method discussed in the following section is ca-
pable of yielding considerably better results. ■
D(z, a) = 7z - a7
1
= [(z - a)T(z - a)]2 (6.7-1)
1
= [(zR - a R)2 + (zG - a G)2 + (zB - a B)2 ] 2
where the subscripts R, G, and B denote the RGB components of vectors a and
z. The locus of points such that D(z, a) … D0 is a solid sphere of radius D0, as il-
lustrated in Fig. 6.43(a). Points contained within the sphere satisfy the specified
color criterion; points outside the sphere do not. Coding these two sets of points
in the image with, say, black and white, produces a binary segmented image.
A useful generalization of Eq. (6.7-1) is a distance measure of the form
1
D(z, a) = [(z - a)TC-1(z - a)]2 (6.7-2)
B B B a b c
FIGURE 6.43
Three approaches
for enclosing data
regions for RGB
vector
segmentation.
G G G
R R R
446 Chapter 6 ■ Color Image Processing
EXAMPLE 6.15: ■ The rectangular region shown Fig. 6.44(a) contains samples of reddish col-
Color image ors we wish to segment out of the color image. This is the same problem we
segmentation in
considered in Example 6.14 using hue, but here we approach the problem
RGB space.
using RGB color vectors. The approach followed was to compute the mean
vector a using the color points contained within the rectangle in Fig. 6.44(a),
and then to compute the standard deviation of the red, green, and blue values
of those samples. A box was centered at a, and its dimensions along each of the
RGB axes were selected as 1.25 times the standard deviation of the data along
the corresponding axis. For example, let sR denote the standard deviation of
the red components of the sample points. Then the dimensions of the box
along the R-axis extended from (aR - 1.25sR) to (aR + 1.25sR), where aR de-
notes the red component of average vector a. The result of coding each point
in the entire color image as white if it was on the surface or inside the box, and
as black otherwise, is shown in Fig. 6.44(b). Note how the segmented region
was generalized from the color samples enclosed by the rectangle. In fact, by
comparing Figs. 6.44(b) and. 6.42(h), we see that segmentation in the RGB
vector space yielded results that are much more accurate, in the sense that
they correspond much more closely with what we would define as “reddish”
points in the original color image. ■
†
Computation of the covariance matrix of a set of vector samples is discussed in Section 11.4.
6.7 ■ Image Segmentation Based on Color 447
a
b
FIGURE 6.44
Segmentation in
RGB space.
(a) Original image
with colors of
interest shown
enclosed by a
rectangle.
(b) Result of
segmentation in
RGB vector
space. Compare
with Fig. 6.42(h).
Consider the two M * M color images (M odd) in Figs. 6.45(d) and (h),
composed of the three component images in Figs. 6.45(a) through (c) and (e)
through (g), respectively. If, for example, we compute the gradient image of
each of the component images [see Eq. (3.6-11)] and add the results to form
the two corresponding RGB gradient images, the value of the gradient at point
[(M + 1)>2, (M + 1)>2] would be the same in both cases. Intuitively, we
would expect the gradient at that point to be stronger for the image in Fig.
6.45(d) because the edges of the R, G, and B images are in the same direction
in that image, as opposed to the image in Fig. 6.45(h), in which only two of the
edges are in the same direction. Thus we see from this simple example that
processing the three individual planes to form a composite gradient image can
yield erroneous results. If the problem is one of just detecting edges, then the
individual-component approach usually yields acceptable results. If accuracy
is an issue, however, then obviously we need a new definition of the gradi-
ent applicable to vector quantities. We discuss next a method proposed by
Di Zenzo [1986] for doing this.
The problem at hand is to define the gradient (magnitude and direction) of
the vector c in Eq. (6.4-2) at any point (x, y). As was just mentioned, the gradi-
ent we studied in Section 3.6.4 is applicable to a scalar function f(x, y); it is not
applicable to vector functions. The following is one of the various ways in
which we can extend the concept of a gradient to vector functions. Recall that
for a scalar function f(x, y), the gradient is a vector pointing in the direction of
maximum rate of change of f at coordinates (x, y).
a b c d
e f g h
FIGURE 6.45 (a)–(c) R, G, and B component images and (d) resulting RGB color image. (e)–(g) R, G, and B
component images and (h) resulting RGB color image.
6.7 ■ Image Segmentation Based on Color 449
Let r, g, and b be unit vectors along the R, G, and B axis of RGB color space
(Fig. 6.7), and define the vectors
0R 0G 0B
u = r + g + b (6.7-3)
0x 0x 0x
and
0R 0G 0B
v = r + g + b (6.7-4)
0y 0y 0y
Let the quantities gxx, gyy, and gxy be defined in terms of the dot product of
these vectors, as follows:
gxx = u # u = uTu = ` ` + ` ` + ` `
0R 2 0G 2 0B 2
(6.7-5)
0x 0x 0x
gyy = v # v = vTv = ` ` + ` ` + ` `
0R 2 0G 2 0B 2
(6.7-6)
0y 0y 0y
and
0R 0R 0G 0G 0B 0B
gxy = u # v = uTv = + + (6.7-7)
0x 0y 0x 0y 0x 0y
Keep in mind that R, G, and B, and consequently the g’s, are functions of x and
y. Using this notation, it can be shown (Di Zenzo [1986]) that the direction of
maximum rate of change of c(x, y) is given by the angle
1 2gxy
u(x, y) = tan-1 B R (6.7-8)
2 gxx - gyy
and that the value of the rate of change at (x, y), in the direction of u(x, y), is
given by
1
EXAMPLE 6.16: ■ Figure 6.46(b) is the gradient of the image in Fig. 6.46(a), obtained using
Edge detection in the vector method just discussed. Figure 6.46(c) shows the image obtained by
vector space. computing the gradient of each RGB component image and forming a com-
posite gradient image by adding the corresponding values of the three com-
ponent images at each coordinate (x, y). The edge detail of the vector
gradient image is more complete than the detail in the individual-plane gradi-
ent image in Fig. 6.46(c); for example, see the detail around the subject’s right
eye. The image in Fig. 6.46(d) shows the difference between the two gradient
images at each point (x, y). It is important to note that both approaches yield-
ed reasonable results. Whether the extra detail in Fig. 6.46(b) is worth the
added computational burden (as opposed to implementation of the Sobel op-
erators, which were used to generate the gradient of the individual planes)
can only be determined by the requirements of a given problem. Figure 6.47
shows the three component gradient images, which, when added and scaled,
were used to obtain Fig. 6.46(c). ■
a b
c d
FIGURE 6.46
(a) RGB image.
(b) Gradient
computed in RGB
color vector
space.
(c) Gradients
computed on a
per-image basis
and then added.
(d) Difference
between (b)
and (c).
6.8 ■ Noise in Color Images 451
a b c
FIGURE 6.47 Component gradient images of the color image in Fig. 6.46. (a) Red component, (b) green
component, and (c) blue component. These three images were added and scaled to produce the image in
Fig. 6.46(c).
■ In this example we take a brief look at noise in color images and how noise EXAMPLE 6.17:
carries over when converting from one color model to another. Figures 6.48(a) Illustration of the
effects of
through (c) show the three color planes of an RGB image corrupted by Gauss-
converting noisy
ian noise, and Fig. 6.48(d) is the composite RGB image. Note that fine grain RGB images to
noise such as this tends to be less visually noticeable in a color image than it is HSI.
in a monochrome image. Figures 6.49(a) through (c) show the result of con-
verting the RGB image in Fig. 6.48(d) to HSI. Compare these results with the
HSI components of the original image (Fig. 6.39) and note how significantly
degraded the hue and saturation components of the noisy image are. This is
due to the nonlinearity of the cos and min operations in Eqs. (6.2-2) and (6.2-3),
respectively. On the other hand, the intensity component in Fig. 6.49(c) is
slightly smoother than any of the three noisy RGB component images. This is
due to the fact that the intensity image is the average of the RGB images, as in-
dicated in Eq. (6.2-4). (Recall the discussion in Section 2.6.3 regarding the fact
that image averaging reduces random noise.)
452 Chapter 6 ■ Color Image Processing
a b
c d
FIGURE 6.48
(a)–(c) Red,
green, and blue
component
images corrupted
by additive
Gaussian noise of
mean 0 and
variance 800.
(d) Resulting
RGB image.
[Compare (d)
with Fig. 6.46(a).]
a b c
FIGURE 6.49 HSI components of the noisy color image in Fig. 6.48(d). (a) Hue. (b) Saturation. (c) Intensity.
6.8 ■ Noise in Color Images 453
a b
c d
FIGURE 6.50 (a) RGB image with green plane corrupted by salt-and-pepper noise.
(b) Hue component of HSI image. (c) Saturation component. (d) Intensity
component.
In cases when, say, only one RGB channel is affected by noise, conversion
to HSI spreads the noise to all HSI component images. Figure 6.50 shows an
example. Figure 6.50(a) shows an RGB image whose green image is corrupted
by salt-and-pepper noise, in which the probability of either salt or pepper is
0.05. The HSI component images in Figs. 6.50(b) through (d) show clearly how
the noise spread from the green RGB channel to all the HSI images. Of
course, this is not unexpected because computation of the HSI components
makes use of all RGB components, as shown in Section 6.2.3. ■
EXAMPLE 6.18: ■ Figure 6.51(a) shows a 24-bit RGB full-color image of an iris in which 8 bits
A color image each are used to represent the red, green, and blue components. Figure 6.51(b)
compression
was reconstructed from a compressed version of the image in (a) and is, in fact,
example.
a compressed and subsequently decompressed approximation of it. Although
the compressed image is not directly displayable—it must be decompressed
before input to a color monitor—the compressed image contains only 1 data
bit (and thus 1 storage bit) for every 230 bits of data in the original image. As-
suming that the compressed image could be transmitted over, say, the Internet,
in 1 minute, transmission of the original image would require almost 4 hours.
Of course, the transmitted data would have to be decompressed for viewing,
but the decompression can be done in a matter of seconds. The JPEG 2000
compression algorithm used to generate Fig. 6.51(b) is a recently introduced
standard that is described in detail in Section 8.2.10. Note that the reconstruct-
ed approximation image is slightly blurred. This is a characteristic of many
lossy compression techniques; it can be reduced or eliminated by altering the
level of compression. ■
■ Summary 455
a
b
FIGURE 6.51
Color image
compression.
(a) Original RGB
image. (b) Result
of compressing
and decom-
pressing the
image in (a).
Summary
The material in this chapter is an introduction to color image processing and covers topics
selected to provide a solid background in the techniques used in this branch of image pro-
cessing. Our treatment of color fundamentals and color models was prepared as foundation
material for a field that is wide in technical scope and areas of application. In particular, we
focused on color models that we felt are not only useful in digital image processing but pro-
vide also the tools necessary for further study in this area of image processing. The discus-
sion of pseudocolor and full-color processing on an individual image basis provides a tie to
techniques that were covered in some detail in Chapters 3 through 5.
The material on color vector spaces is a departure from methods that we had stud-
ied before and highlights some important differences between gray-scale and full-color
processing. In terms of techniques, the areas of direct color vector processing are
numerous and include processes such as median and other order filters, adaptive and
456 Chapter 6 ■ Color Image Processing
morphological filters, image restoration, image compression, and many others. These
processes are not equivalent to color processing carried out on the individual compo-
nent images of a color image. The references in the following section provide a pointer
to further results in this field.
Our treatment of noise in color images also points out that the vector nature of the
problem, along with the fact that color images are routinely transformed from one
working space to another, has implications on the issue of how to reduce noise in these
images. In some cases, noise filtering can be done on a per-image basis, but others, such
as median filtering, require special treatment to reflect the fact that color pixels are
vector quantities, as mentioned in the previous paragraph.
Although segmentation is the topic of Chapter 10 and image data compression is
the topic of Chapter 8, we gained the advantage of continuity by introducing them here
in the context of color image processing. As will become evident in subsequent discus-
sions, many of the techniques developed in those chapters are applicable to the discus-
sion in this chapter.
Problems
6.1 Give the percentages of red (X), green (Y), and blue (Z) light required to gen-
Detailed solutions to the
problems marked with a erate the point labeled “warm white” in Fig. 6.5.
star can be found in the
6.2 Consider any two valid colors c1 and c2 with coordinates (x1, y1) and (x2, y2) in
book Web site. The site
also contains suggested the chromaticity diagram of Fig. 6.5. Derive the necessary general expression(s)
projects based on the ma- for computing the relative percentages of colors c1 and c2 composing a given
terial in this chapter.
color that is known to lie on the straight line joining these two colors.
■ Problems 457
6.3 Consider any three valid colors c1, c2, and c3 with coordinates (x1, y1), (x2, y2),
and (x3, y3) in the chromaticity diagram of Fig. 6.5. Derive the necessary gener-
al expression(s) for computing the relative percentages of c1, c2, and c3 compos-
ing a given color that is known to lie within the triangle whose vertices are at the
coordinates of c1, c2, and c3.
6.4 In an automated assembly application, three classes of parts are to be color
coded in order to simplify detection. However, only a monochrome TV camera
is available to acquire digital images. Propose a technique for using this camera
to detect the three different colors.
6.5 In a simple RGB image, the R, G, and B component images have the horizontal
intensity profiles shown in the following diagram. What color would a person
see in the middle column of this image?
Color
Color
0.5 Red 0.5 Green 0.5 Blue
6.6 Sketch the RGB components of the following image as they would appear on a
monochrome monitor. All colors are at maximum intensity and saturation. In
working this problem, consider the middle gray border as part of the image.
6.7 How many different shades of gray are there in a color RGB system in which
each RGB image is an 8-bit image?
6.8 Consider the RGB color cube shown in Fig 6.8, and answer each of the following:
(a) Describe how the gray levels vary in the R, G, and B primary images that
make up the front face of the color cube.
(b) Suppose that we replace every color in the RGB cube by its CMY color.
This new cube is displayed on an RGB monitor. Label with a color name the
eight vertices of the new cube that you would see on the screen.
458 Chapter 6 ■ Color Image Processing
(c) What can you say about the colors on the edges of the RGB color cube re-
garding saturation?
6.9 (a) Sketch the CMY components of the image in Problem 6.6 as they would ap-
pear on a monochrome monitor.
(b) If the CMY components sketched in (a) are fed into the red, green, and blue
inputs of a color monitor, respectively, describe the resulting image.
6.10 Derive the CMY intensity mapping function of Eq. (6.5-6) from its RGB coun-
terpart in Eq. (6.5-5).
6.11 Consider the entire 216 safe-color array shown in Fig. 6.10(a). Label each cell by
its (row, column) designation, so that the top left cell is (1, 1) and the rightmost
bottom cell is (12, 18). At which cells will you find
(a) The purest green?
(b) The purest blue?
6.12 Sketch the HSI components of the image in Problem 6.6 as they would appear
on a monochrome monitor.
6.13 Propose a method for generating a color band similar to the one shown in the
zoomed section entitled Visible Spectrum in Fig. 6.2. Note that the band starts at
a dark purple on the left and proceeds toward pure red on the right. (Hint: Use
the HSI color model.)
6.14 Propose a method for generating a color version of the image shown diagram-
matically in Fig. 6.13(c). Give your answer in the form of a flow chart. Assume
that the intensity value is fixed and given. (Hint: Use the HSI color model.)
6.15 Consider the following image composed of solid color squares. For discussing
your answer, choose a gray scale consisting of eight shades of gray, 0 through 7,
where 0 is black and 7 is white. Suppose that the image is converted to HSI color
space. In answering the following questions, use specific numbers for the gray
shades if using numbers makes sense. Otherwise, the relationships “same as,”
“lighter than,” or “darker than” are sufficient. If you cannot assign a specific gray
level or one of these relationships to the image you are discussing, give the reason.
(a) Sketch the hue image.
(b) Sketch the saturation image.
(c) Sketch the intensity image.
White
Black
■ Problems 459
6.16 The following 8-bit images are (left to right) the H, S, and I component im-
ages from Fig. 6.16. The numbers indicate gray-level values. Answer the fol-
lowing questions, explaining the basis for your answer in each. If it is not
possible to answer a question based on the given information, state why you
cannot do so.
(a) Give the gray-level values of all regions in the hue image.
(b) Give the gray-level value of all regions in the saturation image.
(c) Give the gray-level values of all regions in the intensity image.
6.25 Consider the following 500 * 500 RGB image, in which the squares are fully
saturated red, green, and blue, and each of the colors is at maximum intensity
[e.g., (1, 0, 0) for the red square]. An HSI image is generated from this image.
(a) Describe the appearance of each HSI component image.
(b) The saturation component of the HSI image is smoothed using an averaging
mask of size 125 * 125. Describe the appearance of the result (you may ig-
nore image border effects in the filtering operation).
(c) Repeat (b) for the hue image.
Green Red
Blue Green
6.26 Show that Eq. (6.7-2) reduces to Eq. (6.7-1) when C = I, the identity matrix.
6.27 (a) With reference to the discussion in Section 6.7.2, give a procedure (in flow
chart form) for determining whether a color vector (point) z is inside a cube
with sides W, centered at an average color vector a. Distance computations
are not allowed.
(b) This process also can be implemented on an image-by-image basis if the box
is lined up with the axes. Show how you would do it.
6.28 Sketch the surface in RGB space for the points that satisfy the equation
1
D(z, a) = [(z - a)TC-1(z - a)]2 = D0
where D0 is a specified nonzero constant. Assume that a = 0 and that
8 0 0
C = C0 1 0S
0 0 1
6.29 Refer to Section 6.7.3. One might think that a logical approach for defining the
gradient of an RGB image at any point (x, y) would be to compute the gradient
vector (see Section 3.6.4) of each component image and then form a gradient
vector for the color image by summing the three individual gradient vectors.
Unfortunately, this method can at times yield erroneous results. Specifically, it is
possible for a color image with clearly defined edges to have a zero gradient if
this method were used. Give an example of such an image. (Hint: Set one of the
color planes to a constant value to simplify your analysis.)