Color Image Processing
Dr A S Jalal
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Color Fundamentals
Color is a powerful descriptor
Often simplifies object
identification
Humans can discern thousands of
color shades & intensities
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
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 colours
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Light And The Electromagnetic Spectrum
Light is just a particular part of the electromagnetic
spectrum that can be sensed by the human eye
The electromagnetic spectrum is split up according to
the wavelengths of different forms of energy
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Color Fundamentals: Reflected Light
The colours that we perceive are determined by
the nature of the light reflected from an object
For example, if white
light is shone onto a
green object most
wavelengths are Colours
absorbed, while green Absorbed
light is reflected from
the object
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Color Fundamentals …
Chromatic light spans the electromagnetic spectrum
from approximately 400 to 700 nm
Human colour vision is achieved through 6 to 7
million cones in each eye
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
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 unmeasurable)
notion that embodies the intensity of light
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Cones
6 to 7 million cones divided in to three
principal sensing categories
65% of cones sensitive to red light
33% of cones sensitive to green light
2% of cones sensitive to blue light (blue
cones are most sensitive)
Why is the colour of STOP light at crossings Red in colour?
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Primary colors:
RGB
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Color Fundamentals …
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Color Fundamentals …
The International Commission on Illumination (CIE) in
1931 designated specific wavelengths to the
primary colours
Blue = 435.8 nm
Green = 546.1 nm
Red = 700.0 nm
No single colour can be called red, green or blue
Primary colours can be added to produce
secondary colours of light
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Color Fundamentals …
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Color Fundamentals …
Red,
Colours are
added Green,
Blue
Colours are Magenta,
subtracted (or Cyan,
absorbed) Yellow
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Color Fundamentals …
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Color Fundamentals …
Additive colour model Subtractive colour model
Any combination of two or Any combination of two
more colours results in a colours gives a colour with
colour with higher luminance lower luminance.
than the original colours. e.g. in mixing watercolours,
e.g. in a cathode ray tube a the resulting colour becomes
white point results from the darker and darker, and
combination of red, green ideally it will finally becomes
and blue points black
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Color Fundamentals …
Characteristics to distinguish one colour
from another
Brightness Hue Saturation
It is the chromatic It is an attribute It refers to the
notion of intensity associated with the relative purity or the
dominant wavelength in amount of white light
a mixture of light waves mixed with a hue.
Hue + Saturation Chromaticity
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Color Fundamentals …
The amounts of Red, Green & Blue needed to form
any particular color are called the Tristimulus
Values, denoted by X, Y & Z respectively.
A color is then specified by its trichromatic
coefficients, defined as
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
CIE Chromaticity diagram
Specifying colors systematically can be
achieved using the CIE chromaticity diagram
On this diagram the x-axis represents the
proportion of red and the y-axis represents
the proportion of green used
The proportion of blue used in a color is
calculated as:
z = 1 – (x + y)
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Chromaticity Diagram
Green: 62% green, 25%
red and 13% blue
Red: 32% green, 67%
red and 1% blue
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Chromaticity Diagram …
Any color located on the boundary of the
chromaticity chart is fully saturated
The point of equal energy has equal amounts of
each color and is the CIE standard for pure white
Any straight line joining two points in the diagram
defines all of the different colors that can be
obtained by combining these two colors additively
This can be easily extended to three points
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Chromaticity Diagram …
Entire color range cannot
be displayed based on any
three colors
The triangle shows the
typical color gamut
produced by RGB monitors
The irregular shape is the
gamut achieved by high
quality color printers
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Color Models
It is a specification of a coordinate system & a
subspace within that system where each color is
represented by a single point
There are different ways to model color
We will consider two very popular models used
in color image processing:
RGB (Red Green Blue)
HIS (Hue Saturation Intensity)
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Colour Models : RGB
In the RGB model each color 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 colors are points on or inside the cube
represented by RGB vectors
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Color Models : RGB …
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Color Models : RGB …
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
A 24-bit image is often3 referred to as a full color
image as it allows 28 = 16,777,216 colors
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Color Models : RGB …
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Color Models : RGB …
24-bit RGB image = 16,777,216 colours
Many systems today limited to 256 colours
Many applications require fewer colours!!
Safe RGB Colors
Subset of colors that are
• likely to be reproduced faithfully
• Reasonably independently of
viewer H/W capabilities
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Assumption (Accepted standard notation):
Minimum colours that can be faithfully reproduced by any
system is 256
Remaining 216
de facto standard for safe colours,
especially in Internet Applications
The no. of colours these RGB
triplets give us ? (6)3 = 216 !!!
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
The HSI Color Model
RGB is useful for hardware implementations
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
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
The HSI Color Model …
The HSI model uses three measures to describe
colors:
Hue: A color attribute that describes a pure color (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
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
The HSI Color Model …
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
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
The HSI Color Model …
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
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
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
color separated by 120°
and secondary colors
at 60° from the primaries
So the HSI model is
composed of a vertical
intensity axis and the locus of color points that lie on
planes perpendicular to that axis
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
The HSI Color Model …
To the right we see a hexagonal
shape and an arbitrary color
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
intenisty axis this hexagonal plane sits (not apparent
from this diagram
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
The HSI Color Model …
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
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
The HSI Color Model …
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
The HSI Color Model …
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Converting From RGB To HSI
Achromatic axis
Hue
[1,1,1]
H
[0,0,0] Saturation
Brightness
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Converting From RGB To HSI …
Given a colour as R, G, and B its H, S, and I values are
calculated as follows:
if B G 1
1
2
R G R B
H cos 1
360 if B G R G
2
R B G B
2
3
S 1 min R,G,B I 1
3
R G B
R G B
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Converting From HSI To RGB …
Given a colour as H, S, and I it’s R, G, and B values are
calculated as follows:
RG sector (0 <= H < 120 )
S cos H
R I 1
cos 60 H
G 3I R B B I1 S
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Converting From HSI To RGB …
Given a colour as H, S, and I it’s R, G, and B values are
calculated as follows:
GB sector (120 <= H < 240 )
The given value of H is in this sector –
first subtract 1200 from it
H = H - 1200
S cos H 120
R I1 S G I 1 B 3I R G
cos H 60
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Converting From HSI To RGB …
BR sector (240 <= H <= 360 )
The given value of H is in this sector – first subtract 2400 from it
H = H - 2400
R 3I G B G I1 S
S cos H 240
B I 1
cos H 180
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Pseudo coloring
Eye can distinguish between ~30 different grey-levels
... and 350,000 different colors
Display gray-level image as a color image for easier
visual inspection
The amount of information in the gray-level image is not changed
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal 43
Pseudo coloring …
The process of assigning different colour to
every intensity value available in a Gray scale
image is known as pseudo-colour processing.
Advantage:
Many image features & their comparison can be
readily done using pseudo-colouring.
fR(x,y)
f(x,y) Colour Coordinate fG(x,y)
Gray-level Transformation
image fB(x,y)
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Intensity Slicing
(A Technique for Pseudo colouring)
For 3-D images, use a plane at f(x,y)=li to slice
the image function into two levels
Any pixel whose gray level is above the plane is
coded with one colour, and any pixel below the
plane is coded with the other
The result is a two-colour image whose relative
appearance can be controlled by moving the
slicing plane up and down the gray-level axis
In general, we can use multi-level slicing and
colour coding
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Intensity Slicing ...
(A Technique for Pseudo colouring)
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Intensity Slicing ...
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Intensity Slicing ...
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal
Any Questions ?
Class Presentation on Image Processing and Computer Vision by Dr. Anand Singh Jalal