Color Image
Processing
• Using 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, compared to
only about two dozen shades of gray.
• The latter factor is particularly 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 assigning color(s) to a
particular 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.
Color Fundamentals
• 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. 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. 2), no color in the spectrum ends
abruptly; rather, each color blends smoothly into the next.
• 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.
• The primary colors(R G B) 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.
• The characteristics generally used to distinguish one color from another
are brightness, hue, and saturation.
• 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.
• 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 tristimulus values, and are denoted, X, Y, and Z,
respectively.
• A color is then specified by its trichromatic coefficients, defined as
• Another approach for specifying colors is to use the CIE chromaticity
diagram (see Fig. ), 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
obtained from Eq. z =1 − (x+ y).
• The point marked green in Fig. , for example, has approximately 62%
green and 25% red content. It follows from Eq. that the composition of
blue is approximately 13%.
COLOR MODELS
• 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 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 advantage that it decouples the color and
gray-scale information in an image, making it suitable for many of the
gray-scale techniques.
THE RGB COLOR MODEL
• In the RGB model, each color appears in its primary spectral
components of red, green, and blue.
• The RGB color model is an additive color model used in digital
imaging, computer displays, and electronic screens.
• This model is based on a Cartesian coordinate system.
• The color subspace of interest is the cube shown in above fig.
• 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.
• 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)] has 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 possible colors in a 24-bit RGB image is
(28)3 = 16 777 216.
•The values of RGB range from 0 to 255 in 8-bit systems (e.g., (255, 0, 0) represents pure red).
•When all three colors are at full intensity (255, 255, 255), the result is white.
•When all three colors are at zero intensity (0, 0, 0), the result is black.
Mixing two primary colors in equal intensity creates secondary
colors:
•Red + Green = Yellow (255, 255, 0)
•Green + Blue = Cyan (0, 255,
255)
•Blue + Red = Magenta (255, 0,
255)
Limitations of RGB
•RGB is device-dependent (colors may appear different on different screens).
•It is not ideal for printing because printers use the CMYK (Cyan, Magenta, Yellow, and
Black) color model.
THE CMY AND CMYK COLOR MODELS
• Cyan, Magenta, and Yellow are the secondary colors of light or,
alternatively, they are the primary colors of pigments.
• The CMY color model is a subtractive color model used in color
printing and photography. It represents colors using Cyan (C),
Magenta (M), and Yellow (Y) as the primary colors.
• 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.
•The CMY model works by subtracting light from a white background (such as paper).
•Each color component absorbs (subtracts) certain wavelengths of light:
•Cyan absorbs red light.
•Magenta absorbs green light.
•Yellow absorbs blue light.
•By combining these colors, different hues are produced:
•Cyan + Magenta = Blue
•Magenta + Yellow = Red
•Yellow + Cyan = Green
•When all three colors are mixed at full intensity, they ideally produce black.
• RGB to CMY conversion is performed using the simple operation.
• 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.
• Equation (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.
• 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 printing), 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.
The conversion from CMY to CMYK begins by letting
THE HSI COLOR MODEL
• When humans view a color object, we describe it by its hue, saturation,
and brightness.
• Hue is a color attribute that describes a pure color (pure yellow, orange,
or red), whereas saturation 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
measure.
• It embodies the achromatic notion of intensity and is one of the key
factors in describing color sensation.
• We do know that intensity (gray level) is a most useful descriptor of
achromatic images
• The HSI (hue, saturation, intensity) color model, decouples the
intensity component from the color-carrying information (hue and
saturation) in a color image.
• The HSI model is a useful tool for developing image processing
algorithms based on color descriptions that are natural and intuitive to
humans.
• 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.
• 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 intensity component is obtained from the equation
• Hue is given in degrees (0° to 360°), and we classify it into three
sectors:
• 0° ≤ H < 120° → Use RG sector (Red-Green)
• 120° ≤ H < 240° → Use GB sector (Green-Blue)
• 240° ≤ H < 360° → Use BR sector (Blue-Red)
Converting Colors from HSI to RGB
Given values of HSI in the interval [0 , 1] we now want to find the corresponding RGB
values in the same range.
• A device-independent color model is a color representation system
that is not tied to a specific output device (like a monitor, printer, or
scanner).
• This means the color model describes colors in a way that is
consistent regardless of the hardware used to display or reproduce
them.
• The idea behind device-independent color models is to provide a way
to define and communicate color without being affected by the
specific capabilities, limitations, or settings of a particular device.
• This is important for ensuring consistency across different devices and
for tasks such as digital imaging, design, and printing.
• Features of Device-Independent Color Models:
• Color Space: The model defines colors within a well-structured "color
space" that can be translated to various devices.
• Human Perception-Based: It typically reflects how humans perceive
color, rather than how a specific device renders it. This allows the
color model to remain consistent across different devices.
• Color Transformations: Device-independent models often include a
method to convert the color information to the color space of a
particular device, ensuring accurate color reproduction.
• Examples of Device-Independent Color Models:
• CIELAB (CIE 1976 Lab):*
• This is one of the most widely known and used device-independent color
models.
• It is based on human vision and is designed to be device-independent.
• The model uses three components:
• L* (lightness), ranging from 0 to 100.
• a* (green to red), with negative values being green and positive values being red.
• b* (blue to yellow), with negative values being blue and positive values being yellow.
• CIELAB is often used in color management and digital imaging for color
correction.
and Xw, Yw and Zw are reference white tristimulus values