Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

Dr.Azmi T.

Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

Color Image Processing

The use of color is important in image processing because:


-Color is a powerful descriptor that simplifies object identification and
extraction.
-Humans can discern thousands of color shades and intensities, compared
to about only two dozen shades of gray.

Color image processing is divided into two major areas:


First: Full-color processing: images are acquired with a full-color sensor
such as a color TV camera or color scanner.
Second: pseudocolor processing: the problem is one of assigning a color
to a particular monochrome intensity or range of intensities.

First: Perceptual aspects for full color.


The human visual system tends to perceive color as being made up of
varying amounts of red, green and blue. this is a function of the cone cells
in the retina of the eye. These values are called the primary colors. If we
add together any two primary colors, we obtain the secondary colors.
Mixing the three primaries, or a secondary with its opposite primary color,
produces white light as shown in figure (1).

1
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

magenta(purple)=red + blue
cyan=green+blue
yellow =red +green

Figure 1. Primary and secondary colors of light.

The primary colors of pigments are cyan (C), magenta (M), and yellow
(Y) and the secondary colors are red(R), green(G), and blue(B). A proper
combination of the three primaries, or a secondary with its opposite
primary, produces black as shown in figure 2.

2
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

Figure 2. Primary and secondary colors of pigments.

Visible light is part of the electromagnetic spectrum: radiation in which


the energy takes the form of waves of varying wavelength. Figure 3
illustrates this.
The values for the wavelengths of blue, green and red were set in 1931 by
the CIE (Commission International d’Eclairage), an organization
responsible for color standards.

3
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

Figure 3. The electromagnetic spectrum and colors.

The amounts of red, green, and blue which make up a given color can be
determined by a color matching experiment. In such an experiment,
people are asked to match a given color ( color source) with different
amounts of the additive primaries red, green and blue. Such an experiment
Note that for some wavelengths, various of the red, green or blue values
are negative as shown in figure (4). This is a physical impossibility, but it
can be interpreted by adding the primary beam to the color source, to
maintain a color.

4
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

The XYZ color matching functions corresponding to the R, G, and B


curves of figure (4) are shown in figure (5)

Figure (4): RGB color matching functions (CIE).

5
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

Figure 5. XYZ color matching functions (CIE).


To remove negative values from color information, the CIE introduced
the XYZ color model. The values of XY, and Z can be obtained from the
corresponding R, G and B values by a linear transformation.

6
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

. Ingeneral, the values of X,Y and Z needed to form any particular color
are called the tristimulus values. Values corresponding to particular colors
can be obtained from published tables. In order to discuss color
independent of brightness, the tristimulus values can be normalized by
dividing by X+Y+Z

and so x+y+z=1 .

Thus a color can be specified by x and y alone, called the chromaticity


coordinate.

Colors Characteristics:
The Characteristics used to distinguish one color from another are:

-Brightness: means of amount of intensity (i.e. color level).

-Hue: represents domains color as received by an observer.

-Saturation: refers to the amount of white light mixed with a hue.

7
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

Color models:
A color model is a method for specifying colors in some standard way. It
generally consists of a three dimensional coordinate system and a
subspace of that system (Color Space) in which each color is represented
by a single point.
A color space is a geometrical and mathematical representation of color.
A color space is a standard approach to represent color in mathematical
expressions. The operation of choosing the best color representation
includes knowing what information are needs from these signals and how
color signals are generated.
Color space means the use of a specific color model or system that turns
colors into numbers. Each color model is a method of creating many
colors from a small group of primary colors. Each model has a range of
colors it can be produce. That range is the color space. But here's an
important fact: color spaces in different systems aren't exactly the same.
Color models commonly used in image processing are:
-RGB model for color monitor and in video cameras.
-HSV (hue, saturation, value of intensity) model.
-YIQ model (luminance, color information)
-CMY and CMYK (cyan, magnet, yellow, black) models for color
printing.

1-The RGB color model.


