Digital Image
Processing
Lecture 6
Color Image Processing
Color Image Processing - Introduction
• The use of color in image processing is motivated by two principal
factors.
1. Color is a powerful descriptor that often simplifies object identification and
extraction from a scene.
2. Humans can discern thousands of color shades and intensities
• This second factor is particularly important in manual (i.e., when
performed by humans) image analysis.
Color Image Processing - Introduction
• Color image processing is divided into two major areas
• full-color
• Images are acquired with a full-color sensor, such as a color TV camera or color scanner
• Pseudocolor
• assigning a color to a particular monochrome intensity or range of intensities
• Until relatively recently, most digital color image processing was done at the
pseudocolor level.
• However, in the past decade, color sensors and hardware for processing color
images have become available at reasonable prices. The result is that full-color
image processing techniques are now used in a broad range of applications
Color Image Processing
Visible Spectrum
Primary and Secondary
Colors of Light
Color Models
• The purpose of a color model (also called color space or color system)
is to facilitate 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 manipulation is a goal (such as in the creation of color graphics
for animation).
Color Models
• 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
• 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 developed in this course
Acquiring a color image
• 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 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 intensity 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.
• 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.
Safe RGB
• 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.
• Given the variety of systems in current use, it is of considerable
interest to have a subset of colors that are likely to be reproduced
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
Safe RGB
• Colors that are likely to be reproduced
• Set of safe RGB colors
• Set of all-system-safe colors
• Safe Web colors
• Safe browser colors
Safe RGB
• Assuming that 256 is the minimum number of colors that can be reproduced
• 40 of them are said to be processed differently in different operating systems
• Left with 216 that are common to most of the systems
• Standard for safe colors
• Each value can only be
• 0, 51, 102, 153, 204, 255
• 00, 33, 66, 99, CC, FF
• 63 = 216 (An array of size 6×6×6 )
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.
A de facto standard is a custom or convention that has achieved a dominant position by public acceptance or market forces
CMY and CMYK color models
• Cyan, Magenta, and Yellow are the secondary colors of light or,
alternatively, the primary colors of pigments.
• When a surface coated with cyan pigment is illuminated with white
light, no red light is reflected from the surface
• Same is the case for Magenta and Yellow for Green and Blue
respectively
CMY and CMYK color models
• 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
CMY and CMYK color models
• Equal amounts of the pigment primaries, cyan, magenta, 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.
HSI
• 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, A human does not refer to the color of an automobile by
giving the percentage of each of the primaries composing its color.
• Furthermore, humans 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, they describe it by its hue,
saturation, and brightness (intensity).
HSI
• Hue is a color attribute that describes a pure color (pure yellow, orange, or
red)
• 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
monochromatic images. This quantity definitely is measurable and easily
interpretable.
HSI
• HSI color model, decouples the intensity component from the color-
carrying information (hue and saturation) in a color image.
HSI
• 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, A human does not refer to the color of an automobile by
giving the percentage of each of the primaries composing its color.
• Furthermore, humans 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, they describe it by its hue,
saturation, and brightness (intensity).
HSI
• Hue is a color attribute that describes a pure color (pure yellow, orange, or
red)
• Saturation gives a measure of the degree to which a pure color is diluted by
white light / mixture of gray
• 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
monochromatic images. This quantity definitely is measurable and easily
interpretable.
HSI - Hue Wheel
• https://www.youtube.com/watch?v=0IIb0tnLIcU&t=932s
HUE
• The property of colors by which they can be perceived as ranging from red
through yellow, green, and blue, as determined by the dominant wavelength of
the light.
• Single Color Value no including brightness or saturation or grayishness.
• Usually measured in degrees
• Lowest level of frequency in light spectrum is red
• Goes on increasing with the wheel in clockwise direction with magenta at
maximum
• Pink is a fiction (Not even found in Rainbow)
HUE
• Normally the hue value is measured in degrees (from 0 – 360)
• To keep us within the limit of one byte that is maximum 255 we use the
convention of 240 as maximum value for ease of calculation
• Red is at 0 or 360 or 240 for new convention
• Green is at 120 degree or 80
• Blue is at 240 degree or 160
• For every 120 degree (or 80) there is a main color
• Degree measurement (0 – 360) is more suitable for modeling and
conceptual representation of the model
• 0-240 is used in Programming perspective or in computers
HSI Model
????
• What happen actually (Mathematically) to the image when you adjust
Hue in some software application (Photoshop) ??????
Saturation
• Purity of hue
• How true or how deep the color is
or how far the hue is from gray
or how mixed the hue is with gray (white or black or in between)
• High saturation means far away from gray (pure red)
• Low saturation means near to gray (grayish red)
• Saturation of a color increases as a function of distance from the
intensity axis.
• Saturation value of the points on the intensity axis is zero.
Intensity
• Center of the hue wheel is gray
• It is the same line that we have seen in RGB model from white to black
• The line is actually the measure of Intensity
• Ranging from Black to White
• Dark to Bright
Relationship between RGB and HSI
Different representations of HSI model
Different representations of HSI model
Converting RGB values to HSI
representation
• It is assumed that the RGB values
have been normalized to the range
[0, 1]
• angle is measured with respect to
the red axis of the HSI space
• Hue can be normalized to the range
[0, 1] by dividing by 360°
• The other two HSI components
already are in this range if the given
RGB values are in the interval [0, 1].
Converting from HSI to RGB
• begin by multiplying H by 360°, which returns the hue to its original range of [0°, 360°].
RG sector (0° ≤ H < 120°) GB Sector 120° ≤ H < 240°) BR Sector 240° ≤ H < 360°)
Begin by H = H - 120° Begin by H = H – 240°
Some other terminologies
• Shade: A hue produced by adding black
• Tint: A hue produced by adding white
• Tone: A hue produced by adding grey
Task 1
Task 2