2_06-1 - color image processing
TRANSCRIPT
-
7/31/2019 2_06-1 - Color Image Processing
1/20
4/28/
Color ima e rocessin :
fundamentals
Spring2008 ELEN4304/5365DIP 1
byGlebV.Tcheslavski:[email protected]://ee.lamar.edu/gleb/dip/index.htm
PreliminariesColor image processing is motivated by two main factors:
1. Color is a powerful descriptor simplifying object recognition.
2. We can distinquish between thousands of color shades and
intensities, compared to about 20-30 values of gray.
There are two major areas of color image processing:
1. Full-color processing images are acquired with a full-color
sensor (TV camera, color scanner);
Spring2008 ELEN4304/5365DIP 2
. monochrome intensity or intensity range.
Many methods discussed for processing of monochrome images are
applicable to color images; other methods need reformulation.
-
7/31/2019 2_06-1 - Color Image Processing
2/20
4/28/
Fundamentals of colorMechanisms of color processing by human brain are not completely
understood. However, the physical nature of color can be formally
ex ressed and modeled.
Spring2008 ELEN4304/5365DIP 3
1666: Sir Isaac Newton managed to pass a beam of white lightthrough a glass prism and got a rainbow on the other side where
each color blends smoothly into the next.
Fundamentals of color
Particular colors of the object as human perceive them are
determined by the nature of light reflection properties of the object. A
Spring2008 ELEN4304/5365DIP 4
appears as white. A body reflecting more light in a particular range of
wavelengths and absorbing light in other bands appears as colored.
Note: creatures other than humans may (and do!) perceive colors in a
completely different way than we do
-
7/31/2019 2_06-1 - Color Image Processing
3/20
4/28/
Fundamentals of color
If the light is achromatic (no colors), its only attribute is its intensity(amount). Examples of achromatic light: images produced by a b&w
, .
so far was limited to achromatic images.
Chromatic light spans the EM spectrum from approximately 400 to
700 nm. The three basic quantities used to describe a chromatic light
source are radiance (the total amount of energy from the source, W),
luminance (energy an observer perceives from the source, lm: for
Spring2008 ELEN4304/5365DIP 5
examp e, an o server m g t are y perce ve any g t rom a source
radiating in an infrared region), and brightness (a subjective
descriptor practically impossible to measure since it is associated toboth the intensity and color sensation).
Fundamentals of colorColor sensitive sensors of human retina are cones. The total of 6-7
million of cones
in a human e e
can be associated
with one of three
groups: red (~575
nm) sensitive
(about 65 % of all
cones), green
1965
Spring2008 ELEN4304/5365DIP 6
(~535 nm 33%),
and blue (~445 nm
2%) sensitive.
Blue cones are the
most sensitive.
-
7/31/2019 2_06-1 - Color Image Processing
4/20
4/28/
Fundamentals of color
Due to the absorption characteristics of the human eye, we see colorsas variable combinations of so-calledprimary colors of light: red
(R), green (G), blue (B). The following wavelengths are designated
to them in 1931: 700 nm, 546.1 nm, and 435.8 nm.
A common misconception is that it is possible to get any desired
visible color by properly mixing the primary colors!
Note: this selection of primary colors is rather arbitrary: about every
Spring2008 ELEN4304/5365DIP 7
, ,
primary.
Fundamentals of color
Speaking of arbitrary selection of primary colors count number of
colors in two rainbows:
Spring2008 ELEN4304/5365DIP 8Western version
Eastern (Russian) version
and then find brown color
-
7/31/2019 2_06-1 - Color Image Processing
5/20
4/28/
Fundamentals of colorAdding primary colors of light produces
secondary colors: magenta (red + blue),cyan (green + blue), and yellow (green
+ red). Mixing the three primary colors
of light (or a secondary with its
opposite primary color) in the right
intensities produces white light. Mixing
together the three secondary colors of
light, black (no light) can be produced.
Spring2008 ELEN4304/5365DIP 9
Aprimary color of pigment is a color
that subtracts (or absorbs) a primary
color of light and reflects (or transmits)the other two. Therefore, the primary
colors of pigments are CMY.
Fundamentals of color
CRT or LCD monitors are good examples of mixing light colors
where three primary colors (RGB) are mixed (added) to form light
of the particular color (either via the three gloving dots of different
luminophore or via the three light beams of different color).
Color printers are examples of mixing (adding) light pigments.
Colors are usually distinguished from each other through the three
characteristics: brightness, hue, and saturation. As mentioned
Spring2008 ELEN4304/5365DIP 10
, .dominant color as perceived by an observer (red, yellow, blue).
Saturation is the amount of white added to a hue (purity of the color).
For example, we need to specify saturation to characterize pink (red
+ white).
-
7/31/2019 2_06-1 - Color Image Processing
6/20
4/28/
Fundamentals of color
Hue and saturation together are called chromaticity. A color may alsobe characterized by its brightness and chromaticity.
The amounts of red, green, and blue needed to form any particular
color are called thetristimulus values and are denoted asX, Y, Z.
therefore, a color is specified by itstrichromatic coefficients:
, ,X Y Z
x y zX Y Z X Y Z X Y Z
= = =+ + + + + +
Spring2008 ELEN4304/5365DIP 11
We notice that 1x y z+ + =
The tristimulus values needed to produce a color of particularwavelength can be obtained from the tables.
Fundamentals of colorAnother way to specify colors is
by using the CIE (chromaticity
diagram), which shows a color
composition as a function ofx
(red) andy (green). For any
values ofx andy, the
corresponding value ofz (blue)
can be found as
=
Spring2008 ELEN4304/5365DIP 12
-
7/31/2019 2_06-1 - Color Image Processing
7/20
4/28/
Fundamentals of colorThe point marked as green has
approximately 62 % green and25 % red. Therefore, it has about
13 % of blue.
The positions of different colors
(from violet at 380 nm to red at
700 nm) are indicated by the
wavelengths around the
boundary of the chromaticity
Spring2008 ELEN4304/5365DIP 13
diagram. They are the pure
colors. Any pointnot on the
boundary represent somemixture of spectrum colors.
Fundamentals of color
The white point in the middle of
CIE is called the point of equal
energy as equa ract ons o t e
three primary colors: CIE standard
for white light.
Any point along the boundary is
fully saturated. When leaving the
boundary, some amount of white
Spring2008 ELEN4304/5365DIP 14
light is added to form the color.
The saturation at the point of
equal energy is zero.
-
7/31/2019 2_06-1 - Color Image Processing
8/20
4/28/
Fundamentals of color
A straight line joining any twopoints in the diagram defines all
t e erent co or var at ons t at
can be obtained by combining
these two colors additively.
A line drawn from the point of
equal energy to any point on the
boundary defines all the shades
Spring2008 ELEN4304/5365DIP 15
of that particular color.
Fundamentals of color
Extending this procedure to the
three (primary) colors, we need
to orm a tr ang e, w ose apexes
are the three primary colors.
Any colorat the boundary or
inside the triangle can be
produced by various
combinations of the three initial
Spring2008 ELEN4304/5365DIP 16
.Therefore, not all colors can be
obtained from three fixed
primaries.
-
7/31/2019 2_06-1 - Color Image Processing
9/20
4/28/
Fundamentals of color
A typical range of colors (colorgamut) produced by RGB
mon tors.
The irregular region inside the
triangle represents the color
gamut of the high-quality color
printers. The region is irregular
since color printing involves a
Spring2008 ELEN4304/5365DIP 17
combination of additive and
subtractive color mixing.
Fundamentals of color
CRTmon tor
Spring2008 ELEN4304/5365DIP 18
-
7/31/2019 2_06-1 - Color Image Processing
10/20
4/28/
Fundamentals of color
LCDon tor(projector)
Spring2008 ELEN4304/5365DIP 19
Color models
A color model (color space or color system) is a specification of a
coordinate system and a subspace within that system where each
color is represented by a single point.
Most contemporary color models are oriented either toward hardware
(color monitors and printers) or toward applications where color
manipulation is used (color graphics for animation).
The most commonly used in Image Processing practice models are
Spring2008 ELEN4304/5365DIP 20
mon tors, most o cameras , an pr nters , an
HIS (closely correspond to the human visual system.
-
7/31/2019 2_06-1 - Color Image Processing
11/20
4/28/
RGB color model
The RGB (red, green, blue) color model is based on a Cartesiancoordinate system. The color subspace is a cube, in which RGB
corners; the secondary colors (cyan,
magenta, and yellow) are at three
other corners; black is at the origin;
and white is at the farthest from the
origin corner. The gray scale (points
Spring2008 ELEN4304/5365DIP 21
black to white along the straight line.
Different colors are points on or inside the cube and are defined byvectors extending from the origin. All values of R, G, and B are
normalized and are assumed to be in the range [0,1].
RGB color model
Images represented in the RGB model consist of three component
images (one for each primary color) that are combined into a
compos e co or mage.
The number of bits used to represent a
pixel is called the pixel depth.
Assuming that each component image
uses 8 bits, each RGB color pixel is
said to have a depth of 24 bits. Such
Spring2008 ELEN4304/5365DIP 22
co or mages are requen ycalledfull-color images.
The total number of colors in a 24-bit color image is
( )3
82 16 777 216=
-
7/31/2019 2_06-1 - Color Image Processing
12/20
4/28/
RGB color model
A convenient way toview these colors is to
Cross-sectional plane(127,G,B);
(faces of color sections
of the cube). To do this,
one color is fixed while
two other are varying.
,
In the component
Spring2008 ELEN4304/5365DIP 23
images, 0 represents
black and 255 is white.
An RGB image can be viewed by feeding the component images to
a color monitor.
RGB color model
Acquiring color images can be accomplished by reversing the
procedure: the scene can be sensed through red, green, and blue
ers consequen y o recor componen mages.
Spring2008 ELEN4304/5365DIP 24
The three hidden surfaces of the color cube.
-
7/31/2019 2_06-1 - Color Image Processing
13/20
4/28/
RGB color model
Some of the hardware used for color image reproduction is limitedto 256 colors. Only 216 of these colors are common to most systems
t e rest s processe erent y . ese co ors ecame t e e acto
all-systems-safe colors. Each of them is formed from three RGB
values but each value is limited to [0, 51, 102, 153, 204, 255] or in
the hexagonal system [00 33 66 99 CC FF].
Since three numbers specify an RGB color, each safe color is
formed from three of the two-digit hexagonal numbers: the purest
Spring2008 ELEN4304/5365DIP 25
red would be (FF 00 00), black is (00 00 00), and white is (FF FF
FF). The decimal equivalents are (255 0 0), (0 0 0), and (255 255
255).
RGB color model
The 216 safe colors:
the left top square is
, t e
next (FF FF CC),
etc. The second raw
is (FF CC FF), (FF
CC CC), etc.
Spring2008 ELEN4304/5365DIP 26
-
7/31/2019 2_06-1 - Color Image Processing
14/20
4/28/
RGB color model
Spring2008 ELEN4304/5365DIP 27
Full color cube Safe color cube (sampled)
CMY and CMYK color models
Cyan, magenta, and yellow are the secondary colors of light (or the
primary colors of pigments). Most color printing devices use CMY
mo e . e convers on rom s one y:
1
1
1
C R
M G
Y B
=
E ual amount of three i ments must roduce black. This a roach
Spring2008 ELEN4304/5365DIP 28
is not very practical and leads to a muddy-looking black. To
produce a true black (predominant color in printing), a fourth color
black is added to the color model to make a CMYK model.
-
7/31/2019 2_06-1 - Color Image Processing
15/20
4/28/
HSI color model
While RGB and CMY color models are well suited for hardwareimplementations, these models do not fit well human perception of
, ,
brightness. Therefore, the hue, saturation, intensity (HSI) model
was developed, where the intensity component is independent from
color information.
The intensity axis goes
from black to white and
Spring2008 ELEN4304/5365DIP 29
3
R G BI
+ +
=
HSI color modelConsidering the triangle with apexes ofBlack,
White, and any color point(Cyan, f.i.), we
notice that all oints on the trian le have the
same hue. Rotating the plane about the
intensity axis, we can obtain different hues.
360
if B GH
if B G
=
>
Spring2008 ELEN4304/5365DIP 30
( ) ( ) ( )
1
2
2cos
R G R B
R G R B G B
+
= +
Where
A small number often is added to the denominator to avoid dividing by zero. Zero
angle corresponds to red here. If RGB values are normalized, hue is divided by 3600.
-
7/31/2019 2_06-1 - Color Image Processing
16/20
4/28/
HSI color model
The HSI space is represented by a vertical intensity axis and thelocus of color points that lie on planes perpendicular to this axis. As
,
either a triangular or hexagonal shape.
Primary colors are separated by
1200 while the secondary are 600
from primaries.
Therefore, the hue
Spring2008 ELEN4304/5365DIP 31
of the point can be
determined by an
angle from somereference point (as
shown previously)
HSI color modelSaturation (distance from the
vertical axis) is the length of the
vector from the ori in to the oint:
[ ]3
1 min( , , )S R G BR G B
= + +
The important components of the
HSI model are the vertical intensity
axis, the length of the vector to the
Spring2008 ELEN4304/5365DIP 32
color point, and the angle of that
vector.
HSI planes are defined as hexagons,
triangles, or circles. The shape does
not matter!
-
7/31/2019 2_06-1 - Color Image Processing
17/20
4/28/
Converting colors from HSI to RGB
Assuming that HSI values are normalized (in the interval [0 1]),conversion to RBG depends on the H value and is different for the
0. , .
1. RG sector: 0 120H
( )cos
1cos 60
S HR I
H
= +
Spring2008 ELEN4304/5365DIP 33
( )3
(1 )
G I R B
B I S
= +
=
Converting colors from HSI to RGB
2. GB sector: 120 240H
( )1
cos1
cos 60
R I S
S HG I
H
=
=
= +
Spring2008 ELEN4304/5365DIP 34
( )3B I R G= +
-
7/31/2019 2_06-1 - Color Image Processing
18/20
4/28/
Converting colors from HSI to RGB
3. BR sector: 240 360H
( )
( )
3
1
cos
R I G B
G I S
S H
=
= +
=
Spring2008 ELEN4304/5365DIP 35
( )1
cos 60B I
H= +
Converting colors from HSI to RGB
Original color cube
Spring2008 ELEN4304/5365DIP 36
Its hue component:
the discontinuity
Its saturation
component
Its intensity
component
-
7/31/2019 2_06-1 - Color Image Processing
19/20
4/28/
Manipulating HSI component
imagesColor image
showinIts hue
com onentprimary and
secondary
colors
image: red
is mapped
to black
Its intensitIts
Spring2008 ELEN4304/5365DIP 37
component
image
saturation
component
image
Manipulating HSI componentimages
To change the color in any region, we change the values in the
correspon ng reg on n t e ue mage; t en convert t e new
image with the unchanged SandIimages back to RGB image.
To change the saturation (purity) in any region, we follow the same
procedure except that we change the saturation image.
Spring2008 ELEN4304/5365DIP 38
, .
-
7/31/2019 2_06-1 - Color Image Processing
20/20
4/28/
Manipulating HSI component
images
Modified hue
com onent
Modifiedsaturation
image: blue
and green
regions are
set to 0
componen
image: cyan
region is
reduced by
half
Modified
Spring2008 ELEN4304/5365DIP 39
component
image: white
region was
reduced by
half
RGB image