0% found this document useful (0 votes)
60 views67 pages

After CT DIP-417-547-1-67

Color image processing is essential for object identification and extraction, leveraging the human ability to discern thousands of colors compared to grayscale. It encompasses full-color and pseudocolor processing, with advancements in color sensors making full-color techniques widely applicable. The document discusses color fundamentals, including the perception of color, the nature of light, and the distinction between primary colors of light and pigments.

Uploaded by

Praveen K S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views67 pages

After CT DIP-417-547-1-67

Color image processing is essential for object identification and extraction, leveraging the human ability to discern thousands of colors compared to grayscale. It encompasses full-color and pseudocolor processing, with advancements in color sensors making full-color techniques widely applicable. The document discusses color fundamentals, including the perception of color, the nature of light, and the distinction between primary colors of light and pigments.

Uploaded by

Praveen K S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

6 Color Image Processing

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

For a long time I limited myself to one color—as a form of discipline.


Pablo Picasso

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

Others require reformulation to be consistent with the properties of the color


spaces developed in this chapter. The techniques described here are far from ex-
haustive; they illustrate the range of methods available for color image processing.

6.1 Color Fundamentals


Although the process followed by the human brain in perceiving and inter-
preting color is a physiopsychological phenomenon that is not fully under-
stood, the physical nature of color can be expressed on a formal basis
supported by experimental and theoretical results.
In 1666, Sir Isaac Newton discovered that when a beam of sunlight passes
through a glass prism, the emerging beam of light is not white but consists in-
stead of a continuous spectrum of colors ranging from violet at one end to red
at the other. As Fig. 6.1 shows, the color spectrum may be divided into six
broad regions: violet, blue, green, yellow, orange, and red. When viewed in full
color (Fig. 6.2), no color in the spectrum ends abruptly, but rather each color
blends smoothly into the next.
Basically, the colors that humans and some other animals perceive in an object
are determined by the nature of the light reflected from the object. As illustrated
in Fig. 6.2, visible light is composed of a relatively narrow band of frequencies in
the electromagnetic spectrum.A body that reflects light that is balanced in all vis-
ible wavelengths appears white to the observer. However, a body that favors re-
flectance 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.

FIGURE 6.1 Color


spectrum seen by
passing white
light through a
prism. (Courtesy
of the General
Electric Co.,
Lamp Business
Division.)

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

Characterization of light is central to the science of color. If the light is


achromatic (void of color), its only attribute is its intensity, or amount. Achro-
matic light is what viewers see on a black and white television set, and it has
been an implicit component of our discussion of image processing thus far. As
defined in Chapter 2, and used numerous times since, the term gray level
refers to a scalar measure of intensity that ranges from black, to grays, and fi-
nally to white.
Chromatic light spans the electromagnetic spectrum from approximately
400 to 700 nm. 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 mea-
sured 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 spec-
trum could have significant energy (radiance), but an observer would hardly
perceive it; its luminance would be almost zero. Finally, brightness is a subjec-
tive descriptor that is practically impossible to measure. It embodies the
achromatic notion of intensity and is one of the key factors in describing
color sensation.
As noted in Section 2.1.1, cones are the sensors in the eye responsible for
color vision. Detailed experimental evidence has established that the 6 to 7 mil-
lion cones in the human eye can be divided into three principal sensing cate-
gories, corresponding roughly to red, green, and blue. Approximately 65% of all
cones are sensitive to red light, 33% are sensitive to green light, and only about
2% are sensitive to blue (but the blue cones are the most sensitive). Figure 6.3
shows average experimental curves detailing the absorption of light by the red,
green, and blue cones in the eye. Due to these absorption characteristics of the

FIGURE 6.3 445 nm 535 nm 575 nm


Absorption of
light by the red,
Absorption (arbitrary units)

green, and blue


cones in the Blue Green Red
human eye as a
function of
wavelength.

400 450 500 550 600 650 700 nm


Bluish purple

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

PRIMARY AND SECONDARY COLORS


OF LIGHT AND PIGMENT
398 Chapter 6 ■ Color Image Processing

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

tristimulus values and are denoted, X, Y, and Z, respectively. A color is then