In this model, each color is represented as three values R, G and B,
indicating the amounts of red, green and blue which make up the color.
This model is used for displays on computer screens; a monitor has three
independent electrons “guns” for the red, green and blue component of
8
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

each color. The different colors in this model are points on or inside cubic
and defined by a vectors extending from origin of cubic side 1:

Figure 6: RGB model

All colors values R, G, and B have been normalized in the range [0,1],
and represented each R, G, and B from 0 to 255. These three images are
combined on the screen to produce a color image as shown in the
figure 7 and figure 8.

9
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

Figure 7. Scheme of RGB color image.

Figure 8. A full- color image and its RGB component images

10
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

2-The HSV color model:


HSV stands for Hue, Saturation, Value. These terms have the following
meanings:
Hue: The “true color” attribute (red, green, blue, orange, yellow, and so
on).
Saturation: The amount by which the color has been diluted with white.
The more white in the color, the lower the saturation. So a deep red has
high saturation, and a light red (a pinkish color) has low saturation.
Value: The degree of brightness: a well-lit color has high intensity; a
dark color has low intensity.
HSV color space is the most intuitive way of describing color. This color
system is very nearer than the RGB system to the approach in which
humans express color sensations. Its three components are derived from
RGB values as follow:

All the RGB values are normalized to the range [0,1]

11
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

Conversion between RGB and HSV:


Suppose a color is specified by its RGB values.
-If all the three values are equal, then the color will be a grey scale; that
is, an intensity of white. Such a color, containing just white, will thus have
a saturation of zero. Conversely,
-If the RGB values are very different, we would expect the resulting color
to have a high saturation.
- If one or two of the RGB values are zero, the saturation will be one, the
highest possible value.
Hue is defined as the fraction around the circle starting from red, which
thus has a hue of zero. Reading around the circle in figure 9 produces the
following hues:

Figure 9. The color space HSV as a cone

12
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

Suppose we are given three R, G, B values, which we supposed to be


between 0 and 1. So if they are between 0 and 255, we first divide each
value by 255. We then define:

If H ends up with a negative value, we add 1. see figure 10

13
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

Figure 10. A full- color image and its HSV component images of an RGB
image.
The YIQ model color:
YIQ This color space is used for TV/video in America and other countries
where NTSC is the video standard (Australia uses PAL). In this scheme
Y is the “luminance” (this corresponds roughly with intensity), and I and
Q carry the color information. The conversion between RGB is straight
forward. See figure 11.

14
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

Figure 11. The YIQ component color images of an RGB image.

The CMY and CMYK color model:


Cyan, magenta, and yellow are the primary colors of pigments. CMY data
input or perform an RGB to CMY conversion internally by using the
equation:

15
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

where all color values have been normalized to the range [0,1]
In printing, combining equal amounts of Cyan, magenta, and yellow
produces muddy-looking black. in order to produce true black a fourth
color, black is added giving rise to the CMYK color model. See figure 12.

Figure 12. A full-color image and its CYMK component color images of
an RGB image.

Second: Pseudocoloring :
This means assigning colors to a grey-scale image in order to make certain
aspects of the image more amenable for visual interpretation—for
example, for medical images. There are different methods of
pseudocoloring.
16
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

1-Intensity slicing
In this method, we break up the image into various grey level ranges. We
simply assign a different color to each range. For example:

Figure 13: Intensity slicing as a mapping.

2-Gray—Color transformation:
The color transformation is express by the equation:
g(x,y)=T[f(x,y)],
where f(x,y) is a color input image, g(x,y) is the transformed color output
image, and T is the color transform.
This color transform can also be written:
Si=Ti(r1, r2, r3,…,rn) i=1,2,3,….,n

17
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

Figure 14: Applying a color map to a grayscale image.

Processing of color images:


There are two methods we can use:
1. we can process each R, G, B matrix separately,
2. we can transform the color space to one in which the intensity is
separated from the color, and process the intensity component only
Schemas for these are given in figures 15 and 16

18
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

Figure 15. RGB processing Figure16. Intensity processing

19
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.3.(2weeks)

20

You might also like