Lecture 3 - Color Image Processing
Lecture 3 - Color Image Processing
Lecture 3 - Color Image Processing
Preview
Motive
- Color is a powerful descriptor that often simplifies
object identification and extraction from a scene.
- Human can discern thousands of color shades and
intensities, compared to about only two dozen
shades of gray.
H.R. Pourreza
Preview
H.R. Pourreza
Preview
H.R. Pourreza
Preview
H.R. Pourreza
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
6
Electromagnetic energy spectrum
7
Color Fundamentals (con’t)
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
H.R. Pourreza
Physical Background
scene
Illumination source
reflection
eye
Achromatic vs Chromatic Light
– Radiance
• The total amount of Energy that flows from a Light Source
• It is measured in Watts
– Luminance
• Luminance gives a measure of amount of energy an observer
perceives from a light source (measured in Lumens(lm) )
• For example light emitted from a source operating in Infrared region
of Spectrum could have significant energy (Radiance) but a human
observer will hardly perceive it so luminance is zero.
– Brightness
• It is a subjective measure
• It embodies the achromatic notion of intensity and is one of the key
factors in describing color sensation
Some questions
What does it mean when we say an object is in a
certain color?
Why are the primary colors of human vision red,
green, and blue?
Is it true that different portions of red, green, and
blue can produce all the visible color?
What kind of color model is the most suitable one to
describe human vision?
14
Human Perception
– Magenta (Red+Blue)
– Cyan (Green+Blue)
– Yellow (Red+Green)
Primary colors of human vision
Cones are divided into three sensible
categories
Detailed experimental
Detailed experimental – 65% of cones are sensitive to red light
curve
Curveavailable
availableinin1965
1965 – 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 (
International Commission on Illumination)
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
17
Some clarifications
No single color may be called red, green, or
blue.
R, G, B are only specified by standard.
18
Secondary colors
Magenta (R + B)
Cyan (G + B)
Yellow (R + G)
19
Primary Color of Light vs Primary Color of Pigments
Color of light: R G B
• Thus x+y+z=1
Chromaticity Diagram
z=1-x-y
Chromaticity Diagram
Chromaticity Diagram
To determine the range of
colors that can be obtained
from the 3 given colors in the
CD, we simply draw
connecting lines to each of
the three color points.
The result is a triangle and
any color inside a triangle is
produced by various
combinations of the three
initial colors.
The triangle shows a typical
range of colors (called the
color gamut) produced by
RGB monitor
Additive vs. Subtractive color system
27
Color characterization
120o
G
S
H
R 0o
240o B 28
Some clarifications
So when we call an object red, orange, etc. we
refer to its hue
Chromaticity: hue + saturation
29
Color Models
• The purpose of a color model (also called Color Space or Color
System) is to facilitate the specification of colors in some
standard way
• Color Models
• Most devices that deposit color pigments on paper (such as Color Printers
and Copiers) requires CMY data input or perform RGB to CMY conversion
internally
C 1.00 R
M = 1.00
- G
Y 1.00 B
CMY and CMYK Color Model
– Intensity
• Distinguishes the gray levels.
HSI Color Model
47
RGB-to-HSI conversion (*)
1
I = (R + G + B )
3
3
S =1 - min (R, G, B )
I
é 1 ù
[(R - G )+ (R - B )]
-1ê 2 ú
q =cos ê ú
2
ê (R - G ) + (R - B )(G - B )ú
ë û
ìq G³B
H =í
î2p - q G £B
48
HSI-to-RGB conversion (*)
For 0o <= H < 120o
é S cos(H ) ù
R =I ê1 + ú, B =I (1 - S ), G =I - R - B
ë cos(60 - H )û
49
RGB vs. HSI
50
• Adding white pigment to a pure color produces a tint. For
example, adding white to red makes pink.
• Adding black pigment to a pure color produces a shade. For
example, adding black to red makes dark red.
• Adding both white and black to a pure color produces a tone.
• A mixture of white and black, with no color added, produces a
shade of gray.
51
Color Wheel
52
Color Image to Greyscale Image
Conversion
To convert a color from a colorspace based on an
RGB color model to a grayscale representation of
its luminance, weighted sums must be calculated in
a linear RGB space,
HSV Color Model
• The hue (H) of a color refers to which pure color it resembles.
All tints, tones and shades of red have the same hue.
• Hues are described by a number that specifies the position of the
corresponding pure color on the color wheel, as a fraction
between 0 and 1. Value 0 refers to red; 1/6 is yellow; 1/3 is
green; and so forth around the color wheel.
• The saturation (S) of a color describes how white the color is. A
pure red is fully saturated, with a saturation of 1; tints of red have
saturations less than 1; and white has a saturation of 0.
• The value (V) of a color, also called its lightness, describes how
dark the color is. A value of 0 is black, with increasing lightness
moving away from black.
54
Hexacone Model of the Color
space
55
• The outer edge of the top of the cone is the color wheel, with
all the pure colors. The H parameter describes the angle around
the wheel.
• The S (saturation) is zero for any color on the axis of the cone;
the center of the top circle is white. An increase in the value of
S corresponds to a movement away from the axis.
• The V (value or lightness) is zero for black. An increase in the
value of V corresponds to a movement away from black and
toward the top of the cone.
56
HSV Model
HSV to RGB
HSV to RGB
Problem
Let the RGB values of a point be (0.4, 0.6,
0.8). Find the HSV equivalent of RGB. Also
verify whether the original point can be
obtained by the inverse transform from HSV
to RGB.
Solution
Let the RGB values of a point be (0.4, 0.6, 0.8).
Find the HSV equivalent of RGB. Also verify
whether the original point can be obtained by
the inverse transform from HSV to RGB.
Solution:
Kmax = 0.8
Kmin = 0.4
K = Kmax – Kmin = 0.8 – 0.4 = 0.4
Therefore,
V = Kmax = 0.8
Solution
S = K / Kmax = 0.4 / 0.8 = 0.5
R’ = (Kmax – R) / K =(0.8 – 0.4) / 0.4 = 1
G’ = (Kmax – G) / K =(0.8 – 0.6) / 0.4 = 0.5
B’ = (Kmax – B) / K =(0.8 – 0.8) / 0.4 = 0
– http://colorizer.org/
69
Color Quantization
The process of converting mathematical model in to
image is called rendering.
During rendering the RGB color components may be
floating point numbers. Therefore , it is necessary to
convert it in to binary values for proper display.
Conversion of floating values to binary is called
quantization.
The process of picking the best 256 colors are also called
color quantization.
Color Quantization
Quantization
• Reduce the number of bits used to store each
coefficient by dividing by a given value
– If you have an 8 bit number (0-255) and divide it by 8, you
get a number between 0-31 (5 bits = 8 bits – 3 bits)
– Different coefficients are divided by different amounts
– Perceptual issues come in here
• Achieves the greatest compression, but also quality
loss
• “Quality” knob controls how much quantization is
done
09/17/02 (C) 2002, University of Wisconsin, CS 559
Color Quantization
• The problem of reducing the number of colors
in an image with minimal impact on appearance
– Extreme case: 24 bit color to black and white
– Less extreme: 24 bit color to 256 colors, or 256
grays
• Sub problems:
– Decide which colors to use (if there is a choice)
– Decide which of those each original color maps to
79
Uniform Quantization
84
Color image processing
• Pseudo-color image processing
– Assign color to monochrome images
– Intensity slicing
– Gray level to color transformation
• Spatial domain approach – three different transformation
functions
• Frequency domain approach – three different filters
• Full-color image processing
– Color image enhancement and restoration
– Color compensation
85
Intensity slicing
Similar to c2
thresholding c1
0 Ii L
86
Gray level to color transformation – spatial
domain
Perform three independent transformations on the gray level
of any input pixel.
The three results can then serve as the red, green, and blue
components of a color image
87
Examples
88
Example 2
89
Gray level to color transformation –
frequency domain
Color code regions of an image based on frequency content
The Fourier transform of an image is modified independently by three filters to
produce three images used as Fourier transform of the R, G, B components of a
color image
Additional processing can be any image enhancement algorithm like histogram
equalization
90
Example
Red from highpass
Green from bandpass
Blue from lowpass
91
Full-color image processing
Color transformations
– Processing in RGB, HSI, or CMY(K) space
Tone and color corrections
– Calibrate images using the CIELAB model (L*a*b* model)
Point-based processing
Mask-based processing
92
Adjusting intensity in different color
spaces
93
Color gamut of color monitor and
color printing
94
CIELAB (L*a*b* color model)
Maintain a high degree of color consistency between the
monitors used and the eventual output devices
Device-independent color model that relates the color
gamuts of the monitors and output devices
æY ö
L* =116.hç ÷- 16
çY ÷
èWø The CIELAB gamut encompasses
é æ X ö æY the entire visible spectrum and
öù
a* =500 êhç
çX ÷÷- hçç ÷ú
÷ can represent accurately the
ë è W ø èYW øû colors of any display, print, or
é æ Y ö æ Z öù input device
b* =200 êhç
çZ ÷ ÷- hç çZ ÷ ÷ú
ë è W ø è W øû
ì3 q q > 0.008856
h(q) =í 95
î7.787 q + 16 / 116 q £0.008856
Tonal
correction
example
Color is not
changed
(RGB or I)
96
Color
correction
example
97
Histogram processing
98
Mask-based processing
Per-image basis vs. direct operation on color
vector space
f ( x, y ) =s
ér ù
ê ú
f ( x, y ) =êg ú
ê
ëb ú
û
99
Color image
smoothing
100
Color image sharpening
101
Color edge detection
Section 6.7.3
102
Noise in color image
103
104
105