specified by its trichromatic coefficients, defined as
X
x = (6.1-1)
X + Y + Z
Y
y = (6.1-2)
X + Y + Z
and
Z
z = (6.1-3)
X + Y + Z
It is noted from these equations that†
x + y + z = 1 (6.1-4)
For any wavelength of light in the visible spectrum, the tristimulus values
needed to produce the color corresponding to that wavelength can be ob-
tained directly from curves or tables that have been compiled from extensive
experimental results (Poynton [1996]. See also the early references by Walsh
[1958] and by Kiver [1965]).
Another approach for specifying colors is to use the CIE chromaticity dia-
gram (Fig. 6.5), which shows color composition as a function of x (red) and y
(green). For any value of x and y, the corresponding value of z (blue) is ob-
tained from Eq. (6.1-4) by noting that z = 1 - (x + y). The point marked
green in Fig. 6.5, for example, has approximately 62% green and 25% red con-
tent. From Eq. (6.1-4), the composition of blue is approximately 13%.
The positions of the various spectrum colors—from violet at 380 nm to red
at 780 nm—are indicated around the boundary of the tongue-shaped chro-
maticity diagram. These are the pure colors shown in the spectrum of Fig. 6.2.
Any point not actually on the boundary but within the diagram represents
some mixture of spectrum colors. The point of equal energy shown in Fig. 6.5
corresponds to equal fractions of the three primary colors; it represents the
CIE standard for white light. Any point located on the boundary of the chro-
maticity chart is fully saturated. As a point leaves the boundary and approach-
es the point of equal energy, more white light is added to the color and it
becomes less saturated. The saturation at the point of equal energy is zero.
The chromaticity diagram is useful for color mixing because a straight-line
segment joining any two points in the diagram defines all the different color
variations that can be obtained by combining these two colors additively. Con-
sider, for example, a straight line drawn from the red to the green points shown
in Fig. 6.5. If there is more red light than green light, the exact point represent-
ing the new color will be on the line segment, but it will be closer to the red
point than to the green point. Similarly, a line drawn from the point of equal


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.

6.2 Color Models


The purpose of a color model (also called color space or color system) is to fa-
cilitate the specification of colors in some standard, generally accepted way. In
essence, a color model is a specification of a coordinate system and a subspace
within that system where each color is represented by a single point.
Most color models in use today are oriented either toward hardware (such
as for color monitors and printers) or toward applications where color manip-
ulation is a goal (such as in the creation of color graphics for animation). In
402 Chapter 6 ■ Color Image Processing

terms of digital image processing, the hardware-oriented models most com-


monly used in practice are the RGB (red, green, blue) model for color moni-
tors and a broad class of color video cameras; the CMY (cyan, magenta,
yellow) and CMYK (cyan, magenta, yellow, black) models for color printing;
and the HSI (hue, saturation, intensity) model, which corresponds closely with
the way humans describe and interpret color. The HSI model also has the ad-
vantage that it decouples the color and gray-scale information in an image,
making it suitable for many of the gray-scale techniques developed in this
book. There are numerous color models in use today due to the fact that color
science is a broad field that encompasses many areas of application. It is
tempting to dwell on some of these models here simply because they are inter-
esting and informative. However, keeping to the task at hand, the models dis-
cussed in this chapter are leading models for image processing. Having
mastered the material in this chapter, you will have no difficulty in under-
standing additional color models in use today.

6.2.1 The RGB Color Model


In the RGB model, each color appears in its primary spectral components of
red, green, and blue. This model is based on a Cartesian coordinate system.
The color subspace of interest is the cube shown in Fig. 6.7, in which RGB pri-
mary values are at three corners; the secondary colors cyan, magenta, and yel-
low are at three other corners; black is at the origin; and white is at the corner
farthest from the origin. In this model, the gray scale (points of equal RGB
values) extends from black to white along the line joining these two points.
The different colors in this model are points on or inside the cube, and are de-
fined by vectors extending from the origin. For convenience, the assumption
is that all color values have been normalized so that the cube shown in Fig. 6.7
is the unit cube. That is, all values of R, G, and B are assumed to be in the
range [0, 1].

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).

Gray scale (0, 1, 0)


Black G
Green

(1, 0, 0)
Red Yellow

R
6.2 ■ Color Models 403

FIGURE 6.8 RGB


24-bit color cube.

Images represented in the RGB color model consist of three component


images, one for each primary color. When fed into an RGB monitor, these
three images combine on the screen to produce a composite color image, as
explained in Section 6.1. The number of bits used to represent each pixel in
RGB space is called the pixel depth. Consider an RGB image in which each of
the red, green, and blue images is an 8-bit image. Under these conditions each
RGB color pixel [that is, a triplet of values (R, G, B)] is said to have a depth of
24 bits (3 image planes times the number of bits per plane). The term full-color
image is used often to denote a 24-bit RGB color image. The total number of
colors in a 24-bit RGB image is (28)3 = 16,777,216. Figure 6.8 shows the 24-bit
RGB color cube corresponding to the diagram in Fig. 6.7.

■ 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)

While high-end display cards and monitors provide a reasonable rendition


of the colors in a 24-bit RGB image, many systems in use today are limited to
256 colors. Also, there are numerous applications in which it simply makes no
sense to use more than a few hundred, and sometimes fewer, colors. A good
example of this is provided by the pseudocolor image processing techniques
discussed in Section 6.3. Given the variety of systems in current use, it is of
considerable interest to have a subset of colors that are likely to be repro-
duced faithfully, reasonably independently of viewer hardware capabilities.
This subset of colors is called the set of safe RGB colors, or the set of all-
systems-safe colors. In Internet applications, they are called safe Web colors or
safe browser colors.
On the assumption that 256 colors is the minimum number of colors that
can be reproduced faithfully by any system in which a desired result is likely to
be displayed, it is useful to have an accepted standard notation to refer to
these colors. Forty of these 256 colors are known to be processed differently by
various operating systems, leaving only 216 colors that are common to most
systems. These 216 colors have become the de facto standard for safe colors,
especially in Internet applications. They are used whenever it is desired that
the colors viewed by most people appear the same.
6.2 ■ Color Models 405

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.

