Digital ImageProcessing-color Image Processing
Digital ImageProcessing-color Image Processing
Established in 1998
Session: 2020-21
One of the
most • Color fundamentals
important • Devices for managing colors
aspects of any • Color models
object is its • Pseudo color image
color. CIP processing
provides an • True color image processing
overview of
the following:
Color: Its necessity
Color
Image • Full(or true)
Processing color processing
is divided
into two
• Pseudo color
major processing
groups viz.
Full color processing
It is used to assign
artificial color to a
monochrome image.
Color
Fundamentals
Sensor response ,
Where
is the sensitivity function of the
sensor used for capturing the image.
Color Fundamentals…
Human eyes have two kinds of photoreceptors, namely
rods and cones.
Whenever an additional
The ability to perceive same color
correction is required to maintain
of an object in different lighting
the same color, as in digital
conditions, is called color
cameras, its called chromatic
constancy.
adaptation
Color Fundamentals…
• For a monochrome image response or
intensity I is given by
Where,
I is called luminance, intensity, brightness, value
or grey-level of the image.
Color Fundamentals…
• A color image, thus can be considered to be the set of three
monochrome images.
• It can be described as a set of three responses
There
are two • Component
ways of ordering, and
storing • Packed ordering
color
images
Component ordering
Packed Ordering
Indexed Images
Examples include .
𝐶=𝑟𝑅+𝑔𝐺+𝑏𝐵
Here R,G,B indicate red, green, and blue components and
r,g,b represent the amount of each primary color used in
matching.
Color matching…
Red blue and green are called tri-stimulus and are denoted
by X- Y- and Z-axes.
Color models
With
HIS to RGB
• Similarly HSI can be converted to RGB using
Divide into three sectors as
• Sector 1 if H is between 0 and 120 degree
• Sector 2 if H is between 120 and 240 degree
• Sector 3 if H is between 240 and 360 degree
• Based on the sectors , compute the
components
HSV color models
It includes Hue, Saturation, and Value.
• Calculate
• Calculate
Saturation is given by
Scan rate
Interlacing
Synchronizing signals
Uniform Non-uniform
Quantization Quantization
From http://fuse.pha.jhu.edu/~wpb/spectroscopy/basics.html
From http://math.ucr.edu/home/baez/physics/General/BlueSky/blue_sky.html
• It is therefore possible to characterise a psycho-
visual colour by specifying the amounts of three
primary colours: red, green and blue, mixed
together.
• This leads to the standard RGB space used in
television, computer monitors, etc.
• We specify the levels of R, G and B in the range
[0, 1], but they can easily be extended to other
ranges (8-bit integers for example).
(1,1,1)
RGB
Problems with Processing Colour Images
Colour
Red Red
Scalar process.
Green Green
Scalar process.
Blue Blue
Scalar process.
Vectorial Processing
• The colour triplets are processed as single units:
Red Red
Vectorial
Median
The Problem of False Colours
Marginal R 100
median V 100
B 0
R 100 R0 R 100
V 0 V 100 V 100
B 0 B 0 B 100
R0
Vectorial V 100
median
B0
Alternative Colour Spaces
Alternative Colour Spaces
• Various other colour representations can be
calculated from the RGB representation.
• This can be done for:
– Decorrelating the colour channels:
• principal components.
– Bringing colour information to the fore:
• Hue, saturation and brightness.
– Perceptual uniformity:
• CIELuv, CIELab, …
Processing Strategy
Red Red
Processing
Green Green
T T-1
Blue Blue
Colour spaces
• RGB (CIE), RnGnBn (TV - National Television Standard Comittee)
• XYZ (CIE)
• UVW (UCS de la CIE), U*V*W* (UCS modified by the CIE)
• YUV, YIQ, YCbCr
• YDbDr
• DSH, HSV, HLS, IHS
• Munsel colour space (cylindrical representation)
• CIELuv
• CIELab
• SMPTE-C RGB
• YES (Xerox)
• Kodak Photo CD, YCC, YPbPr, ...
3D-polar Coordinate Colour Spaces
3D-polar Coordinate Colour Spaces
• These spaces use a cylindrical (3D-polar) coordinate system to
encode the following three psycho-visual coordinates:
– Hue (dominant colour seen)
• Wavelength of the pure colour observed in the signal.
• Distinguishes red, yellow, green, etc.
• More the 400 hues can be seen by the human eye.
– Saturation (degree of dilution)
• Inverse of the quantity of “white” present in the signal. A pure colour has
100% saturation, the white and grey have 0% saturation.
• Distinguishes red from pink, marine blue from royal blue, etc.
• About 20 saturation levels are visible per hue.
– Brightness
• Amount of light emitted.
• Distinguishes the greylevels.
• The human eye perceives about 100 levels.
3D-polar Coordinate Colour Spaces
• The transformation of the RGB colour space to a hue, saturation
and brightness colour space is essentially a conversion from a
set of rectangular coordinates to a set of (3D-polar) cylindrical
coordinates.
Hue
at
i s om
[1,1,1] H
ax ch r
A
Saturatio
Brightness
[0,0,0] n
Basic Problem Achromatic
axis
• Many of the spaces were originally developed for
easy numerical specification of colours in
Conic HSV
computer graphics applications.
• Due to its brightness function, the “natural”
shape of the HSV colour gamut is a cone.
• However, with this shape, there are many
coordinates which are not valid. H=180° H=0°
• In order to avoid costly verification of the validity
of specified coordinates, these gamuts were often
artificially expanded into cylinders.
• These cylindrical spaces have often been
unwittingly carried over into image processing
applications.
Cylindrical HSV
Standard RGB → HSV Transform
• max = sup(R, G, B) min = inf(R, G, B)
• L = max
• max min
if max 0
S max
0 otherwise
•
maxG Bmin if R max
BR
H t max min 2 if G max
If Ht < 0, HRt :=
G Ht + 6
max min 4 if B max
•
• H = Ht 60°
Conic HLS
• The same problem occurs
for the HLS transformation.
H=180° H=0°
• Here the double cone has
been artificially expanded
at both ends.
Cylindrical HLS
Standard RGB → HLS Transform
• max = sup(R, G, B) min = inf(R, G, B)
•
L max min
2
R, G and B are between 0 and 1.
•
max min
max min if L 1
Sc 2
max min
2 max min if L 1
2
•
GB
max min if R max
• If Ht < 0, HtB:=
R Ht + 6
H
t max min 2 if G max
R G
4 if B max
max min
• H = Ht 60°
Removal of the Brightness Dependence
of the Saturation (1)
• HSV model
max R, G, B min R, G, B
if max R, G, B 0
S HSV max R, G, B
0 otherwise
Com
pa r
e to
Or your own
Y 0.2126 R 0.7152G 0.0722 B favourite
brightness
S max R, G, B min R, G, B
expression.
R 12 G 12 B
H arccos
R 2 G 2 B 2 RG RB BG 2
1
Trigonometric
version is more
accurate.
360 H if B G
H
H otherwise
Contents
• Introduction
• Processing Vectorial Images
• Alternative Colour Spaces
• 3D-polar Coordinate Colour Spaces
• Processing and Analysing Colour Images
Processing and Analysing Colour Images
G
Change of representation
S
H
S
H
Change of representation
B
R
G
Processing the Hue Component
n=3
Mean
• Given n values of the hue Hi
• The mean direction H is calculated as follows:
n n (1)
A cos H i , B sin H i , R A2 B 2 2
i 1 i 1
arctan BA if B 0(2)
,A0
H arctan BA if A0
arctan B 2 if B 0, A 0
• R is: A
The mean length
(3)
R
R
n
Hue Mean which Takes the Saturation
Into Account
• The previous formulation is standard in the texts on circular
statistics, but it ignores the fact that not all hues have the same
importance.
• We take this into account by weighting the length of each hue
vector by the associated saturation value.
n=3
• Let Si be the saturation associated with hue Hi.
• We replace equation (1) by:
n n
AS S i cos H i , BS Si sin H i , RS2 AS2 BS2
i 1 the saturation-weighted
• To calculate i 1 mean direction H , we replace A and
S
B by AS and BS in equation (2).
• Equation (3) becomes:
RS
RS
• Note that RS remains a measure ofn theS i
angular dispersion, and does not
i 1 saturation.
give information on the mean of the
Example • H = 327°
• R = 0.24
Colour Image
Weighted
• HS = 20°
• R = 0.16 Hue threshold
S 307° - 347°
Hue histogram
Hue
histogram
Mathematical Morphology in a
3D-Polar Coordinate Colour Space
• One can easily order the brightness and saturation
1 1
values.
• On the other hand, the hue is defined on the circle,
for which there is no obvious order (blue larger than
red?, green smaller than red? ).
0 0
• Applying morphological operators to the brightness
L S
and saturation is therefore easy.
– We just have to be sure that we order the vectors and not
the components (i.e. marginal order), so as to avoid
introducing false colours.
– For this purpose we use the lexicographical order.
H 0°
• Applying mathematical morphology to the hue is
trickier, and won’t be discussed in this talk.
Lexicographical Order
• This is the order in which words are
arranged in a dictionary.
Aardvark
Abacus
Abandon
.
.
.
Borough
Bough
.
.
Lexicographical Order for Vectors
• For example, given two vectors x = (x1, x2, x3) and y = (y1, y2, y3):
x1 y1
or
x y if x1 y1 and x2 y 2
or
x1 y1 and x2 y 2 and x3 y3
Opening
Erosion
top level
Closing
Dilation
Original Image
(293 418)
SE: Square of
size 5 5
Lexicographical Order with
Saturation at the Top Level
• We define
S i S j
or
ci c j if S i S j and Li L j
or
Si S j and Li L j and Hi H0 H j H0
• and
Si S j
or
ci c j if S i S j and Li L j
or
Si S j and Li L j and H i H 0 H j H 0
Example
Saturation at the
Opening
Erosion
top level
Closing
Dilation
Original image
(293 418)
SE: Square of
size 5 5
Colour Top-Hat
• We can define a top-hat operator for colour
images similar to the one used for greyscale
images.
• We simply calculate the Euclidean distance DE
between each corresponding pixel of the
original image I and the result
E I , I of one of the
colour opening g or closing operators:
– Opening top-hat: E I , I
– Closing top-hat:
Original Image Saturation
Example