COLOR IMAGE PROCESSING
Digital Image Processing
Unit-5
Colour Image Processing
INTRODUCTION
Color image processing is motivated by two
principal factors:
1. color is powerfull descriptor for object
identification and extraction in a scene.
2. Basically human eye can discern thousands
of color shades and intensities. So, color plays
important role In manual image analysis
INTRODUCTION
Color image processing classified into
two categories:
Full color processing
It acquires all the colors in an image for
processing
Pseudo color processing
One color is assigning to a particular
monochromatic intensity or range of
intensities
4
INTRODUCTION
Today well look at color image
processing:
Color fundamentals
Color models
Color Fundamentals
In 1666, Sir Isaac Newton discovered that when a
beam of sunlight passes through a glass prism, the
emerging beam is split into a spectrum of colors
Color Fundamentals
Characterization of light :
2.
Chromatic light
Greyscale
Color
1. Achromatic light
f (x, y) {0,1,, N}
f (x, y) [ {0,,N}, {0,,N},
{0,,N} ]
7
Problems with Processing Colour
Images
When processing colour images, the following
problems (amongst others) have to be dealt with:
The images are vectorial 3 numbers are
associated with each pixel.
The colours recorded by a camera are heavily
dependent on the lighting conditions.
Lighting conditions
The lighting conditions of the scene have
a large effect on the colours recorded.
Image taken lit by a
flash.
Image taken lit by a
tungsten lamp.
9
The following four images of the same scene were acquired
under different lighting conditions:
10
Dealing with Lighting
Changes
Knowing just the RGB values is not enough to
know everything about the image.
The R, G and B primaries used by different
devices are usually different.
For scientific work, the camera and lighting should
be calibrated.
For multimedia applications, this is more difficult
to organise:
Algorithms exist for estimating the illumination
colour.
11
Color Fundamentals
The colors that humans and most animals
perceive in an object are determined by the
nature of the light reflected from the object
For example, green
objects reflect light
with wave lengths
primarily in the range
Whi
te L
ight
of 500 570 nm while
Colours
Absorbed
absorbing most of the
energy at other
Light
Green
wavelengths
12
Color Fundamentals
Chromatic light spans the electromagnetic
spectrum from approximately 400 to 700 nm
As we mentioned before human color vision is
achieved through 6 to 7 million cones in each
eye
13
Physical
Background
Visible light: a narrow band
of electromagnetic radiation
380nm (blue) 780nm
(red)
Wavelength: Each physically
distinct colour corresponds
to at least one wavelength
in this band.
Pure Colours: Pure or
monochromatic colours do
not exist in nature.
14
Color Fundamentals
1. Approximately 65% of these cones are
sensitive to red light, 33% to green light and
2% to blue light
2. Absorption curves for the different cones have
been determined experimentally
3. Strangely these do not match the CIE
( Commission Internationale de 1Eclairage-the
International commission on illumination )
standards for red (700nm), green (546.1nm)
and blue (435.8nm) light as the standards were
developed before the
experiments!
15
Color Fundamentals
(cont)
16
Color Fundamentals
3-basic qualities are used to describe
the quality of a chromatic light source:
Radiance: the total amount of energy
that flows from the light source
(measured in watts)
Luminance: the amount of energy an
observer perceives from the light source
(measured in lumens)
Note we can have high radiance, but low
luminance
Brightness: a subjective (practically un
measurable) notion that embodies
(represent) the intensity of light
17
Color Fundamentals
Due to absorption characteristics of human eye
the colors Red, Green, Blue are called primary
colors of light.
Adding of primary colors produces secondary
colors of light . Those are
Magenta (R+B).
Cyan
(G+B).
Yellow
(R+G).
Secondary colors of light is also called as primary
colors of pigments or colorants
Adding of all primary colors of light or secondary
colors with opposite primary color produce white
(R+B+G) = (M+G) = (C+R) = (Y+B) = WHITE
18
Color Fundamentals
(cont)
Adding of all primary colors of light or
secondary colors with opposite primary color
produce white
(R+B+G) = (M+G) = (C+R) = (Y+B) = WHITE
Secondary colors of pigments are primary
colors of light i.e., R,G,B.
R=(Y+M)
;
G=(Y+C) ;
B=(M+C)
Adding of all primary colors of pigments or
secondary color with opposite primary
produce black.
(M+C+Y) = (R+C) = (G+M) = (B+Y) = BLACK
19
Color Fundamentals
Digital Image Processing, Spring 2006
20
20
Color Fundamentals
(cont)
Characteristics used to distinguish one color
from another color
Brightness: Embodies the intensity of light
Hue: Represents dominant color in a mixer of light
waves
Saturation: represents amount of white light mixed
with Hue
Saturation is inversely proportional to white light
added
Saturation is zero when the energy of primary colors
of light is equal.
Color Models
From the previous discussion it should be
obvious that there are different ways to
model color
We will consider two very popular models
used in color image processing:
RGB
(Red Green Blue)
CMY OR CMYK (Cyan Magenta Yellow)
HIS
(Hue Saturation
Intensity)
RGB
In the RGB model each colour appears in its primary
spectral components of red, green and blue
The model is based on a Cartesian coordinate system
RGB values are at 3 corners
Cyan magenta and yellow are at three other
corners
Black is at the origin
White is the corner furthest from the origin
Different colours are points on or inside the cube
represented by RGB vectors
RGB (cont)
RGB (cont)
Images represented in the RGB color model
consist of three component images one for
each primary color
When fed into a monitor these images are
combined to create a composite color image
The number of bits used to represent each
pixel is referred
to as the color depth
3
8
A 24-bit image
2 is often referred to as a fullcolor image as it allows
= 16,777,216
colors
RGB (cont)
The HSI Color Model
RGB is useful for hardware implementations
and is serendipitously related to the way in
which the human visual system works
However, RGB is not a particularly intuitive
way in which to describe colors
Rather when people describe colors they
tend to use hue, saturation and
brightness
RGB is great for color generation, but HSI is
great for color description
The HSI Colour Model
(cont)
The HSI model uses three measures to
describe colors:
Hue: A color attribute that describes a pure
colour (pure yellow, orange or red)
Saturation: Gives a measure of how much
a pure color is diluted with white light
Intensity: Brightness is nearly impossible
to measure because it is so subjective.
Instead we use intensity. Intensity is the
same achromatic notion that we have seen
in grey level images
HSI, Intensity & RGB
Remember the diagonal on the RGB
colour cube that we saw previously
drawn from black to white
Now consider if we stand this cube on
the black vertex and position the white
vertex directly above it
HSI, Intensity & RGB
(cont)
Now the intensity component
of any color can be
determined by passing a
plane perpendicular to
the intensity axis and
containing the color
point
The intersection of the plane
with the intensity axis gives
us the intensity component of
the color
HSI, Hue & RGB
In a similar way we can extract the hue from
the RGB color cube
Consider a plane defined by
the three points cyan, black
and white
All points contained in
this plane must have the
same hue (cyan) as black
and white cannot contribute
hue information to a color
The HSI Color Model
Consider if we look straight
down at the RGB cube as it
was arranged previously
We would see a hexagonal
shape with each primary
colour separated by 120
and secondary colours
at 60 from the primaries
So the HSI model is
composed of a vertical
intensity axis and the locus of
colour points that lie on
planes perpendicular to that
axis
The HSI Colour Model
(cont)
To the right we see a hexagonal
shape and an arbitrary colour
point
The hue is determined by an
angle from a reference point,
usually red
The saturation is the distance from the
origin to the point
The intensity is determined by how far up
the vertical intensity axis this hexagonal
plane sits (not apparent from this diagram
The HSI Colour Model
(cont)
Because the only important things are the
angle and the length of the saturation
vector this plane is also often represented
as a circle or a triangle
HSI Model Examples
HSI Model Examples
Converting From RGB To HSI
Given a colour as R, G, and B its H, S,
and I values are calculated as follows:
ifB G
H
360 ifB G
2 R G R B
1
cos
1
R G2 R BG B 2
3
S 1
minR,G,B
R G B
I 13 R G B
Converting From HSI To RGB
Given a color as H, S, and I its R, G,
and B values are calculated as follows:
RG sector (0 <= H < 120)
S cosH
R I 1
cos60 H
G 3I R B
B I1 S
GB sector (120 <= H < 240)
R I1 S G I 1 S cosH 120
B 3I R G
cosH 60
Converting From HSI To RGB
(cont)
BR sector (240 <= H <= 360)
R 3I G B
G I1 S
H 240
S cos
B I 1
cosH 180
HSI & RGB
RGB Colour Cube
H, S, and I Components of RGB Color Cube
Manipulating Images In The HSI
Model
In order to manipulate an image under
the HIS model we:
First convert it from RGB to HIS
Perform our manipulations under HSI
Finally convert the image back from HSI
to RGB
RGB
Image
HSI
Image
Manipulations
RGB
Image
RGB -> HSI -> RGB
RGB
Image
Saturation
Hue
Intensity
RGB -> HSI -> RGB (cont)
To manipulate the above RGB image
Change hue to zero to the pixels
corresponds to B &G
Reduce saturation to half of the cyan
region
Reduce the intensity of the centre region
to half
RGB -> HSI -> RGB (cont)
Hue
Intensity
Saturation
RGB
Image
Pseudocolor Image
Processing
Pseudo color (also called false
color) image processing consists
of assigning colors to grey values
based on a specific criterion
The principle use of pseudo
color image processing is for
human visualization
Humans can discern
between thousands of color
shades and intensities,
compared to only about two
dozen or so shades of grey
Pseudo Color Image Processing
Intensity Slicing
Intensity slicing and color coding is one of the
simplest kinds of pseudo color image
processing
First we consider an image as a 3D function
mapping spatial coordinates to intensities
(that we can consider heights)
Now consider placing planes at certain levels
parallel to the coordinate plane
If a value is one side of such a plane it is
rendered in one color, and a different color if
on the other side
Pseudo color Image
Processing Intensity Slicing
(cont)
Pseudo color Image Processing
Intensity Slicing (cont)
In general intensity slicing can be
summarized as:
Let [0, L-1] represent the grey scale
Let l0 represent black [f(x, y) = 0] and let lL-1
represent white [f(x, y) = L-1]
Suppose P planes perpendicular to the
intensity axis are defined at levels l1, l2, , lp
Assuming that 0 < P < L-1 then the P
planes partition the grey scale into P + 1
intervals V1, V2,,VP+1
Pseudo color Image Processing
Intensity Slicing (cont)
Grey level colour assignments can then
be made according to the relation:
f ( x, y ) ck
if f ( x, y ) Vk
where ck is the colour associated with
the kth intensity level Vk defined by the
partitioning planes at l = k 1 and l = k
Pseudo color Image
Processing
Mapping function
fig : Alternative representation of intensity slicing technique
color assignment depends on li value
Mapping function appears as staircase
Pseudocolor Image
Processing
Gray level image
Intensity slicing image into 8 color regions
Pseudocolor Image
Processing
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Pseudocolor Image
Processing
Figures a)Gray scale image corresponds to
average monthly rainfall (horizantal band)
b) color assigned to intensity values
c) color code d) Zone of america
Blue signifies low rainfall and opposite
red indicates high rainfall
Gray level to color
transforms
Intensity slicing technique is
piecewise linear function of gray
levels are used
This method is smooth and nonlinear
function
Gray level to color
transforms
Consider a gray level image ,Perform individual
transforms on the image at any input pixel .Three
results are feed separately into the R,G,B channels
This method produce a composite image whose
colors are modulated by the transformation functions
Gray level to color
transforms
Image of luggage obtained from the airport x
ray scanning system
Gray level to color
transforms
Gray level to color
transforms
Another method is to Combining several
monochrome images into a single color
image
Used in multispectral image processing
Gray level to color
transforms
Satellite images of
washington
Full color image prcessing
Full color image processing falls into two categories
Processing each component individually and then form composite
color images
Work with color pixels directly
Basically color images have atleast three components .color
pixel is really a vector and these vectors are the functions of
spatial coordinates
Even though per color component and vector based
processing are not same