6.2.2 The CMY and CMYK Color Models


As indicated in Section 6.1, cyan, magenta, and yellow are the secondary colors
of light or, alternatively, the primary colors of pigments. For example, when a
surface coated with cyan pigment is illuminated with white light, no red light is
reflected from the surface. That is, cyan subtracts red light from reflected white
light, which itself is composed of equal amounts of red, green, and blue light.
Most devices that deposit colored pigments on paper, such as color printers
and copiers, require CMY data input or perform an RGB to CMY conversion
internally. This conversion is performed using the simple operation

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.

6.2.3 The HSI Color Model


As we have seen, creating colors in the RGB and CMY models and changing
from one model to the other is a straightforward process. As noted earlier,
these color systems are ideally suited for hardware implementations. In addi-
tion, the RGB system matches nicely with the fact that the human eye is
strongly perceptive to red, green, and blue primaries. Unfortunately, the
RGB, CMY, and other similar color models are not well suited for describing
colors in terms that are practical for human interpretation. For example, one
does not refer to the color of an automobile by giving the percentage of each
of the primaries composing its color. Furthermore, we do not think of color
images as being composed of three primary images that combine to form that
single image.
When humans view a color object, we describe it by its hue, saturation, and
brightness. Recall from the discussion in Section 6.1 that hue is a color at-
tribute that describes a pure color (pure yellow, orange, or red), whereas satu-
ration gives a measure of the degree to which a pure color is diluted by white
light. Brightness is a subjective descriptor that is practically impossible to mea-
sure. It embodies the achromatic notion of intensity and is one of the key fac-
tors in describing color sensation. We do know that intensity (gray level) is a
most useful descriptor of monochromatic images. This quantity definitely is
measurable and easily interpretable. The model we are about to present, called
the HSI (hue, saturation, intensity) color model, decouples the intensity com-
ponent from the color-carrying information (hue and saturation) in a color
image. As a result, the HSI model is an ideal tool for developing image pro-
cessing algorithms based on color descriptions that are natural and intuitive to
humans, who, after all, are the developers and users of these algorithms. We
can summarize by saying that RGB is ideal for image color generation (as in
image capture by a color camera or image display in a monitor screen), but its
use for color description is much more limited. The material that follows pro-
vides an effective way to do this.
408 Chapter 6 ■ Color Image Processing

As discussed in Example 6.1, an RGB color image can be viewed as three


monochrome intensity images (representing red, green, and blue), so it should
come as no surprise that we should be able to extract intensity from an RGB
image.This becomes rather clear if we take the color cube from Fig. 6.7 and stand
it on the black (0, 0, 0) vertex, with the white vertex (1, 1, 1) directly above it, as
shown in Fig. 6.12(a). As noted in connection with Fig. 6.7, the intensity (gray
scale) is along the line joining these two vertices. In the arrangement shown in
Fig. 6.12, the line (intensity axis) joining the black and white vertices is vertical.
Thus, if we wanted to determine the intensity component of any color point in
Fig. 6.12, we would simply pass a plane perpendicular to the intensity axis and
containing the color point. The intersection of the plane with the intensity axis
would give us a point with intensity value in the range [0, 1]. We also note with a
little thought that the saturation (purity) of a color increases as a function of dis-
tance from the intensity axis. In fact, the saturation of points on the intensity axis
is zero, as evidenced by the fact that all points along this axis are gray.
In order to see how hue can be determined also from a given RGB point,
consider Fig. 6.12(b), which shows a plane defined by three points (black,
white, and cyan). The fact that the black and white points are contained in the
plane tells us that the intensity axis also is contained in the plane. Further-
more, we see that all points contained in the plane segment defined by the in-
tensity axis and the boundaries of the cube have the same hue (cyan in this
case). We would arrive at the same conclusion by recalling from Section 6.1
that all colors generated by three colors lie in the triangle defined by those col-
ors. If two of those points are black and white and the third is a color point, all
points on the triangle would have the same hue because the black and white
components cannot change the hue (of course, the intensity and saturation of
points in this triangle would be different). By rotating the shaded plane about
the vertical intensity axis, we would obtain different hues. From these concepts
we arrive at the conclusion that the hue, saturation, and intensity values re-
quired to form the HSI space can be obtained from the RGB color cube. That
is, we can convert any RGB point to a corresponding point in the HSI color
model by working out the geometrical formulas describing the reasoning out-
lined in the preceding discussion.

