Digital Image Processing
Color Models &Processing
Dr. Hatem Elaydi Electrical Engineering Department
Islamic University of Gaza
Fall 2015
Nov 16, 2015
2
• Color interpretation
– Color spectrum vs. electromagnetic spectrum
– Why does CIE standard specify R, G, B as the primary colors? Are there actually single special band as R, G, or B?
– What is additive color system? What is subtractive color system?
– What is hue and saturation? or what is chromaticity?
– What is chromaticity diagram? tristimulus? Why can't the three primary colors generate all the visible colors specified in the diagram? Where is brown?
– Comment on the different usages of RGB, CMYK, HSI, and L*a*b* color models. What is the color gamut of color monitors, color printing devices, and L*a*b*?
• Color processing
– What is the difference between tonal and color correction?
– What is the difference between processing using RGB model vs. HSI model?
3
Color spectrum
When passing through a prism, a beam of sunlight
is decomposed into a spectrum of colors: violet,
blue, green, yellow, orange, red
1666, Sir Isaac Newton
4
Electromagnetic energy spectrum
Ultraviolet visible light infrared
The longer the wavelength (meter), the lower the frequency (Hz),
and the lower the energy (electron volts)
The discovery of infrared (1800, Sir Frederick William Herschel)
What is infrared? http://coolcosmos.ipac.caltech.edu/cosmic_classroom/ir_tutorial/
5
A typical spectral reflectance pattern
of green vegetation
6
Primary colors of human vision
Cones are divided into three sensible categories
– 65% of cones are sensitive to red light
– 33% are sensitive to green light
– 2% are sensitive to blue light
For this reason, red, green, and blue are referred to as the primary colors of human vision. CIE standard designated three specific wavelength to these three colors in 1931.
– Red (R) = 700 nm
– Green (G) = 546.1 nm
– Blue (B) = 435.8 nm
Detailed experimental
Curve available in 1965
Detailed experimental
curve available in 1965
7
Color models
• RGB model
– Color monitor, color video cameras
• CMY model
– Color printers
• HIS, HSV model
– Color image manipulation
• YIQ : Color TV, Y(luminance), I(Inphase),
Q(quadrature)
CIE Standard
• CIE: International Commission on
Illumination (Comission Internationale de
l’Eclairage).
• Human perception based standard (1931),
established with color matching experiment
• Standard observer: a composite of a group
of 15 to 20 people
CIE xyY Space • Irregular 3D volume shape is
difficult to understand
• Chromaticity diagram (the same
color of the varying intensity, Y,
should all end up at the same
point)
Color Image Processing
• RGB Model
• Pixel depth – nr of bits used to represent
each pixel
– Full color image (24 bits)
11
Primary colors of pigment
A primary color of pigment refers to one that absorbs the primary color of the light, but reflects the other two.
Primary color of pigments are magenta, cyan, and yellow
Secondary color of pigments are then red, green, and blue
12
Additive vs. Subtractive color
system involves light emitted directly
from a source
mixes various amounts of red,
green and blue light to produce
other colors.
Combining one of these
additive primary colors with
another produces the additive
secondary colors cyan,
magenta, yellow.
Combining all three primary
colors produces white.
Subtractive color starts with an
object that reflects light and
uses colorants to subtract
portions of the white light
illuminating an object to
produce other colors.
If an object reflects all the
white light back to the viewer,
it appears white.
If an object absorbs (subtracts)
all the light illuminating it, it
appears black.
13
Color characterization
Brightness: chromatic notion of intensity
Hue: dominant color perceived by an observer
Saturation: relative purity or the amount of
white mixed with a hue
R
G
B
H S
0o
120o
240o
Color Image Processing
• CMY Model
– Color Printer, Color Copier
– RGB data CMY
B
G
R
Y
M
C
1
1
1
B
G
R
Q
I
Y
311.0523.0212.0
321.0275.0596.0
114.0587.0299.0
Q
I
Y
B
G
R
705.1108.11
647.0272.01
620.0956.01
The HSI Color Model This color model is based on polar coordinates, not
Cartesian coordinates.
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
Color Image Processing
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
HSV Hexcone
• Intuitive interface to color
RGB -> HSI -> RGB
RGB
Image
Saturation
Hue
Intensity
RGB -> HSI -> RGB
Hue
Intensity
Saturation
RGB
Image
Color Image Processing
• RGB to HSI Conversion
1,,,0 where),(3
1 BGRIBGRI
002
1 if },))(()(
)]()[(2
1
{cos bgBGBRGR
BRGR
H
00 if ,360 bgHH
}),,(min{3
1 BGRBGR
S
IBbIGg / ,/ where 00
Color Image Processing
• HSI to RGB Conversion
BRG
H
HSR
SB
1
])60cos(
cos1[
3
1
)1(3
1
1200 assume H
23
HSI-to-RGB conversion …
For 120o <= H < 240o
For 240o <= H < 360o
( )( )
( ) GRIBSIRH
HSIG --=-=ú
û
ùêë
é
-
-+= ,1,
180cos
120cos1
( )( )
( ) BGIRSIGH
HSIB --=-=ú
û
ùêë
é
-
-+= ,1,
300cos
240cos1
Chromatic images
• Colour
– Represented by vector not scalar
• Red, Green, Blue (RGB)
• Hue, Saturation, Value (HSV)
• luminance, chrominance (Yuv , Luv)
Red
Green
Hue degrees:
Red, 0 deg
Green 120 deg
Blue 240 deg
Green
V=0
S=0
Lab: Photoshop
• Photoshop uses this model to get
more control over color
• It’s named CIE Lab model (refined
from the original CIE model
• Liminance: L
• Chrominance: a – ranges from green
to red and b ranges from blue to
yellow
Luv and UVW • A color model for which, a unit change in luminance and
chrominance are uniformly perceptible U = 13 W* (u - uo ); V = 13 W* (v - vo); W = 25 ( 100 Y ) 1/3 - 17
where Y , u and v can be calculated from :
X = O.607 Rn + 0.174 Gn + 0.200Bn
Y = 0.299 Rn + 0.587 Gn + 0.114Bn
Z = 0.066 Gn + 1.116 Bn
x = X / ( X + Y + Z )
y = Y / ( X + Y + Z )
z = Z / ( X + Y + Z )
u = 4x / ( -2x + 12y + 3 )
v = 6y / ( -2x + 12y + 3 )
• Luv is derived from UVW and Lab, with all components guaranteed to be positive
Yuv and YCrCb: digital video • Initially, for PAL analog video, it is now also used in CCIR
601 standard for digital video
• Y (luminance) is the CIE Y primary. Y = 0.299R + 0.587G + 0.114B
• Chrominance is defined as the difference between a color and a reference white at the same luminance. It can be represented by U and V -- the color differences. U = B – Y; V = R - Y
• YCrCb is a scaled and shifted version of YUV and used in JPEG and MPEG (all components are positive)
Cb = (B - Y) / 1.772 + 0.5; Cr = (R - Y) / 1.402 + 0.5
Examples (RGB, HSV, Luv)
Gamma correction
• Without gamma correction, how will
(0,255,127) look like?
• Normally gamma is within 1.7 and 2.8
• Who is responsible for Gamma correction?
• SGI does it for you
• PC/Mac etc, you should do it yourself
No gamma correction
Gamma corrected to 1.7
Pseudo color 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
Color Image Processing
Color Image Processing
Color Image Processing
Color Image Processing
Color Image Processing
Color Image Processing