BCS613B Module 4 Textbook
BCS613B Module 4 Textbook
Preview
Using color in image processing is motivated by two principal factors. First, color is a powerful descrip-
tor that often simplifies object identification and extraction from a scene. Second, humans can discern
thousands of color shades, compared to only about two dozen shades of gray. The latter factor is par-
ticularly important in manual image analysis. Color image processing is divided into two major areas:
pseudo- and full-color processing. In the first category, the issue is one of assigning color(s) to a par-
ticular grayscale intensity or range of intensities. In the second, images typically are acquired using a
full-color sensor, such as a digital camera, or color scanner. Until just a few years ago, most digital color
image processing was done at the pseudo- or reduced-color level. However, because color sensors and
processing hardware have become available at reasonable prices, full-color image processing techniques
are now used in a broad range of applications. In the discussions that follow, it will become evident that
some of the grayscale methods covered in previous chapters are applicable also to color images.
399
vtucircle.com
Although the process employed by the human brain in perceiving and interpreting
color is a physiopsychological phenomenon that is not fully understood, 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 light is not white, but consists instead 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 (see Fig. 6.2), no color in the spec-
trum ends abruptly; 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 visible
wavelengths appears white to the observer. However, a body that favors reflectance
in a limited range of the visible spectrum exhibits some shades of color. For example,
green objects reflect light with wavelengths primarily in the 500 to 570 nm range,
while absorbing most of the energy at other wavelengths.
Characterization of light is central to the science of color. If the light is achro-
matic (void of color), its only attribute is its intensity, or amount. Achromatic light
is what you see on movie films made before the 1930s. As defined in Chapter 2, and
used numerous times since, the term gray (or intensity) level refers to a scalar mea-
sure of intensity that ranges from black, to grays, and finally to white.
Chromatic light spans the electromagnetic spectrum from approximately 400
to 700 nm. Three basic quantities used to describe the quality of a chromatic light
source are: radiance, luminance, and brightness. Radiance is the total amount of
energy that flows from the light source, and it is usually measured in watts (W).
Luminance, measured in lumens (lm), is a measure of the amount of energy that
an observer perceives from a light source. For example, light emitted from a source
operating in the far infrared region of the spectrum could have significant energy
(radiance), but an observer would hardly perceive it; its luminance would be almost
zero. Finally, brightness is a subjective descriptor that is practically impossible to
measure. It embodies the achromatic notion of intensity, and is one of the key fac-
tors in describing color sensation.
FIGURE 6.1
Color spectrum
seen by passing
white light through
a prism.
(Courtesy of the
General Electric
Co., Lighting
Division.)
vtucircle.com
FIGURE 6.2
Wavelengths compris-
ing the visible range
of the electromagnetic
spectrum. (Courtesy of
the General Electric
Co., Lighting Division.)
As noted in Section 2.1, cones are the sensors in the eye responsible for color
vision. Detailed experimental evidence has established that the 6 to 7 million cones in
the human eye can be divided into three principal sensing categories, 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. How-
ever, 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.
Because of these absorption characteristics, the human eye sees colors 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 Commission on Illumination) designated in 1931 the
following specific wavelength values to the three primary colors: blue = 435.8 nm,
green = 546.1 nm, and red = 700 nm. This standard was set before results such as
those in Fig. 6.3 became available in 1965. Thus, the CIE standards correspond only
approximately with experimental data. It is important to keep in mind that defining
three specific primary color wavelengths for the purpose of standardization does
Purplish blue
Blue
Blue green
Green
Yellowish green
Yellow
Orange
Reddish orange
Red
vtucircle.com
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 various 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 primary colors.
The primary colors can be added together 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 illustrated in Fig. 6.4(a), which
shows also the three primary colors and their combinations to produce the second-
ary colors of light.
Differentiating between the primary colors of light and the primary colors of pig-
ments 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 transmits the other two.
Therefore, the primary colors of pigments are magenta, cyan, and yellow, and the
In practice, pigments secondary colors are red, green, and blue. These colors are shown in Fig. 6.4(b). A
seldom are pure. This proper combination of the three pigment primaries, or a secondary with its opposite
results in a muddy brown
instead of black when primary, produces black.
primaries, or primaries Color television reception is an example of the additive nature of light colors.
and secondaries, are
combined. We will The interior of CRT (cathode ray tube) color TV screens used well into the 1990s is
discuss this issue in composed of a large array of triangular dot patterns of electron-sensitive phosphor.
Section 6.2
When excited, each dot in a triad produces light in one of the primary colors. The
a
b
FIGURE 6.4
Primary and
secondary colors
of light and
pigments.
(Courtesy of the
General Electric
Co., Lighting
Division.)
vtucircle.com
X
x= (6-1)
X +Y + Z
Y
y= (6-2)
X +Y + Z
and
Z
z= (6-3)
X +Y + Z
vtucircle.com
vtucircle.com
FIGURE 6.5
The CIE
chromaticity
diagram.
(Courtesy of the
General Electric
Co., Lighting
Division.)
that of displaying colors on a monitor, which is based on the addition of three highly
controllable light primaries.
The purpose of a color model (also called a color space or color system) is to facilitate the
specification of colors in some standard way. In essence, a color model is a specification
of (1) a coordinate system, and (2) a subspace within that system, such that each color in
the model is represented by a single point contained in that subspace.
Most color models in use today are oriented either toward hardware (such as for
color monitors and printers) or toward applications, where color manipulation is
a goal (the creation of color graphics for animation is an example of the latter). In
terms of digital image processing, the hardware-oriented models most commonly
used in practice are the RGB (red, green, blue) model for color monitors and a
vtucircle.com
FIGURE 6.6 .9
Illustrative color
gamut of color 520
monitors
(triangle) and .8 530
color printing
510 540
devices (shaded
G
region).
.7 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
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, satura-
tion, intensity) model, which corresponds closely with the way humans describe and
interpret color. The HSI model also has the advantage 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.
This is a reflection of 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, sim-
ply because they are interesting and useful. However, keeping to the task at hand,
we focus attention on a few models that are representative of those used in image
processing. Having mastered the material in this chapter, you will have no difficulty
in understanding additional color models in use today.
vtucircle.com
FIGURE 6.7 B
Schematic of the
RGB color cube.
Points along the
(0, 0, 1)
main diagonal Blue Cyan
have gray values,
from black at the
origin to white at Magenta
White
point (1, 1, 1).
Grayscale (0, 1, 0)
Black G
Green
(1, 0, 0)
Red Yellow
vtucircle.com
numbers representable by the number bits in the images. If, as above, the primary
images are 8-bit images, the limits of the cube along each axis becomes [0, 255].
Then, for example, white would be at point [ 255, 255, 255] in the cube.
EXAMPLE 6.1 : Generating a cross-section of the RGB color cube and its thee hidden planes.
The cube in Fig. 6.8 is a solid, composed of the (2 8 )3 colors mentioned in the preceding paragraph. A
useful way to view these colors is to generate color planes (faces or cross sections of the cube). This is
done by fixing one of the three colors and allowing the other two to vary. For instance, a cross-sectional
plane through the center of the cube and parallel to the GB-plane in Fig. 6.8 is the plane (127, G, B) for
G, B = 0, 1, 2,…, 255. Figure 6.9(a) shows that an image of this cross-sectional plane is generated by feed-
ing the three individual component images into a color monitor. In the component images, 0 represents
black and 255 represents white. Observe that each component image into the monitor is a grayscale
image. The monitor does the job of combining the intensities of these images to generate an RGB image.
Figure 6.9(b) shows the three hidden surface planes of the cube in Fig. 6.8, generated in a similar manner.
Acquiring a color image is the process shown in Fig. 6.9(a) in reverse. A color image can be acquired
by using three filters, 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 inten-
sity is proportional to the response of that filter. Repeating this process with each filter produces three
monochrome images 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 as in Fig. 6.9(a) would yield an RGB color rendition of the original color scene.
vtucircle.com
a
b
Red
FIGURE 6.9
(a) Generating
the RGB image of
the cross-sectional
color plane
(127, G, B).
(b) The three Green RGB
hidden surface Color
monitor
planes in the color
cube of Fig. 6.8.
Blue
(R 0) (G 0) (B 0)
where the assumption is that all RGB color values have been normalized to the
range [0, 1]. Equation (6-5) demonstrates that light reflected from a 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. Equa-
tion (6-5) also reveals that RGB values can be obtained easily from a set of CMY
values by subtracting the individual CMY values from 1.
According to Fig. 6.4, equal amounts of the pigment primaries, cyan, magenta, and
yellow, should produce black. In practice, because C, M, and Y inks seldom are pure
colors, combining these colors for printing black produces instead a muddy-looking
brown. So, in order to produce true black (which is the predominant color in print-
ing), a fourth color, black, denoted by K, is added, giving rise to the CMYK color
model. The black is added in just the proportions needed to produce true black. Thus,
vtucircle.com
when publishers talk about “four-color printing,” they are referring to the three
CMY colors, plus a portion of black.
The conversion from CMY to CMYK begins by letting
K = min(C , M , Y ) (6-6)
If K = 1, then we have pure black, with no color contributions, from which it follows
that
C=0 (6-7)
M=0 (6-8)
The C, M, and Y on the
right side of Eqs. (6-6)-
(6-12) are in the CMY Y=0 (6-9)
color system. The C,
M, and Y on the left of Otherwise,
Eqs. (6-7)-(6-12) are in
the CMYK system. C = (C − K ) (1 − K ) (6-10)
M = (M − K ) (1 − K ) (6-11)
Y = (Y − K ) (1 − K ) (6-12)
where all values are assumed to be in the range [0, 1]. The conversions from CMYK
back to CMY are:
The C, M, Y, and K
on the right side of C = C * (1 − K ) + K (6-13)
Eqs. (6-13)-(6-15) are in
the CMYK color system.
The C, M, and Y on the M = M * (1 − K ) + K (6-14)
left of these equations
are in the CMY system.
Y = Y * (1 − Y ) + K (6-15)
As noted at the beginning of this section, all operations in the preceding equations
are performed on a pixel-by-pixel basis. Because we can use Eq. (6-5) to convert
both ways between CMY and RGB, we can use that equation as a “bridge” to con-
vert between RGB and CMYK, and vice versa.
It is important to keep in mind that all the conversions just presented to go
between RGB, CMY, and CMYK are based on the preceding relationships as a
group. There are many other ways to convert between these color models, so you
cannot mix approaches and expect to get meaningful results. Also, colors seen on
monitors generally appear much different when printed, unless these devices are
calibrated (see the discussion of a device-independent color model later in this
section). The same holds true in general for colors converted from one model to
another. However, our interest in this chapter is not on color fidelity; rather, we are
interested in using the properties of color models to facilitate image processing tasks,
such as region detection.
vtucircle.com
vtucircle.com
a b White White
FIGURE 6.10
Conceptual
relationships Magenta Magenta
between the RGB Cyan Yellow Cyan Yellow
and HSI color
models.
Black Black
the black and white points are contained in the plane tells us that the intensity axis
also is contained in the plane. Furthermore, we see that all points contained in the
plane segment defined by the intensity axis and the boundaries of the cube have the
same hue (cyan in this case). We could 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 colors. 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 required to
form the HSI space can be obtained from the RGB color cube. That is, we can con-
vert any RGB point to a corresponding point in the HSI color space by working out
the formulas that describe the reasoning outlined in the preceding discussion.
The key point regarding the cube arrangement in Fig. 6.10, 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 that 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 a hexagonal shape.
This can be visualized much more readily by looking at the cube straight down its
grayscale axis, as shown in Fig. 6.11(a). 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 is 120° also. Figure 6.11(b) shows the same hexagonal shape
and an arbitrary color point (shown as a dot). The hue of the point is determined 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 counterclockwise 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 important components of the HSI color
space are the vertical intensity axis, the length of the vector to a color point, and the
vtucircle.com
a Green Yellow
b c d
FIGURE 6.11
Hue and saturation Cyan White Red
in the HSI color
model. The dot is
any color point.
The angle from the
Blue Magenta
red axis gives the
hue. The length of Green Yellow Green Yellow
Green
the vector is the
saturation. The S S
intensity of all col- H H
ors in any of these Cyan Red Cyan S Yellow Cyan Red
planes is given by H
the position of the
plane on the verti-
cal intensity axis. Blue Magenta Blue Magenta Red Blue Magenta
angle this vector makes with the red axis. Therefore, it is not unusual to see the HSI
planes defined in terms of the hexagon just discussed, a triangle, or even a circle, as
Figs. 6.11(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.12 shows the HSI model based on color triangles, and on circles.
3
S=1 − ⎡ min ( R, G, B )⎤⎦ (6-18)
( R + G + B) ⎣
†
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-18) gives S = 0.
In addition, the conversion from HSI back to RGB in Eqs. (6-20) through (6-30) will give R = G = B = I , as
expected, because, when R = G = B, we are dealing with a grayscale image.
vtucircle.com
a White
b
FIGURE 6.12 I 0.75
The HSI color
model based on
(a) triangular, and I
(b) circular color
planes. The Green
triangles and Cyan Yellow
H
circles are
S
perpendicular to I 0.5 Blue Red
Magenta
the vertical
intensity axis.
Black
White
I 0.75
Green Yellow
I 0.5 Cyan H
S Red
Blue Magenta
Black
vtucircle.com
1
I= ( R + G + B) (6-19)
3
These equations assume 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
in Fig. 6.11. Hue can be normalized to the range [0, 1] by dividing by 360° all values
resulting from Eq. (6-16). The other two HSI components already are in this range if
the given RGB values are in the interval [0, 1].
The results in Eqs. (6-16) through (6-19) can be derived from the geometry in
Figs. 6.10 and 6.11. The derivation is tedious and would not add significantly to the
present discussion. You can find the proof for these equations (and for the equations
that follow for HSI to RGB conversion) in the Tutorials section of the book website.
RG sector ( 0° ≤ H < 120° ) : When H is in this sector, the RGB components are given
by the equations
B = I (1 − S ) (6-20)
⎡ S cos H ⎤
R = I ⎢1 +
( 60° − H ) ⎥⎦
(6-21)
⎣ cos
and
G = 3I − ( R + B ) (6-22)
GB sector (120° ≤ H < 240° ) : If the given value of H is in this sector, we first sub-
tract 120° from it:
H = H − 120° (6-23)
R = I (1 − S ) (6-24)
⎡ S cos H ⎤
G = I ⎢1 + ⎥ (6-25)
⎣ cos ( 60° − H ) ⎦
vtucircle.com
and
B = 3I − ( R + G ) (6-26)
BR sector ( 240° ≤ H ≤ 360° ) : Finally, if H is in this range, we subtract 240° from it:
H = H − 240° (6-27)
G = I (1 − S ) (6-28)
⎡ S cos H ⎤
B = I ⎢1 + ⎥ (6-29)
⎣ cos ( 60° − H ) ⎦
and
R = 3 I − (G + B ) (6-30)
EXAMPLE 6.2 : The HSI values corresponding to the image of the RGB color cube.
Figure 6.13 shows the hue, saturation, and intensity images for the RGB values in Fig. 6.8. Figure 6.13(a)
is the hue image. Its most distinguishing feature is the discontinuity in value along a 45° line in the front
(red) plane of 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 encountered in this path are yellow, green, cyan, blue, magenta, and back to red. According to
Fig. 6.11, the values of hue along this path should increase from 0° to 360° (i.e., from the lowest to highest
a b c
FIGURE 6.13 HSI components of the image in Fig. 6.8: (a) hue, (b) saturation, and (c) intensity images.
vtucircle.com
possible values of hue). This is precisely what Fig. 6.13(a) shows, because the lowest value is represented
as black and the highest value as white in the grayscale. In fact, the hue image was originally normalized
to the range [0, 1] and then scaled to 8 bits; that is, we converted it to the range [0, 255], for display.
The saturation image in Fig. 6.13(b) shows progressively darker values toward 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.13(c) is the average of the RGB values at the corresponding
pixel in Fig. 6.8.
a b
c d
FIGURE 6.14
(a) RGB image
and the
components of
its corresponding
HSI image:
(b) hue,
(c) saturation, and
(d) intensity.
vtucircle.com
a b
c d
FIGURE 6.15
(a)-(c) Modified
HSI component
images.
(d) Resulting RGB
image. (See Fig.
6.14 for the original
HSI images.)
the new H image, along with the unchanged S and I images, back to RGB using the
procedure explained in Eqs. (6-20) through (6-30). 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 simulta-
neously. For example, the image in Fig. 6.15(a) was obtained by changing to 0 the
pixels corresponding to the blue and green regions in Fig. 6.14(b). In Fig. 6.15(b),
we reduced by half the saturation of the cyan region in component image S from
Fig. 6.14(c). In Fig. 6.15(c), we reduced by half the intensity of the central white
region in the intensity image of Fig. 6.14(d). The result of converting this modified
HSI image back to RGB is shown in Fig. 6.15(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. Although these
results are simple, they clearly illustrate the power of the HSI color model in allow-
ing independent control over hue, saturation, and intensity. These are quantities with
which humans are quite familiar when describing colors.
vtucircle.com
⎛ Y ⎞
L* = 116 ⋅ h ⎜ − 16 (6-31)
⎝ YW ⎟⎠
⎡ ⎛ X ⎞ ⎛ Y ⎞⎤
a* = 500 ⎢ h ⎜ ⎟ − h⎜ ⎥ (6-32)
⎣ ⎝ XW ⎠ ⎝ YW ⎟⎠ ⎦
and
⎡ ⎛ Y ⎞ ⎛ Z ⎞⎤
b* = 200 ⎢ h ⎜ ⎟ − h⎜ ⎥ (6-33)
⎣ ⎝ YW ⎠ ⎝ ZW ⎟⎠ ⎦
where
⎧⎪ 3 q q > 0.008856
h (q) = ⎨ (6-34)
⎩⎪ 7 .787 q + 16 / 116 q ≤ 0.008856
vtucircle.com
vtucircle.com
(Black) 0 y
if f ( x, y) ∈ I k , let f ( x, y ) = ck (6-35)
where ck is the color associated with the kth intensity interval I k , defined by the
planes at l = k − 1 and l = k.
Figure 6.16 is not the only way to visualize the method just described. Figure 6.17
shows an equivalent approach. According to the mapping in this figure, any image
intensity below level li is assigned one color, and any level above is assigned another.
When more partitioning levels are used, the mapping function takes on a staircase
form.
FIGURE 6.17
An alternative c2
representation of
the intensity-
Color
slicing technique.
c1
0 li L1
Intensity levels
vtucircle.com
a b
FIGURE 6.18
(a) Grayscale
image of the
Picker Thyroid
Phantom.
(b) Result of
intensity slicing
using eight colors.
(Courtesy of Dr.
J. L. Blankenship,
Oak Ridge
National
Laboratory.)
clearly shows eight different regions of constant intensity, one for each of the colors used. By varying the
number of colors and the span of the intensity intervals, one can quickly determine the characteristics
of intensity variations in a grayscale image. This is particularly true in situations such as the one shown
here, in which the object of interest has uniform texture with intensity variations that are difficult to
analyze visually. This example also illustrates the comments made in Section 6.1 about the eye’s superior
capability for detecting different color shades.
In the preceding simple example, the grayscale was divided into intervals and a different color was
assigned to each, with no 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
meaningful and useful role when subdivision of the grayscale is based on physical characteristics of the
image. For instance, Fig. 6.19(a) shows an X-ray image of a weld (the broad, horizontal dark region)
containing several cracks and porosities (the bright streaks running horizontally through the middle of
the image). 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 system automatically imply a problem with the weld. If human visual
analysis is used to inspect welds (still a common procedure today), a simple color coding that assigns
a b
FIGURE 6.19
(a) X-ray image
of a weld.
(b) Result of color
coding. (Original
image courtesy of
X-TEK Systems,
Ltd.)
vtucircle.com
one color to level 255 and another to all other intensity levels can simplify the inspector’s job consider-
ably. Figure 6.19(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.19(b), instead of the form in
Fig. 6.19(a). In other words, if an 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 have to be inspected
on a routine basis.
vtucircle.com
a b
c d
FIGURE 6.20 (a) Grayscale image in which intensity (in the 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.21
Functional block Red
transformation fR (x, y)
diagram for
pseudocolor image
processing. Images
fR , fG ,and fB are
fed into the Green
corresponding red, f (x, y) fG (x, y)
transformation
green, and blue
inputs of an RGB
color monitor.
Blue
fB (x, y)
transformation
vtucircle.com
discussed in this section can be based on smooth, nonlinear functions, which gives
the technique considerable flexibility.
vtucircle.com
a b
FIGURE 6.23
Red
Transformation
functions used to
obtain the
pseudocolor
Color
images in Green
Fig. 6.22.
Blue
color assignments. Note that this mapping allows an observer to “see” through the explosives. The back-
ground mappings were about the same as those used for Fig. 6.22(b), producing almost identical color
assignments for the two pseudocolor images.
vtucircle.com
a b c
d e f
FIGURE 6.25 (a)–(d) Red (R), green (G), blue (B), and near-infrared (IR) components of a LANDSAT multispectral
image of the Washington, D.C. area. (e) RGB color composite image obtained using the IR, G, and B component
images. (f) RGB color composite image obtained using the R, IR, and B component images. (Original multispectral
images courtesy of NASA.)
the fourth is in the near infrared (IR) band (see Table 1.1 and Fig. 1.10). The latter band is responsive
to the biomass content of a scene, and we want to use this fact to create a composite RGB color image
in which vegetation is emphasized and the other components of the scene are displayed in more muted
tones.
Figure 6.25(e) is an RGB composite obtained by replacing the red image by infrared. As you see, veg-
etation shows as a bright red, and the other components of the scene, which had a weaker response in
the near-infrared band, show in pale shades of blue-green. Figure 6.25(f) is a similar image, but with the
green replaced by infrared. Here, vegetation shows in a bright green color, and the other components of
the scene show in purplish color shades, indicating that their major components are in the red and blue
bands. Although the last two images do not introduce any new physical information, these images are
much easier to interpret visually once it is known that the dominant component of the images are pixels
of areas heavily populated by vegetation.
The type of processing just illustrated uses the physical characteristics of a single band in a multi-
spectral image to emphasize areas of interest. The same approach can help visualize events of interest
vtucircle.com
a
b
FIGURE 6.26
(a) Pseudocolor
rendition of
Jupiter Moon Io.
(b) A close-up.
(Courtesy of
NASA.)
in complex images in which the events are beyond human visual sensing capabilities. Figure 6.26 is an
excellent illustration of this. These are images of the Jupiter moon Io, shown in pseudocolor by combin-
ing 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.26(b),
bright red depicts material newly ejected 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.
vtucircle.com
In this section, we begin the study of processing methods for full-color images. The
techniques developed in the sections that follow are illustrative of how full-color
images are handled for a variety of image processing tasks. Full-color image process-
ing approaches fall into two major categories. In the first category, we process each
grayscale component image individually, then form a composite color image from
the individually processed components. In the second category, we work with color
pixels directly. Because full-color images have at least three components, color pix-
els 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 = ⎢⎢cG ⎥⎥ = ⎢⎢G ⎥⎥ (6-36)
⎢⎣ cB ⎥⎦ ⎢⎣ B ⎥⎦
This equation indicates that the components of c are the RGB components of a
color image at a point. We take into account the fact that the colors of the pixels in
Although an RGB image an image are a function of spatial coordinates ( x, y) by using the notation
is composed of three
grayscale component
images, pixels in all three
images are registered
⎡ cR ( x, y ) ⎤ ⎡ R ( x, y ) ⎤
⎢ ⎥ ⎢ ⎥
spatially. That is, a single c ( x, y ) = ⎢cG ( x, y )⎥ = ⎢G ( x, y )⎥ (6-37)
pair of spatial
coordinates, (x, y), ⎢⎣ cB ( x, y ) ⎥⎦ ⎢⎣ B ( x, y ) ⎥⎦
addresses the same
pixel location in all three
images, as illustrated in
Fig. 6.27(b) below. For an image of size M × N , there are MN such vectors, c( x, y), for x = 0, 1, 2, … , M − 1
and y = 0, 1, 2, … , N − 1.
Equation (6-37) depicts a vector whose components are spatial variables 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 process-
ing techniques formulated 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 grayscale
image processing methods. However, the results of individual color component pro-
cessing are not always equivalent to direct processing in color vector space, in which
case we must use approaches for processing the elements of color points directly.
When these points have more than two components, we call them voxels. We use the
terms vectors, points, and voxels interchangeably when the meaning is clear that we
are referring to images composed of more than one 2-D image.
In order for per-component-image and vector-based processing to be equivalent,
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 vector (i.e., each
voxel) must be independent of the other components. As an illustration, Fig. 6.27
shows spatial neighborhood processing of grayscale and full-color images. Suppose
vtucircle.com
a b
FIGURE 6.27
Spatial
neighborhoods Pixel Voxel
for grayscale
and RGB color (x, y)
(x, y)
images. Observe
2-D neighborhood 3-D neighborhood
in (b) that a single
pair of spatial
coordinates, ( x, y),
addresses the
same spatial
location in all
three images. Grayscale image RGB color image
that the process is neighborhood averaging. In Fig. 6.27(a), averaging would be done
by summing the intensities of all the pixels in the 2-D neighborhood, then dividing
the result by the total number of pixels in the neighborhood. In Fig. 6.27(b), averag-
ing would be done by summing all the voxels in the 3-D neighborhood, then divid-
ing the result by the total number of voxels in the neighborhood. Each of the three
component of the average voxel is the sum of the pixels in the single image neigh-
borhood centered on that location. But the same result would be obtained if the
averaging were done on the pixels of each image, independently, and then the sum of
the three values were added for each. Thus, spatial neighborhood averaging can be
carried out on a per-component-image or directly on RGB image voxels. The results
would be the same. In the following sections we develop methods for which the per-
component-image approach is suitable, and methods for which it is not.
FORMULATION
As with the intensity transformation techniques of Chapter 3, we model color trans-
formations for multispectral images using the general expression
si = Ti ( ri ) i = 1, 2,…, n (6-38)
where n is the total number of component images, ri are the intensity values of the
input component images, si are the spatially corresponding intensities in the output
component images, and Ti are a set of transformation or color mapping functions
that operate on ri to produce si . Equation (6-38) is applied individually to all pixels
in the input image. For example, in the case of RGB color images, n = 3, r1 , r2 , r3 are
the intensities values at a point in the input components images, and s1 , s2 , s3 are
vtucircle.com
the corresponding transformed pixels in the output image. The fact that i is also a
subscript on T means that, in principle, we can implement a different transformation
for each input component image.
As an illustration, the first row of Fig. 6.28 shows a full color CMYK image of a
simple scene, and the second row shows its four component images, all normalized
to the range [0, 1]. We see that the strawberries are composed of large amounts of
magenta and yellow because the images corresponding to these two CMYK compo-
nents are the brightest. Black is used sparingly and is generally confined to the cof-
fee and shadows within the bowl of strawberries. The fourth row shows the equiva-
lent RGB images obtained from the CMYK images using Eqs. (6-13)-(6-15). Here
we see that the strawberries contain a large amount of red and very little (although
some) green and blue. From the RGB images, we obtained the CMY images in
the third row using Eq. (6-5). Note that these CMY images are slightly different
from the CMY images in the row above them. This is because the CMY images
in these two systems are different as a result of using K in one of them. The last
row of Fig. 6.28 shows the HSI components, obtained from the RGB images using
Eqs. (6-16)-(6-19). As expected, the intensity (I) component is a grayscale rendition
of the full-color original. The saturation image (S) is as expected also. The strawber-
ries are relatively pure in color; as a result, they show the highest saturation (least
dilution by white light) values of any of the other elements of the image. Finally,
we note some difficulty in interpreting the values of the hue (H) component image.
The problem is that (1) there is a discontinuity in the HSI model where 0° and 360°
meet [see Fig. 6.13(a)], 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 levels to represent
a single color—red.
We can apply Eq. (6-38) to any of the color-space component images in Fig. 6.28.
In theory, any transformation can be performed in any color model. In practice, how-
ever, some operations are better suited to specific models. For a given transformation,
the effects of converting between representations must be factored into the decision
regarding the color space in which to implement it. For example, suppose that we
wish to modify the intensity of the full-color image in the first row of Fig. 6.28 by a
constant value, k in the range [0, 1]. In the HSI color space we need to modify only
the intensity component image:
s3 = kr3 (6-39)
and we let s1 = r1 and s2 = r2 . In terms of our earlier discussion note that we are using
two different transformation functions: T1 and T2 are identity transformations, and
T3 is a constant transformation.
In the RGB color space we need to modify all three components by the same
constant transformation:
si = kri i = 1, 2, 3 (6-40)
vtucircle.com
FIGURE 6.28 A full-color image and its various color-space components. (Original image courtesy of MedData Interactive.)
vtucircle.com
The CMY space requires a similar set of linear transformations (see Problem 6.16):
si = kri + (1 − k ) i = 1, 2, 3 (6-41)
Similarly, the transformations required to change the intensity of the CMYK image
is given by
⎧ri i = 1, 2, 3
si = ⎨ (6-42)
⎩kri + (1 − k ) i=4
This equation tells us that to change the intensity of a CMYK image, we only change
the fourth (K) component.
Figure 6.29(b) shows the result of applying the transformations in Eqs. (6-39)
through (6-42) to the full-color image of Fig. 6.28, using k = 0.7. The mapping func-
tions themselves are shown graphically in Figs. 6.29(c) through (h). Note that the
mapping function for CMYK consist of two parts, as do the functions for HSI; one of
the transformations handles one component, and the other does the rest. Although
1 1 1 1
k k
1k
R,G,B C,M,Y K C,M,Y
H,S I H,S
0 1 0 1 0 1 0 1 0 1 0 1
a b
c d e f g h
FIGURE 6.29 Adjusting the intensity of an image using color transformations. (a) Original image. (b) Result of decreas-
ing its intensity by 30% (i.e., letting k = 0.7). (c) The required RGB mapping function. (d)–(e) The required CMYK
mapping functions. (f) The required CMY mapping function. (g)–(h) The required HSI mapping functions. (Origi-
nal image courtesy of MedData Interactive.)
vtucircle.com
we used several different transformations, the net result of changing the intensity of
the color by a constant value was the same for all.
It is important to note that each transformation defined in Eqs. (6-39) through
(6-42) depends only on one component within its color space. For example, the red
output component, s1 , in Eq. (6-40) is independent of the green (r2 ) and blue (r3 )
inputs; it depends only on the red (r1 ) input. Transformations of this type are among
the simplest and most frequently used color processing tools. They can be carried
out on a per-color-component basis, as mentioned at the beginning of our discussion.
In the remainder of this section, we will examine several such transformations and
discuss a case in which the component transformation functions are dependent on
all the color components of the input image and, therefore, cannot be done on an
individual color-component basis.
COLOR COMPLEMENTS
The color circle (also called the color wheel) shown in Fig. 6.30 originated with Sir
Isaac Newton, who in the seventeenth century created its first form by joining the
ends of the color spectrum. The color circle is a visual representation of colors that
are arranged according to the chromatic relationship between them. The circle is
formed by placing the primary colors equidistant from each other. Then, the sec-
ondary colors are placed between the primaries, also in an equidistant arrangement.
The net result is that hues directly opposite one another on the color circle are com-
plements. Our interest in complements stems from the fact that they are analogous
to the grayscale negatives we studied in Section 3.2. As in the grayscale case, color
complements are useful for enhancing detail that is embedded in dark regions of
a color image—particularly when the regions are dominant in size. The following
example illustrates some of these concepts.
nts
Cyan pleme Red
Com
Green Yellow
vtucircle.com
a b 1 1
c d
FIGURE 6.31
Color
complement
transformations.
(a) Original 0 R,G,B 0 H
image. 1 1
(b) Complement 1 1
transformation
functions.
(c) Complement
of (a) based on
the RGB mapping
functions. (d) An
0 S 0 I
approximation of
the RGB 1 1
complement using
HSI
transformations.
vtucircle.com
COLOR SLICING
Highlighting a specific range of colors in an image is useful for separating objects
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 defined by the
colors as a mask for further processing. The most straightforward approach is to
extend the intensity slicing techniques of Section 3.2. However, because a color pixel
is an n-dimensional quantity, the resulting color transformation functions are more
complicated than their grayscale counterparts in Fig. 3.11. In fact, the required trans-
formations are more complex than the color component transforms considered thus
far. This is because all practical color-slicing approaches require each pixel’s trans-
formed 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 into a nonprominent neutral color. If the colors of interest
are enclosed by a cube (or hypercube for n > 3) of width W and centered at a pro-
totypical (e.g., average) color with components ( a1 , a2 ,…, an ) , the necessary set of
transformations are given by
⎧ ⎡ W⎤
⎪0.5 if ⎢ rj − a j > 2 ⎥
si = ⎨ ⎣ ⎦any 1≤ j ≤ n (6-43)
⎪r otherwise i = 1, 2,…, n
⎩ i
These transformations highlight the colors around the prototype by forcing all
other colors to the midpoint of the reference color space (this is an arbitrarily cho-
sen 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-43) becomes
⎧ n
∑ (rj − aj )
2
⎪0.5 if > R02
si = ⎨ j =1 i = 1, 2,…, n (6-44)
⎪r otherwise
⎩ i
Here, R0 is the radius of the enclosing sphere (or hypersphere for n > 3) and
( a1 , a2 ,…, an ) are the components of its center (i.e., the prototypical color). Other
useful variations of Eqs. (6-43) and (6-44) include implementing multiple color pro-
totypes and reducing the intensity of the colors outside the region of interest—rath-
er than setting them to a neutral constant.
vtucircle.com
a b
FIGURE 6.32 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).
does not completely enclose a cube of width 0.2549, but it is not small enough to be completely enclosed
by the cube either. In Section 6.7, and later in Chapter 10, you will learn more advanced techniques for
using color and other multispectral information to extract objects from their background.
vtucircle.com
R,G,B
Flat Corrected 0 1
R,G,B
Light Corrected 0 1
R,G,B
Dark Corrected 0 1
FIGURE 6.33 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.
vtucircle.com
[see Fig. 3.2(a)]. Its midpoint is anchored so that highlight and shadow areas can be lightened and dark-
ened, respectively. (The inverse of this curve can be used to correct excessive contrast.) The transforma-
tions in the second and third rows of the figure 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 themselves are displayed and manipulated as
continuous quantities—typically constructed from piecewise linear or higher order (for smoother map-
pings) polynomials. Note that the keys of the images in Fig. 6.33 are visually evident; they could also be
determined using the histograms of the images’ color components.
vtucircle.com
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.34 Color balancing a CMYK image.
vtucircle.com
a b 1 1
c d
FIGURE 6.35
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
vtucircle.com
adjustment is common when working with the intensity component in HSI space because changes in
intensity usually affect the relative appearance of colors in an image.
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 character-
istics of the surrounding pixels. In this section, the basics of this type of neighbor-
hood processing will be illustrated within the context of color image smoothing and
sharpening.
1
c ( x, y ) = ∑ c ( s, t ) (6-45)
K ( s, t ) ∈Sxy
It follows from Eq. (6-37) and the properties of vector addition that
⎡1 ⎤
⎢ ∑ R ( s, t ) ⎥
⎢ K ( s, t )∈Sxy ⎥
⎢ ⎥
1
c ( x, y ) = ⎢ ∑ G ( s, t )⎥ (6-46)
⎢ K ( s, t )∈Sxy ⎥
⎢ ⎥
⎢1
⎢K ∑ B ( ) ⎥⎥
s, t
⎣ ( s, t )∈Sxy ⎦
We recognize the components of this vector as the scalar images that would be
obtained by independently smoothing each plane of the original RGB image using
conventional grayscale 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.
vtucircle.com
a b
c d
FIGURE 6.36
(a) RGB image.
(b) Red
component image.
(c)Green
component.
(d) Blue
component.
vtucircle.com
a b c
FIGURE 6.37 HSI components of the RGB color image in Fig. 6.36(a). (a) Hue. (b) Saturation. (c) Intensity.
that it is similar to Fig. 6.38(a), but, as you can see from the difference image in Fig. 6.38(c), the two
smoothed images are not identical. This is because in Fig. 6.38(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.38(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 kernel size.
a b c
FIGURE 6.38 Image smoothing with a 5 × 5 averaging kernel. (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.
vtucircle.com
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-37)
is
⎡ ∇ 2 R ( x, y ) ⎤
⎢ ⎥
∇ 2 ⎡⎣c ( x, y )⎤⎦ = ⎢∇ 2G ( x, y )⎥ (6-47)
⎢ 2 ⎥
⎢⎣ ∇ B ( 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.39 Image sharpening using the Laplacian. (a) Result of processing each RGB channel. (b) Result of process-
ing the HSI intensity component and converting to RGB. (c) Difference between the two results.
vtucircle.com
vtucircle.com
a b
c d FIGURE 6.40 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) His-
g h togram of (f). (h) Segmentation of red components from (a).
vtucircle.com
a b c B B B
FIGURE 6.41
Three approaches
for enclosing data
regions for RGB
vector
segmentation.
G G G
R R R
D(z, a) =储 z − a 储
1
= ⎡( z − a ) ( z − a ) ⎤ 2
T
(6-48)
⎣ ⎦
1
( )
= ⎡ ( z R − a R ) + ( zG − a G ) + z B − a B ⎤
2 2 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 illustrated
in Fig. 6.41(a). Points contained within the sphere satisfy the specified color crite-
rion; 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.
This equation is called
the Mahalanobis dis-
A useful generalization of Eq. (6-48) is a distance measure of the form
tance. You are seeing it
1
D ( z, a ) = ⎡( z − a ) C−1 ( z − a )⎤
used here for multivariate T 2
(6-49)
thresholding (see
Section 10.3 regarding
⎣ ⎦
thresholding).
where C is the covariance matrix (see Section 11.5) of the samples chosen to be
representative of the color range we wish to segment. The locus of points such that
D ( z, a ) ≤ D0 describes a solid 3-D elliptical body [Fig. 6.41(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-49) reduces to Eq. (6-48). Segmenta-
tion is as described in the preceding paragraph.
Because distances are positive and monotonic, we can work with the distance
squared instead, thus avoiding square root computations. However, implementing
Eq. (6-48) or (6-49) 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.41(c). In this approach, the box is centered on a, and its dimen-
sions along each of the color axes is chosen proportional to the standard deviation
of the samples along each of the axis. We use the sample data to compute the stan-
dard deviations, which are the parameters used for segmentation with this approach.
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, determin-
ing whether a color point is inside or outside a box is much simpler computationally
vtucircle.com
when compared to a spherical or elliptical enclosure. Note that the preceding discus-
sion is a generalization of the color-slicing method introduced in Section 6.5.
a
b
FIGURE 6.42
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.40(h).
vtucircle.com
of the sample points. Then the dimensions of the box along the R-axis extended from ( aR − 1.25s R ) to
( aR + 1.25sR ) , where aR is the red component of average vector a. Figure 6.42(b) shows the result of
coding each point in the color image as white if it was on the surface or inside the box, and as black
otherwise. Note how the segmented region was generalized from the color samples enclosed by the
rectangle. In fact, by comparing Figs. 6.42(b) and 6.40(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. This result is not unexpected,
because in the RGB space we used three color variables, as opposed to just one in the HSI space.
vtucircle.com
a b c d
e f g h
FIGURE 6.43 (a)–(c) R, G, and B component images, and (d) resulting RGB color image. (e)–(g) R, G, and B compo-
nent images, and (h) resulting RGB color image.
∂R ∂G ∂B
u= r+ g+ b (6-50)
∂x ∂x ∂x
and
∂R ∂G ∂B
v= r+ g+ b (6-51)
∂y ∂y ∂y
Let the quantities g xx , g yy , and g xy be defined in terms of the dot product of these
vectors, as follows:
2 2 2
∂R ∂G ∂B
g xx = u ⋅ u = uT u = + + (6-52)
∂x ∂x ∂x
2 2 2
∂R ∂G ∂B
g yy = v ⋅ v = vT v = + + (6-53)
∂y ∂y ∂y
and
∂R ∂R ∂G ∂G ∂B ∂B
g xy = u ⋅ v = uT v = + + (6-54)
∂x ∂y ∂x ∂y ∂x ∂y
vtucircle.com
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 maxi-
mum rate of change of c( x, y) is given by the angle
1 ⎡ 2 g xy ⎤
u ( x, y ) = tan −1 ⎢ ⎥ (6-55)
2 ⎢⎣ g xx − g yy ⎥⎦
and that the value of the rate of change at ( x, y) in the direction of u( x, y) is given by
1
⎧1 ⎫2
( ) ( )
Fu ( x, y ) = ⎨ ⎡⎣ g xx + g yy + g xx − g yy cos 2u ( x, y ) + 2 g xy sin 2u ( x, y )⎤⎦ ⎬
⎩2 ⎭
(6-56)
The noise models discussed in Section 5.2 are applicable to color images. Usually, 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 malfunction. However, different noise
levels are more likely caused by differences in the relative strength of illumination
available to each of the color channels. For example, use of a red filter in a CCD
camera will reduce the strength of illumination detected by the red sensing elements.
CCD sensors are noisier at lower levels of illumination, so the resulting red com-
vtucircle.com
a b
c d
FIGURE 6.44
(a) RGB image.
(b) Gradient
computed in RGB
color vector space.
(c) Gradient
image formed by
the elementwise
sum of three
individual
gradient images,
each computed
using the Sobel
operators.
(d) Difference
between (b) and
(c).
a b c
FIGURE 6.45 Component gradient images of the color image in Fig. 6.44. (a) Red component, (b) green component,
and (c) blue component. These three images were added and scaled to produce the image in Fig. 6.44(c).
vtucircle.com
ponent of an RGB image would tend to be noisier than the other two component
images in this situation.
EXAMPLE 6.17 : Illustration of the effects of noise when converting noisy RGB images to HSI.
In this example, we take a brief look at noise in color images and how noise carries over when convert-
ing from one color model to another. Figures 6.46(a) through (c) show the three color planes of an RGB
image corrupted by additive Gaussian noise, and Fig. 6.46(d) is the composite RGB image. Note that
fine grain noise such as this tends to be less visually noticeable in a color image than it is in a grayscale
image. Figures 6.47(a) through (c) show the result of converting the RGB image in Fig. 6.46(d) to HSI.
Compare these results with the HSI components of the original image (see Fig. 6.37) and note how sig-
nificantly degraded the hue and saturation components of the noisy image are. This was caused by the
nonlinearity of the cos and min operations in Eqs. (6-17) and (6-18), respectively. On the other hand,
the intensity component in Fig. 6.47(c) is slightly smoother than any of the three noisy RGB component
images. This is because the intensity image is the average of the RGB images, as indicated in Eq. (6-19).
(Recall the discussion in Section 2.6 regarding the fact that image averaging reduces random noise.)
a b
c d
FIGURE 6.46
(a)–(c) Red,
green, and blue
8-bit component
images
corrupted by
additive
Gaussian noise of
mean 0 and stan-
dard deviation of
28 intensity levels.
(d) Resulting
RGB image.
[Compare (d)
with Fig. 6.44(a).]
vtucircle.com
a b c
FIGURE 6.47 HSI components of the noisy color image in Fig. 6.46(d). (a) Hue. (b) Saturation. (c) Intensity.
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.48 shows an example. Figure 6.48(a) shows an RGB image whose
green component image is corrupted by salt-and-pepper noise, with a probability of either salt or pepper
equal to 0.05. The HSI component images in Figs. 6.48(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 computa-
tion of the HSI components makes use of all RGB components, as discussed in Section 6.2.
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 space, depending
on the process. For example, noise reduction by using an averaging filter is the pro-
cess discussed in Section 6.6, which we know gives the same result in vector space as
it does if the component images are processed independently. However, other filters
cannot be formulated in this manner. Examples include the class of order statistics
filters discussed in Section 5.3. 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 vectors. A discussion of
vector ordering is beyond the scope of our discussion here, but the book by Platani-
otis and Venetsanopoulos [2000] is a good reference on vector ordering and some of
the filters based on the concept of ordering.
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
vtucircle.com