a b
FIGURE 6.12 White White
Conceptual
relationships
between the RGB
and HSI color Magenta Magenta
models. Cyan Yellow Cyan Yellow

Blue Red Blue Red


Green Green

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

Cyan White Red

Blue Magenta
Green Yellow Green Yellow
Green

S S
H H
Cyan Red Cyan S Yellow Cyan Red
H

Blue Magenta Blue Magenta Red Blue Magenta

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

Converting colors from RGB to HSI


Computations from RGB Given an image in RGB color format, the H component of each RGB pixel is
to HSI and back are
carried out on a per-pixel obtained using the equation
basis. We omitted the
dependence on (x, y) of u if B … G
the conversion equations H = b (6.2-2)
for notational clarity. 360 - u if B 7 G
6.2 ■ Color Models 411

with†
1
2 [(R - G) + (R - B)]
u = cos b -1
r
[(R - G) + (R - B)(G - B)]1>2
2

The saturation component is given by


3
S = 1 - [min(R, G, B)] (6.2-3)
(R + G + B)
Finally, the intensity component is given by
1
I =
(R + G + B) (6.2-4)
3
It is assumed that the RGB values have been normalized to the range [0, 1]
and that angle u is measured with respect to the red axis of the HSI space, as
indicated in Fig. 6.13. Hue can be normalized to the range [0, 1] by dividing by
360° all values resulting from Eq. (6.2-2). The other two HSI components al-
ready are in this range if the given RGB values are in the interval [0, 1].
The results in Eqs. (6.2-2) through (6.2-4) can be derived from the geometry
shown in Figs. 6.12 and 6.13. The derivation is tedious and would not add sig-
nificantly to the present discussion. The interested reader can consult the Consult the Tutorials sec-
book’s references or Web site for a proof of these equations, as well as for the tion of the book Web site
for a detailed derivation
following HSI to RGB conversion results. of the conversion equa-
tions between RGB and
Converting colors from HSI to RGB HSI, and vice versa.

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°].

RG sector (0° … H 6 120°): When H is in this sector, the RGB components


are given by the equations
B = I(1 - S) (6.2-5)

d
S cos H
R = Ic1 + (6.2-6)
cos(60° - H)
and
G = 3I - (R + B) (6.2-7)

GB sector (120° … H 6 240°): If the given value of H is in this sector, we first


subtract 120° from it:
H = H - 120° (6.2-8)


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

Then the RGB components are


R = I(1 - S) (6.2-9)

d
S cos H
G = Ic1 + (6.2-10)
cos(60° - H)
and
B = 3I - (R + G) (6.2-11)

BR sector (240° … H … 360°): Finally, if H is in this range, we subtract 240°


from it:
H = H - 240° (6.2-12)
Then the RGB components are
G = I(1 - S) (6.2-13)

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. ■

Manipulating HSI component images


In the following discussion, we take a look at some simple techniques for ma-
nipulating HSI component images. This will help you develop familiarity with
these components and also help you deepen your understanding of the HSI color
model. Figure 6.16(a) shows an image composed of the primary and secondary
RGB colors. Figures 6.16(b) through (d) show the H, S, and I components of
this image, generated using Eqs. (6.2-2) through (6.2-4). Recall from the dis-
cussion earlier in this section that the gray-level values in Fig. 6.16(b) corre-
spond to angles; thus, for example, because red corresponds to 0°, the red
region in Fig. 6.16(a) is mapped to a black region in the hue image. Similarly,
the gray levels in Fig. 6.16(c) correspond to saturation (they were scaled to
[0, 255] for display), and the gray levels in Fig. 6.16(d) are average intensities.

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.

6.3 Pseudocolor Image Processing


Pseudocolor (also called false color) image processing consists of assigning col-
ors to gray values based on a specified criterion. The term pseudo or false color
is used to differentiate the process of assigning colors to monochrome images
6.3 ■ Pseudocolor Image Processing 415

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.

6.3.1 Intensity Slicing


The technique of intensity (sometimes called density) slicing and color coding is
one of the simplest examples of pseudocolor image processing. If an image is in-
terpreted as a 3-D function [see Fig. 2.18(a)], the method can be viewed as one
of placing planes parallel to the coordinate plane of the image; each plane then
“slices” the function in the area of intersection. Figure 6.18 shows an example of
using a plane at f(x, y) = li to slice the image function into two levels.
If a different color is assigned to each side of the plane shown in Fig. 6.18,
any pixel whose intensity level is above the plane will be coded with one color,
and any pixel below the plane will be coded with the other. Levels that lie on
the plane itself may be arbitrarily assigned one of the two colors. The result is
a two-color image whose relative appearance can be controlled by moving the
slicing plane up and down the intensity axis.
In general, the technique may be summarized as follows. Let [0, L - 1]
represent the gray scale, let level l0 represent black [f(x, y) = 0], and level
lL - 1 represent white [f(x, y) = L - 1]. Suppose that P planes perpendicular
to the intensity axis are defined at levels l1, l2, Á , lP. Then, assuming that
0 6 P 6 L - 1, the P planes partition the gray scale into P + 1 intervals,
V1, V2, Á , VP + 1. Intensity to color assignments are made according to the re-
lation
f(x, y) = ck if f(x, y) H Vk (6.3-1)

f (x, y) FIGURE 6.18


Intensity axis Geometric
(White) L  1
interpretation of
the intensity-
Slicing plane slicing technique.
li

(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. ■

6.3.2 Intensity to Color Transformations


Other types of transformations are more general and thus are capable of
achieving a wider range of pseudocolor enhancement results than the simple
slicing technique discussed in the preceding section. An approach that is partic-
ularly attractive is shown in Fig. 6.23. Basically, the idea underlying this ap-
proach is to perform three independent transformations on the intensity of any
input pixel. The three results are then fed separately into the red, green, and
blue channels of a color television monitor. This method produces a composite
image whose color content is modulated by the nature of the transformation
6.3 ■ Pseudocolor Image Processing 419

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

functions. Note that these are transformations on the intensity values of an


image and are not functions of position.
The method discussed in the previous section is a special case of the tech-
nique just described. There, piecewise linear functions of the intensity levels
(Fig. 6.19) are used to generate colors. The method discussed in this section, on
the other hand, can be based on smooth, nonlinear functions, which, as might
be expected, gives the technique considerable flexibility.

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

FIGURE 6.26 A g 1 (x, y)


pseudocolor f 1 (x, y) Transformation T1 h R (x, y)
coding approach
used when several
monochrome g 2 (x, y)
images are Additional hG (x, y)
f 2 (x, y) Transformation T2
available. processing

g K (x, y)
f K (x, y) Transformation TK hB (x, y)

The approach shown in Fig. 6.23 is based on a single monochrome image.


Often, it is of interest to combine several monochrome images into a single
color composite, as shown in Fig. 6.26. A frequent use of this approach (illus-
trated in Example 6.6) is in multispectral image processing, where different
sensors produce individual monochrome images, each in a different spectral
band. The types of additional processes shown in Fig. 6.26 can be techniques
such as color balancing (see Section 6.5.4), combining images, and selecting
the three images for display based on knowledge about response characteris-
tics of the sensors used to generate the images.

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. ■

6.4 Basics of Full-Color Image Processing


In this section, we begin the study of processing techniques applicable to full-
color images. Although they are far from being exhaustive, the techniques de-
veloped in the sections that follow are illustrative of how full-color images are
handled for a variety of image processing tasks. Full-color image processing
approaches fall into two major categories. In the first category, we process
each component image individually and then form a composite processed
color image from the individually processed components. In the second category,
we work with color pixels directly. Because full-color images have at least
6.4 ■ Basics of Full-Color Image Processing 425

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

Gray-scale image RGB color image


426 Chapter 6 ■ Color Image Processing

Suppose that the process is neighborhood averaging. In Fig. 6.29(a), averaging


would be accomplished by summing the intensities of all the pixels in the
neighborhood and dividing by the total number of pixels in the neighborhood.
In Fig. 6.29(b), averaging would be done by summing all the vectors in the
neighborhood and dividing each component by the total number of vectors in
the neighborhood. But each component of the average vector is the sum of the
pixels in the image corresponding to that component, which is the same as the
result that would be obtained if the averaging were done on a per-color-
component basis and then the vector was formed. We show this in more detail
in the following sections. We also show methods in which the results of the two
approaches are not the same.

6.5 Color Transformations


The techniques described in this section, collectively called color transforma-
tions, deal with processing the components of a color image within the context
of a single color model, as opposed to the conversion of those components be-
tween models (like the RGB-to-HSI and HSI-to-RGB conversion transforma-
tions of Section 6.2.3).

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

Cyan Magenta Yellow Black

Red Green Blue

Hue Saturation Intensity


FIGURE 6.30 A full-color image and its various color-space components. (Original image courtesy of MedData
Interactive.)

The full-color image in Fig. 6.30 shows a high-resolution color image of a


bowl of strawberries and a cup of coffee that was digitized from a large format
(4– * 5–) color negative. The second row of the figure contains the components
428 Chapter 6 ■ Color Image Processing

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

FIGURE 6.32 Blue Magenta


Complements on
the color circle.

Cyan ents
plem Red
Com

Green Yellow

6.5.2 Color Complements


The hues directly opposite one another on the color circle† of Fig. 6.32 are called
complements. Our interest in complements stems from the fact that they are
analogous to the gray-scale negatives of Section 3.2.1. As in the gray-scale case,
color complements are useful for enhancing detail that is embedded in dark re-
gions of a color image—particularly when the regions are dominant in size.

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.

6.5.3 Color Slicing


Highlighting a specific range of colors in an image is useful for separating ob-
jects from their surroundings. The basic idea is either to (1) display the colors
of interest so that they stand out from the background or (2) use the region de-
fined by the colors as a mask for further processing. The most straightforward
approach is to extend the intensity slicing techniques of Section 3.2.4. Because
a color pixel is an n-dimensional quantity, however, the resulting color trans-
formation functions are more complicated than their gray-scale counterparts
in Fig. 3.11. In fact, the required transformations are more complex than the
color component transforms considered thus far. This is because all practical
color-slicing approaches require each pixel’s transformed color components to
be a function of all n original pixel’s color components.
One of the simplest ways to “slice” a color image is to map the colors outside
some range of interest to a nonprominent neutral color. If the colors of interest
are enclosed by a cube (or hypercube for n 7 3) of width W and centered at a
432 Chapter 6 ■ Color Image Processing

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. ■

6.5.4 Tone and Color Corrections


Color transformations can be performed on most desktop computers. In con-
junction with digital cameras, flatbed scanners, and inkjet printers, they turn a
personal computer into a digital darkroom—allowing tonal adjustments and
color corrections, the mainstays of high-end color reproduction systems, to be
performed without the need for traditionally outfitted wet processing (i.e.,
darkroom) facilities. Although tone and color corrections are useful in other
areas of imaging, the focus of the current discussion is on the most common
uses—photo enhancement and color reproduction.
The effectiveness of the transformations examined in this section is
judged ultimately in print. Because these transformations are developed, re-
fined, and evaluated on monitors, it is necessary to maintain a high degree of
color consistency between the monitors used and the eventual output de-
vices. In fact, the colors of the monitor should represent accurately any digi-
tally scanned source images, as well as the final printed output. This is best
accomplished with a device-independent color model that relates the color
gamuts (see Section 6.1) of the monitors and output devices, as well as any
other devices being used, to one another. The success of this approach is a
function of the quality of the color profiles used to map each device to the
model and the model itself. The model of choice for many color management
systems (CMS) is the CIE L * a * b* model, also called CIELAB (CIE [1978],
Robertson [1977]). The L * a * b* color components are given by the follow-
ing equations:

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

6.5.5 Histogram Processing


Unlike the interactive enhancement approaches of the previous section, the
gray-level histogram processing transformations of Section 3.3 can be applied
to color images in an automated way. Recall that histogram equalization auto-
matically determines a transformation that seeks to produce an image with a
uniform histogram of intensity values. In the case of monochrome images, it
was shown (see Fig. 3.20) to be reasonably successful at handling low-, high-,
and middle-key images. Since color images are composed of multiple compo-
nents, however, consideration must be given to adapting the gray-scale tech-
nique to more than one component and/or histogram. As might be expected, it
is generally unwise to histogram equalize the components of a color image in-
dependently. This results in erroneous color. A more logical approach is to
spread the color intensities uniformly, leaving the colors themselves (e.g.,
hues) unchanged. The following example shows that the HSI color space is
ideally suited to this type of approach.

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. ■

6.6 Smoothing and Sharpening


The next step beyond transforming each pixel of a color image without regard
to its neighbors (as in the previous section) is to modify its value based on the
characteristics of the surrounding pixels. In this section, the basics of this type
of neighborhood processing are illustrated within the context of color image
smoothing and sharpening.

6.6.1 Color Image Smoothing


With reference to Fig. 6.29(a) and the discussion in Sections 3.4 and 3.5, gray-
scale image smoothing can be viewed as a spatial filtering operation in which
the coefficients of the filtering mask have the same value. As the mask is slid
across the image to be smoothed, each pixel is replaced by the average of the
pixels in the neighborhood defined by the mask. As can be seen in Fig. 6.29(b),
this concept is easily extended to the processing of full-color images. The prin-
cipal difference is that instead of scalar intensity values we must deal with
component vectors of the form given in Eq. (6.4-2).
Let Sxy denote the set of coordinates defining a neighborhood centered at
(x, y) in an RGB color image. The average of the RGB component vectors in
this neighborhood is

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.

6.6.2 Color Image Sharpening


In this section we consider image sharpening using the Laplacian (see Section
3.6.2). From vector analysis, we know that the Laplacian of a vector is defined
as a vector whose components are equal to the Laplacian of the individual
scalar components of the input vector. In the RGB color system, the Laplacian
of vector c in Eq. (6.4-2) is

§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. ■

6.7 Image Segmentation Based on Color


Segmentation is a process that partitions an image into regions. Although
segmentation is the topic of Chapter 10, we consider color segmentation
briefly here for the sake of continuity. You will have no difficulty following
the discussion.

6.7.1 Segmentation in HSI Color Space


If we wish to segment an image based on color, and, in addition, we want to
carry out the process on individual planes, it is natural to think first of the HSI
space because color is conveniently represented in the hue image. Typically,
saturation is used as a masking image in order to isolate further regions of in-
terest in the hue image. The intensity image is used less frequently for segmen-
tation of color images because it carries no color information. The following
example is typical of how segmentation is performed in the HSI color space.

■ 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. ■

6.7.2 Segmentation in RGB Vector Space


Although, as mentioned numerous times in this chapter, working in HSI space
is more intuitive, segmentation is one area in which better results generally are
obtained by using RGB color vectors. The approach is straightforward. Sup-
pose that the objective is to segment objects of a specified color range in an
RGB image. Given a set of sample color points representative of the colors of
interest, we obtain an estimate of the “average” color that we wish to segment.
Let this average color be denoted by the RGB vector a. The objective of seg-
mentation is to classify each RGB pixel in a given image as having a color in
the specified range or not. In order to perform this comparison, it is necessary
to have a measure of similarity. One of the simplest measures is the Euclidean
distance. Let z denote an arbitrary point in RGB space. We say that z is similar
to a if the distance between them is less than a specified threshold, D0. The Eu-
clidean distance between z and a is given by

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

where C is the covariance matrix† of the samples representative of the color


we wish to segment. The locus of points such that D(z, a) … D0 describes a
solid 3-D elliptical body [Fig. 6.43(b)] with the important property that its
principal axes are oriented in the direction of maximum data spread. When
C = I, the 3 * 3 identity matrix, Eq. (6.7-2) reduces to Eq. (6.7-1). Segmenta-
tion is as described in the preceding paragraph.
Because distances are positive and monotonic, we can work with the dis-
tance squared instead, thus avoiding square root computations. However,
implementing Eq. (6.7-1) or (6.7-2) is computationally expensive for images
of practical size, even if the square roots are not computed. A compromise is
to use a bounding box, as illustrated in Fig. 6.43(c). In this approach, the box
is centered on a, and its dimensions along each of the color axes is chosen
proportional to the standard deviation of the samples along each of the axis.
Computation of the standard deviations is done only once using sample
color data.
Given an arbitrary color point, we segment it by determining whether or
not it is on the surface or inside the box, as with the distance formulations.
However, determining whether a color point is inside or outside a box is much
simpler computationally when compared to a spherical or elliptical enclosure.
Note that the preceding discussion is a generalization of the method intro-
duced in Section 6.5.3 in connection with color slicing.

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).

6.7.3 Color Edge Detection


As discussed in Chapter 10, edge detection is an important tool for image seg-
mentation. In this section, we are interested in the issue of computing edges on
an individual-image basis versus computing edges directly in color vector
space. The details of edge-based segmentation are given in Section 10.2.
Edge detection by gradient operators was introduced in Section 3.6.4 in
connection with image sharpening. Unfortunately, the gradient discussed in
Section 3.6.4 is not defined for vector quantities. Thus, we know immediately
that computing the gradient on individual images and then using the results to
form a color image will lead to erroneous results. A simple example will help
illustrate the reason why.
448 Chapter 6 ■ Color Image Processing

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

Fu (x, y) = e C (g + gyy) + (gxx - gyy) cos 2u(x, y) + 2gxy sin 2u(x, y) D f


1 2
(6.7-9)
2 xx

Because tan(a) = tan(a ; p), if u0 is a solution to Eq. (6.7-8), so is u0 ; p>2.


Furthermore, Fu = Fu + p, so F has to be computed only for values of u in the
half-open interval [0, p). The fact that Eq. (6.7-8) provides two values 90°
apart means that this equation associates with each point (x, y) a pair of or-
thogonal directions. Along one of those directions F is maximum, and it is
minimum along the other. The derivation of these results is rather lengthy,
and we would gain little in terms of the fundamental objective of our current
discussion by detailing it here. Consult the paper by Di Zenzo [1986] for
details. The partial derivatives required for implementing Eqs. (6.7-5)
through (6.7-7) can be computed using, for example, the Sobel operators dis-
cussed in Section 3.6.4.
450 Chapter 6 ■ Color Image Processing

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).

6.8 Noise in Color Images


The noise models discussed in Section 5.2 are applicable to color images. Usu-
ally, the noise content of a color image has the same characteristics in each
color channel, but it is possible for color channels to be affected differently by
noise. One possibility is for the electronics of a particular channel to malfunc-
tion. However, different noise levels are more likely to be caused by differences
in the relative strength of illumination available to each of the color channels.
For example, use of a red (reject) filter in a CCD camera will reduce the
strength of illumination available to the red sensor. CCD sensors are noisier at
lower levels of illumination, so the resulting red component of an RGB image
would tend to be noisier than the other two component images in this situation.

■ 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. ■

As is true of the processes we have discussed thus far, filtering of full-


color images can be carried out on a per-image basis or directly in color vector
454 Chapter 6 ■ Color Image Processing

space, depending on the process. For example, noise reduction by using an


averaging filter is the process discussed in Section 6.6.1, which we know
gives the same result in vector space as it does if the component images are
processed independently. Other filters, however, cannot be formulated in
this manner. Examples include the class of order statistics filters discussed
in Section 5.3.2. For instance, to implement a median filter in color vector
space it is necessary to find a scheme for ordering vectors in a way that the
median makes sense. While this was a simple process when dealing with
scalars, the process is considerably more complex when dealing with vec-
tors. A discussion of vector ordering is beyond the scope of our discussion
here, but the book by Plataniotis and Venetsanopoulos [2000] is a good ref-
erence on vector ordering and some of the filters based on the ordering
concept.

6.9 Color Image Compression


Because the number of bits required to represent color is typically three to
four times greater than the number employed in the representation of gray
levels, data compression plays a central role in the storage and transmission
of color images. With respect to the RGB, CMY(K), and HSI images of the
previous sections, the data that are the object of any compression are the
components of each color pixel (e.g., the red, green, and blue components of
the pixels in an RGB image); they are the means by which the color infor-
mation is conveyed. Compression is the process of reducing or eliminating
redundant and/or irrelevant data. Although compression is the topic of
Chapter 8, we illustrate the concept briefly in the following example using a
color image.

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.

References and Further Reading


For a comprehensive reference on the science of color, see Malacara [2001]. Regarding
the physiology of color, see Gegenfurtner and Sharpe [1999]. These two references,
along with the early books by Walsh [1958] and by Kiver [1965], provide ample supple-
mentary material for the discussion in Section 6.1. For further reading on color models
(Section 6.2), see Fortner and Meyer [1997], Poynton [1996], and Fairchild [1998]. For a
detailed derivation of the HSI model equations in Section 6.2.3 see the paper by Smith
[1978] or consult the book Web site. The topic of pseudocolor (Section 6.3) is closely
tied to the general area of data visualization. Wolff and Yaeger [1993] is a good basic
reference on the use of pseudocolor. The book by Thorell and Smith [1990] also is of in-
terest. For a discussion on the vector representation of color signals (Section 6.4), see
Plataniotis and Venetsanopoulos [2000].
References for Section 6.5 are Benson [1985], Robertson [1977], and CIE [1978]. See
also the classic paper by MacAdam [1942]. The material on color image filtering
(Section 6.6) is based on the vector formulation introduced in Section 6.4 and on our
discussion of spatial filtering in Chapter 3. Segmentation of color images (Section 6.7)
has been a topic of much attention during the past ten years.The papers by Liu and Yang
[1994] and by Shafarenko et al. [1998] are representative of work in this field. A special
issue of the IEEE Transactions on Image Processing [1997] also is of interest. The dis-
cussion on color edge detection (Section 6.7.3) is from Di Zenzo [1986]. The book by
Plataniotis and Venetsanopoulos [2000] does a good job of summarizing a variety of ap-
proaches to the segmentation of color images. The discussion in Section 6.8 is based on
the noise models introduced in Section 5.2. References on image compression (Section
6.9) are listed at the end of Chapter 8. For details of software implementation of many of
the techniques discussed in this chapter, see Gonzalez, Woods, and Eddins [2004].

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?

1.0 1.0 1.0


Color

Color

Color
0.5 Red 0.5 Green 0.5 Blue

0 N/2 N1 0 N/2 N1 0 N/ 2 N1


Position Position Position

 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.

Red Green Blue

Magenta Cyan Yellow

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.

(a) (b) (c)

6.17 Refer to Fig. 6.27 in answering the following:


(a) Why does the image in Fig. 6.27(f) exhibit predominantly red tones?
(b) Suggest an automated procedure for coding the water in Fig. 6.27 in a
bright-blue color.
(c) Suggest an automated procedure for coding the predominantly man-made
components in a bright yellow color. [Hint: Work with Fig. 6.27(f).]
 6.18 Show that the saturation component of the complement of a color image cannot
be computed from the saturation component of the input image alone.
6.19 Explain the shape of the hue transformation function for the complement ap-
proximation in Fig. 6.33(b) using the HSI color model.
 6.20 Derive the CMY transformations to generate the complement of a color image.
6.21 Draw the general shape of the transformation functions used to correct exces-
sive contrast in the RGB color space.
 6.22 Assume that the monitor and printer of an imaging system are imperfectly cali-
brated. An image that looks balanced on the monitor appears yellowish in print.
Describe general transformations that might correct the imbalance.
6.23 Compute the L * a * b* components of the image in Problem 6.6 assuming

X 0.588 0.179 0.183 R


C Y S = C 0.29 0.606 0.105 S C G S
Z 0 0.068 1.021 B
This matrix equation defines the tristimulus values of the colors generated by
standard National Television System Committee (NTSC) color TV phosphors
viewed under D65 standard illumination (Benson [1985]).
 6.24 How would you implement the color equivalent of gray scale histogram match-
ing (specification) from Section 3.3.2?
460 Chapter 6 ■ Color Image Processing

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.)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy