SlideShare ist ein Scribd-Unternehmen logo
1 von 89
Downloaden Sie, um offline zu lesen
Digital Image Processing
Chapter 6:
Color Image Processing
Digital Image Processing
Chapter 6:
Color Image Processing
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Spectrum of White Light
Spectrum of White Light
1666 Sir Isaac Newton, 24 year old, discovered white light spectrum.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Electromagnetic Spectrum
Electromagnetic Spectrum
Visible light wavelength: from around 400 to 700 nm
1. For an achromatic (monochrome) light source,
there is only 1 attribute to describe the quality: intensity
2. For a chromatic light source, there are 3 attributes to describe
the quality:
Radiance = total amount of energy flow from a light source (Watts)
Luminance = amount of energy received by an observer (lumens)
Brightness = intensity
The Eye
Figure is from slides at
Gonzalez/ Woods DIP book
website (Chapter 2)
UMCP
ENEE631
Slides
(created
by
M.Wu
©
2004)
Cross section illustration
Cross section illustration
Two Types of Photoreceptors at Retina
Two Types of Photoreceptors at Retina
• Rods
– Long and thin
– Large quantity (~ 100 million)
– Provide scotopic vision (i.e., dim light vision or at low illumination)
– Only extract luminance information and provide a general overall picture
• Cones
– Short and thick, densely packed in fovea (center of retina)
– Much fewer (~ 6.5 million) and less sensitive to light than rods
– Provide photopic vision (i.e., bright light vision or at high illumination)
– Help resolve fine details as each cone is connected to its own nerve end
– Responsible for color vision
– Mesopic vision
• provided at intermediate illumination by both rod and cones
our interest
(well-lighted display)
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Sensitivity of Cones in the Human Eye
Sensitivity of Cones in the Human Eye
6-7 millions cones
in a human eye
- 65% sensitive to Red light
- 33% sensitive to Green light
- 2 % sensitive to Blue light
Primary colors:
Defined CIE in 1931
Red = 700 nm
Green = 546.1nm
Blue = 435.8 nm
CIE = Commission Internationale de l’Eclairage
(The International Commission on Illumination)
Luminance vs. Brightness
Luminance vs. Brightness
• Luminance (or intensity)
– Independent of the luminance of surroundings
I(x,y,λ) -- spatial light distribution
V(λ) -- relative luminous efficiency func. of visual system ~ bell shape
(different for scotopic vs. photopic vision;
highest for green wavelength, second for red, and least for blue )
• Brightness
– Perceived luminance
– Depends on surrounding luminance
Same lum.
Different
brightness
Different lum.
Similar
brightness
Luminance vs. Brightness (cont’d)
Luminance vs. Brightness (cont’d)
• Example: visible digital watermark
– How to make the watermark
appears the same graylevel
all over the image?
from IBM Watson web page
“Vatican Digital Library”
Look into Simultaneous Contrast Phenomenon
Look into Simultaneous Contrast Phenomenon
• Human perception more sensitive to luminance
contrast than absolute luminance
• Weber’s Law: | Ls – L0 | / L0 = const
– Luminance of an object (L0) is set to be just noticeable
from luminance of surround (Ls)
– For just-noticeable luminance difference ∆L:
∆L / L ≈ d( log L ) ≈ 0.02 (const)
• equal increments in log luminance are perceived as equally different
• Empirical luminance-to-contrast models
– Assume L ∈ [1, 100], and c ∈ [0, 100]
– c = 50 log10 L (logarithmic law, widely used)
– c = 21.9 L1/3 (cubic root law)
Mach Bands
• Visual system tends to undershoot or overshoot around the
boundary of regions of different intensities
è Demonstrates the perceived brightness is not a simple
function of light intensity
Figure is from slides
at Gonzalez/ Woods
DIP book website
(Chapter 2)
UMCP
ENEE631
Slides
(created
by
M.Wu
©
2004)
Color of Light
Color of Light
• Perceived color depends on spectral content (wavelength
composition)
– e.g., 700nm ~ red.
– “spectral color”
• A light with very narrow bandwidth
• A light with equal energy in all visible bands appears
white
“Spectrum” from http://www.physics.sfasu.edu/astro/color.html
UMCP
ENEE408G
Slides
(created
by
M.Wu
&
R.Liu
©
2002)
Primary and Secondary Colors
Primary and Secondary Colors
Primary
color
Primary
color
Primary
color
Secondary
colors
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Primary and Secondary Colors (cont.)
Primary and Secondary Colors (cont.)
Additive primary colors: RGB
use in the case of light sources
such as color monitors
Subtractive primary colors: CMY
use in the case of pigments in
printing devices
RGB add together to get white
White subtracted by CMY to get
Black
Representation by Three Primary Colors
Representation by Three Primary Colors
• Any color can be reproduced by mixing an appropriate set of
three primary colors (Thomas Young, 1802)
• Three types of cones in human retina
– Absorption response Si(λ) has peaks around 450nm (blue), 550nm
(green), 620nm (yellow-green)
– Color sensation depends on the spectral response {α1(C), α2(C),
α3(C) } rather than the complete light spectrum C(λ)
∫ S1(λ) C(λ) d λ
∫ S2(λ) C(λ) d λ
∫ S3(λ) C(λ) d λ
C(λ)
color light
α1(C)
α2(C)
α3(C)
Identically
perceived colors
if αi (C1) = αi (C2)
Example: Seeing Yellow Without Yellow
Example: Seeing Yellow Without Yellow
mix green and red light to obtain perception of
yellow, without shining a single yellow photon
520nm 630nm
570nm
=
“Seeing Yellow” figure is from B.Liu ELE330 S’01 lecture notes @ Princeton;
R/G/B cone response is from slides at Gonzalez/ Woods DIP book website
Color Matching and Reproduction
Color Matching and Reproduction
• Mixture of three primaries: C = Sum(βk Pk (λ) )
• To match a given color C1
– adjust βk such that αi (C1) = αi (C), i = 1,2,3.
• Tristimulus values Tk (C)
– Tk (C) = βk / wk
wk – the amount of kth primary to match the reference white
• Chromaticity tk = Tk / (T1+T2+T3)
– t1+t2+t3 = 1
– visualize (t1, t2 ) to obtain chromaticity diagram
Hue: dominant color corresponding to a dominant
wavelength of mixture light wave
Saturation: Relative purity or amount of white light mixed
with a hue (inversely proportional to amount of white
light added)
Brightness: Intensity
Color Characterization
Color Characterization
Hue
Saturation
Chromaticity
amount of red (X), green (Y) and blue (Z) to form any particular
color is called tristimulus.
Perceptual Attributes of Color
Perceptual Attributes of Color
• Value of Brightness
(perceived luminance)
• Chrominance
– Hue
• specify color tone (redness, greenness, etc.)
• depend on peak wavelength
– Saturation
• describe how pure the color is
• depend on the spread (bandwidth) of light
spectrum
• reflect how much white light is added
• RGB ó HSV Conversion ~ nonlinear
HSV circular cone is from online
documentation of Matlab image
processing toolbox
http://www.mathworks.com/access
/helpdesk/help/toolbox/images/col
or10.shtml
UMCP
ENEE408G
Slides
(created
by
M.Wu
&
R.Liu
©
2002)
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
CIE Chromaticity Diagram
CIE Chromaticity Diagram
Trichromatic coefficients:
Z
Y
X
X
x
+
+
=
Z
Y
X
Y
y
+
+
=
Z
Y
X
Z
z
+
+
=
1
=
+
+ z
y
x
x
y
Points on the boundary are
fully saturated colors
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Color Gamut of Color Monitors and Printing Devices
Color Gamut of Color Monitors and Printing Devices
Color Monitors
Printing devices
CIE Color Coordinates (cont’d)
CIE Color Coordinates (cont’d)
• CIE XYZ system
– hypothetical primary sources to yield all-positive spectral
tristimulus values
– Y ~ luminance
• Color gamut of 3 primaries
– Colors on line C1 and C2 can be
produced by linear mixture of the two
– Colors inside the triangle gamut
can be reproduced by three primaries
From http://www.cs.rit.edu/~ncs/color/t_chroma.html
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
RGB Color Model
RGB Color Model
Purpose of color models: to facilitate the specification of colors in
some standard
RGB color models:
- based on cartesian
coordinate system
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
RGB Color Cube
RGB Color Cube
R = 8 bits
G = 8 bits
B = 8 bits
Color depth 24 bits
= 16777216 colors
Hidden faces
of the cube
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
RGB Color Model (cont.)
RGB Color Model (cont.)
Red fixed at 127
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Safe RGB Colors
Safe RGB Colors
Safe RGB colors: a subset of RGB colors.
There are 216 colors common in most operating systems.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
RGB Safe
RGB Safe-
-color Cube
color Cube
The RGB Cube is divided into
6 intervals on each axis to achieve
the total 63 = 216 common colors.
However, for 8 bit color
representation, there are the total
256 colors. Therefore, the remaining
40 colors are left to OS.
CMY and CMYK Color Models
CMY and CMYK Color Models
C = Cyan
M = Magenta
Y = Yellow
K = Black
• Primary colors for pigment
– Defined as one that subtracts/absorbs a
primary color of light & reflects the
other two
• CMY – Cyan, Magenta, Yellow
– Complementary to RGB
– Proper mix of them produces black










−










=










B
G
R
Y
M
C
1
1
1
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
HSI Color Model
HSI Color Model
RGB, CMY models are not good for human interpreting
HSI Color model:
Hue: Dominant color
Saturation: Relative purity (inversely proportional
to amount of white light added)
Intensity: Brightness
Color carrying
information
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Relationship Between RGB and HSI Color Models
Relationship Between RGB and HSI Color Models
RGB HSI
Hue and Saturation on Color Planes
Hue and Saturation on Color Planes
1. A dot is the plane is an arbitrary color
2. Hue is an angle from a red axis.
3. Saturation is a distance to the point.
HSI Color Model (cont.)
HSI Color Model (cont.)
Intensity is given by a position on the vertical axis.
HSI Color Model
HSI Color Model
Intensity is given by a position on the vertical axis.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Example: HSI Components of RGB Cube
Example: HSI Components of RGB Cube
Hue Saturation Intensity
RGB Cube
Converting Colors from RGB to HSI
Converting Colors from RGB to HSI



>
−
≤
=
G
B
G
B
H
if
360
if
θ
θ
[ ]
[ ] 









−
−
+
−
−
+
−
= −
2
/
1
2
1
)
)(
(
)
(
)
(
)
(
2
1
cos
B
G
B
R
G
R
B
R
G
R
θ
B
G
R
S
+
+
−
=
3
1
)
(
3
1
B
G
R
I +
+
=
Converting Colors from HSI to RGB
Converting Colors from HSI to RGB
)
1
( S
I
B −
=






−
+
=
)
60
cos(
cos
1
H
H
S
I
R o
)
(
1 B
R
G +
−
=
RG sector: 120
0 <
≤ H GB sector: 240
120 <
≤ H
)
1
( S
I
R −
=






−
+
=
)
60
cos(
cos
1
H
H
S
I
G o
)
(
1 G
R
B +
−
=
)
1
( S
I
G −
=






−
+
=
)
60
cos(
cos
1
H
H
S
I
B o
)
(
1 B
G
R +
−
=
BR sector: 360
240 ≤
≤ H
120
−
= H
H
240
−
= H
H
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Example: HSI Components of RGB Colors
Example: HSI Components of RGB Colors
Hue
Saturation Intensity
RGB
Image
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Example: Manipulating HSI Components
Example: Manipulating HSI Components
Hue
Saturation Intensity
RGB
Image Hue Saturation
Intensity RGB
Image
Color Coordinates Used in TV Transmission
Color Coordinates Used in TV Transmission
• Facilitate sending color video via 6MHz mono TV
channel
• YIQ for NTSC (National Television Systems Committee)
transmission system
– Use receiver primary system (RN, GN, BN) as TV receivers
standard
– Transmission system use (Y, I, Q) color coordinate
• Y ~ luminance, I & Q ~ chrominance
• I & Q are transmitted in through orthogonal carriers at the same freq.
• YUV (YCbCr) for PAL and digital video
– Y ~ luminance, Cb and Cr ~ chrominance
Color Coordinates
Color Coordinates
• RGB of CIE
• XYZ of CIE
• RGB of NTSC
• YIQ of NTSC
• YUV (YCbCr)
• CMY
Examples
Examples
HSV
YUV
RGB
Examples
Examples
RGB
HSV
YIQ
Summary
Summary
• Monochrome human vision
– visual properties: luminance vs. brightness, etc.
– image fidelity criteria
• Color
– Color representations and three primary colors
– Color coordinates
UMCP
ENEE631
Slides
(created
by
M.Wu
©
2004)
Color Image Processing
Color Image Processing
There are 2 types of color image processes
1. Pseudocolor image process: Assigning colors to gray
values based on a specific criterion. Gray scale images to be processed
may be a single image or multiple images such as multispectral images
2. Full color image process: The process to manipulate real
color images such as color photographs.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Pseudocolor Image Processing
Pseudocolor Image Processing
Why we need to assign colors to gray scale image?
Answer: Human can distinguish different colors better than different
shades of gray.
Pseudo color = false color : In some case there is no “color” concept
for a gray scale image but we can assign “false” colors to an image.
Intensity Slicing or Density Slicing
Intensity Slicing or Density Slicing



>
≤
=
T
y
x
f
C
T
y
x
f
C
y
x
g
)
,
(
if
)
,
(
if
)
,
(
2
1
Formula:
C1 = Color No. 1
C2 = Color No. 2
T
Intensity
Color
C1
C2
T
0 L-1
A gray scale image viewed as a 3D surface.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Intensity Slicing Example
Intensity Slicing Example
An X-ray image of a weld with cracks
After assigning a yellow color to pixels with
value 255 and a blue color to all other pixels.
Multi Level Intensity Slicing
Multi Level Intensity Slicing
k
k
k l
y
x
f
l
C
y
x
g ≤
<
= − )
,
(
for
)
,
( 1
Ck = Color No. k
lk = Threshold level k
Intensity
Color
C
1
C2
0
L-1
l1 l2 l3 lk
lk-1
C3
Ck-1
Ck
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Multi Level Intensity Slicing Example
Multi Level Intensity Slicing Example
k
k
k l
y
x
f
l
C
y
x
g ≤
<
= − )
,
(
for
)
,
( 1
Ck = Color No. k
lk = Threshold level k
An X-ray image of the Picker
Thyroid Phantom.
After density slicing into 8 colors
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Color Coding Example
Color Coding Example
Gray-scale image of average
monthly rainfall.
Color coded image South America region
Gray
Scale
Color
map
0
10
>20
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Gray Level to Color Transformation
Gray Level to Color Transformation
Assigning colors to gray levels based on specific mapping functions
Red component
Green component
Blue component
Gray scale image
(Images from Rafael C.
Gonzalez and Richard
E. Wood, Digital Image
Processing, 2nd Edition.
Gray Level to Color Transformation Example
Gray Level to Color Transformation Example
An X-ray image of a
garment bag with a
simulated explosive
device
An X-ray image
of a garment bag
Color
coded
images
Transformations
(Images from Rafael C.
Gonzalez and Richard
E. Wood, Digital Image
Processing, 2nd Edition.
Gray Level to Color Transformation Example
Gray Level to Color Transformation Example
An X-ray image of a
garment bag with a
simulated explosive
device
An X-ray image
of a garment bag
Color
coded
images
Transformations
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Pseudocolor Coding
Pseudocolor Coding
Used in the case where there are many monochrome images such as multispectral
satellite images.
Pseudocolor Coding Example
Pseudocolor Coding Example
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Pseudocolor Coding Example
Pseudocolor Coding Example
Washington D.C. area
Visible blue
λ= 0.45-0.52 µm
Max water penetration
Visible green
λ= 0.52-0.60 µm
Measuring plant
Visible red
λ= 0.63-0.69 µm
Plant discrimination
Near infrared
λ= 0.76-0.90 µm
Biomass and shoreline mapping
1 2
3 4 Red =
Green =
Blue =
Color composite images
1
2
3
Red =
Green =
Blue =
1
2
4
Better visualization àShow quite
clearly the difference between
biomass (red) and human-made features.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Pseudocolor Coding Example
Pseudocolor Coding Example
Psuedocolor rendition
of Jupiter moon Io
A close-up
Yellow areas = older sulfur deposits.
Red areas = material ejected from
active volcanoes.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Basics of Full
Basics of Full-
-Color Image Processing
Color Image Processing
2 Methods:
1. Per-color-component processing: process each component separately.
2. Vector processing: treat each pixel as a vector to be processed.
Example of per-color-component processing: smoothing an image
By smoothing each RGB component separately.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Example:
Example: Full
Full-
-Color Image and Variouis Color Space Components
Color Image and Variouis Color Space Components
Color image
CMYK components
RGB components
HSI components
Color Transformation
Color Transformation
Formulation:
[ ]
)
,
(
)
,
( y
x
f
T
y
x
g =
f(x,y) = input color image, g(x,y) = output color image
T = operation on f over a spatial neighborhood of (x,y)
When only data at one pixel is used in the transformation, we
can express the transformation as:
)
,
,
,
( 2
1 n
i
i r
r
r
T
s K
= i= 1, 2, …, n
Where ri = color component of f(x,y)
si = color component of g(x,y)
Use to transform colors to colors.
For RGB images, n = 3
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Example: Color Transformation
Example: Color Transformation
)
,
(
)
,
(
)
,
(
)
,
(
)
,
(
)
,
(
y
x
kr
y
x
s
y
x
kr
y
x
s
y
x
kr
y
x
s
B
B
G
G
R
R
=
=
=
Formula for RGB:
)
,
(
)
,
( y
x
kr
y
x
s I
I =
Formula for CMY:
)
1
(
)
,
(
)
,
(
)
1
(
)
,
(
)
,
(
)
1
(
)
,
(
)
,
(
k
y
x
kr
y
x
s
k
y
x
kr
y
x
s
k
y
x
kr
y
x
s
Y
Y
M
M
C
C
−
+
=
−
+
=
−
+
=
Formula for HSI:
These 3 transformations give
the same results.
k = 0.7
I H,S
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Color Complements
Color Complements
Color complement replaces each color with its opposite color in the
color circle of the Hue component. This operation is analogous to
image negative in a gray scale image.
Color circle
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Color Complement Transformation Example
Color Complement Transformation Example
Color Slicing Transformation
Color Slicing Transformation











>
−
= ≤
≤
otherwise
2
if
5
.
0
1
i
n
j
any
j
j
i
r
W
a
r
s
We can perform “slicing” in color space: if the color of each pixel
is far from a desired color more than threshold distance, we set that
color to some specific color such as gray, otherwise we keep the
original color unchanged.
i= 1, 2, …, n
or
( )





>
−
= ∑
=
otherwise
if
5
.
0
1
2
0
2
i
n
j
j
j
i
r
R
a
r
s
Set to gray
Keep the original
color
Set to gray
Keep the original
color
i= 1, 2, …, n
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Color Slicing Transformation Example
Color Slicing Transformation Example
Original image
After color slicing
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Tonal Correction Examples
Tonal Correction Examples
In these examples, only
brightness and contrast are
adjusted while keeping color
unchanged.
This can be done by
using the same transformation
for all RGB components.
Power law transformations
Contrast enhancement
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Color Balancing Correction Examples
Color Balancing Correction Examples
Color imbalance: primary color components in white area
are not balance. We can measure these components by
using a color spectrometer.
Color balancing can be
performed by adjusting
color components separately
as seen in this slide.
Histogram Equalization of a Full
Histogram Equalization of a Full-
-Color Image
Color Image
v Histogram equalization of a color image can be performed by
adjusting color intensity uniformly while leaving color unchanged.
v The HSI model is suitable for histogram equalization where only
Intensity (I) component is equalized.
∑
∑
=
=
=
=
=
k
j
j
k
j
j
r
k
k
N
n
r
p
r
T
s
0
0
)
(
)
(
where r and s are intensity components of input and output color image.
(Images from Rafael C.
Gonzalez and Richard E.
Wood, Digital Image
Processing, 2nd Edition.
Histogram Equalization of a Full
Histogram Equalization of a Full-
-Color Image
Color Image
Original image
After histogram
equalization
After increasing
saturation component
Color Image Smoothing
Color Image Smoothing
2 Methods:
1. Per-color-plane method: for RGB, CMY color models
Smooth each color plane using moving averaging and
the combine back to RGB
2. Smooth only Intensity component of a HSI image while leaving
H and S unmodified.


















=
=
∑
∑
∑
∑
∈
∈
∈
∈
xy
xy
xy
xy
S
y
x
S
y
x
S
y
x
S
y
x
y
x
B
K
y
x
G
K
y
x
R
K
y
x
K
y
x
)
,
(
)
,
(
)
,
(
)
,
(
)
,
(
1
)
,
(
1
)
,
(
1
)
,
(
1
)
,
( c
c
Note: 2 methods are not equivalent.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Color Image Smoothing Example (cont.)
Color Image Smoothing Example (cont.)
Color image Red
Green Blue
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Color Image Smoothing Example (cont.)
Color Image Smoothing Example (cont.)
Hue Saturation Intensity
Color image
HSI Components
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Color Image Smoothing Example (cont.)
Color Image Smoothing Example (cont.)
Smooth all RGB components Smooth only I component of HSI
(faster)
Color Image Smoothing Example (cont.)
Color Image Smoothing Example (cont.)
Difference between
smoothed results from 2
methods in the previous
slide.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Color Image Sharpening
Color Image Sharpening
We can do in the same manner as color image smoothing:
1. Per-color-plane method for RGB,CMY images
2. Sharpening only I component of a HSI image
Sharpening all RGB components Sharpening only I component of HSI
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Color Image Sharpening Example (cont.)
Color Image Sharpening Example (cont.)
Difference between
sharpened results from 2
methods in the previous
slide.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Color Segmentation
Color Segmentation
2 Methods:
1. Segmented in HSI color space:
A thresholding function based on color information in H and S
Components. We rarely use I component for color image
segmentation.
2. Segmentation in RGB vector space:
A thresholding function based on distance in a color vector space.
Color Segmentation in HSI Color Space
Color Segmentation in HSI Color Space
Hue
Saturation Intensity
Color image
1 2
3 4
(Images from Rafael C.
Gonzalez and Richard E.
Wood, Digital Image
Processing, 2nd Edition.
Color Segmentation in HSI Color Space (cont.)
Color Segmentation in HSI Color Space (cont.)
Product of and
5 6
7 8
5
2
Binary thresholding of S component
with T = 10%
Histogram of 6 Segmentation of red color pixels
Red pixels
(Images from Rafael C.
Gonzalez and Richard E.
Wood, Digital Image
Processing, 2nd Edition.
Color Segmentation in HSI Color Space (cont.)
Color Segmentation in HSI Color Space (cont.)
Color image Segmented results of red pixels
(Images from Rafael C.
Gonzalez and Richard E.
Wood, Digital Image
Processing, 2nd Edition.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Color Segmentation in RGB Vector Space
Color Segmentation in RGB Vector Space
1. Each point with (R,G,B) coordinate in the vector space represents
one color.
2. Segmentation is based on distance thresholding in a vector space



>
≤
=
T
y
x
D
T
y
x
D
y
x
g
T
T
)
),
,
(
(
if
0
)
),
,
(
(
if
1
)
,
(
c
c
c
c
cT = color to be segmented.
c(x,y) = RGB vector at pixel (x,y).
D(u,v) = distance function
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Example: Segmentation in RGB Vector Space
Example: Segmentation in RGB Vector Space
Color image
Results of segmentation in
RGB vector space with Threshold
value
Reference color cT to be segmented
box
the
in
pixel
of
color
average
=
T
c
T = 1.25 times the SD of R,G,B values
In the box
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Gradient of a Color Image
Gradient of a Color Image
Since gradient is define only for a scalar image, there is no concept
of gradient for a color image. We can’t compute gradient of each
color component and combine the results to get the gradient of a color
image.
Red Green Blue
Edges
We see
4 objects.
We see
2 objects.
Gradient of a Color Image (cont.)
Gradient of a Color Image (cont.)
One way to compute the maximum rate of change of a color image
which is close to the meaning of gradient is to use the following
formula: Gradient computed in RGB color space:
[ ] 2
1
2
sin
2
2
cos
)
(
)
(
2
1
)
(






+
−
+
+
= θ
θ
θ xy
yy
xx
yy
xx g
g
g
g
g
F
( )







−
= −
yy
xx
xy
g
g
g
2
tan
2
1 1
θ
2
2
2
x
B
x
G
x
R
gxx
∂
∂
+
∂
∂
+
∂
∂
=
2
2
2
y
B
y
G
y
R
gyy
∂
∂
+
∂
∂
+
∂
∂
=
y
B
x
B
y
G
x
G
y
R
x
R
gxy
∂
∂
∂
∂
+
∂
∂
∂
∂
+
∂
∂
∂
∂
=
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Obtained using
the formula
in the previous
slide
Sum of
gradients of
each color
component
Original
image
Difference
between
2 and 3
2
3
2 3
Gradient of a Color Image Example
Gradient of a Color Image Example
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Gradients of each color component
Red Green Blue
Gradient of a Color Image Example
Gradient of a Color Image Example
Noise in Color Images
Noise in Color Images
Noise can corrupt each color component independently.
(Images from Rafael C.
Gonzalez and Richard E.
Wood, Digital Image
Processing, 2nd Edition.
Noise is less
noticeable
in a color
image
AWGN ση
2=800 AWGN ση
2=800
AWGN ση
2=800
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Noise in Color Images
Noise in Color Images
Hue Saturation Intensity
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Noise in Color Images
Noise in Color Images
Hue
Saturation Intensity
Salt & pepper noise
in Green component
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Color Image Compression
Color Image Compression
JPEG2000 File
Original image
After lossy compression with ratio 230:1

Weitere ähnliche Inhalte

Was ist angesagt?

Image enhancement techniques
Image enhancement techniquesImage enhancement techniques
Image enhancement techniques
Saideep
 

Was ist angesagt? (20)

Image enhancement techniques
Image enhancement techniques Image enhancement techniques
Image enhancement techniques
 
Image enhancement in the spatial domain1
Image enhancement in the spatial domain1Image enhancement in the spatial domain1
Image enhancement in the spatial domain1
 
Image enhancement techniques
Image enhancement techniquesImage enhancement techniques
Image enhancement techniques
 
Digital Image restoration
Digital Image restorationDigital Image restoration
Digital Image restoration
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filters
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
 
Digital image processing
Digital image processingDigital image processing
Digital image processing
 
Color image processing
Color image processingColor image processing
Color image processing
 
Chapter 3 image enhancement (spatial domain)
Chapter 3 image enhancement (spatial domain)Chapter 3 image enhancement (spatial domain)
Chapter 3 image enhancement (spatial domain)
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Psuedo color
Psuedo colorPsuedo color
Psuedo color
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Color fundamentals and color models - Digital Image Processing
Color fundamentals and color models - Digital Image ProcessingColor fundamentals and color models - Digital Image Processing
Color fundamentals and color models - Digital Image Processing
 
Color models
Color modelsColor models
Color models
 
IMAGE SEGMENTATION.
IMAGE SEGMENTATION.IMAGE SEGMENTATION.
IMAGE SEGMENTATION.
 
Histogram Processing
Histogram ProcessingHistogram Processing
Histogram Processing
 
Color image processing Presentation
Color image processing PresentationColor image processing Presentation
Color image processing Presentation
 
Thresholding.ppt
Thresholding.pptThresholding.ppt
Thresholding.ppt
 
Spatial domain and filtering
Spatial domain and filteringSpatial domain and filtering
Spatial domain and filtering
 
Chapter 1 and 2 gonzalez and woods
Chapter 1 and 2 gonzalez and woodsChapter 1 and 2 gonzalez and woods
Chapter 1 and 2 gonzalez and woods
 

Ähnlich wie 06 color image processing

Important features of color image processing
Important features of color image processingImportant features of color image processing
Important features of color image processing
dhananjeyanrece
 
introduction to colors in images and videos
introduction to colors in images and videosintroduction to colors in images and videos
introduction to colors in images and videos
wasrse
 

Ähnlich wie 06 color image processing (20)

Color-in-Digital-Image-Processing.pptx
Color-in-Digital-Image-Processing.pptxColor-in-Digital-Image-Processing.pptx
Color-in-Digital-Image-Processing.pptx
 
Color Image Processing
Color Image ProcessingColor Image Processing
Color Image Processing
 
Colour models
Colour modelsColour models
Colour models
 
Colormodels
ColormodelsColormodels
Colormodels
 
ch1ip.ppt
ch1ip.pptch1ip.ppt
ch1ip.ppt
 
Colour%20Model%20new.pptx
Colour%20Model%20new.pptxColour%20Model%20new.pptx
Colour%20Model%20new.pptx
 
Important features of color image processing
Important features of color image processingImportant features of color image processing
Important features of color image processing
 
Lec04 color
Lec04 colorLec04 color
Lec04 color
 
PPT s03-machine vision-s2
PPT s03-machine vision-s2PPT s03-machine vision-s2
PPT s03-machine vision-s2
 
Introduction to Color Science for display engineer
Introduction to Color Science for display engineerIntroduction to Color Science for display engineer
Introduction to Color Science for display engineer
 
10 color image processing
10 color image processing10 color image processing
10 color image processing
 
introduction to colors in images and videos
introduction to colors in images and videosintroduction to colors in images and videos
introduction to colors in images and videos
 
Image processing report
Image processing reportImage processing report
Image processing report
 
PROPERTIES OF LIGHT by R.Chinthamani.pptx
PROPERTIES OF LIGHT by R.Chinthamani.pptxPROPERTIES OF LIGHT by R.Chinthamani.pptx
PROPERTIES OF LIGHT by R.Chinthamani.pptx
 
Image processing tatorial
Image processing tatorialImage processing tatorial
Image processing tatorial
 
About Color
About ColorAbout Color
About Color
 
Color image processing.ppt
Color image processing.pptColor image processing.ppt
Color image processing.ppt
 
Colour spaces
Colour spacesColour spaces
Colour spaces
 
The Importance of Terminology and sRGB Uncertainty - Notes - 0.5
The Importance of Terminology and sRGB Uncertainty - Notes - 0.5The Importance of Terminology and sRGB Uncertainty - Notes - 0.5
The Importance of Terminology and sRGB Uncertainty - Notes - 0.5
 
lecture_07.pptx
lecture_07.pptxlecture_07.pptx
lecture_07.pptx
 

Kürzlich hochgeladen

notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
Health
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 

Kürzlich hochgeladen (20)

Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stage
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 

06 color image processing

  • 1. Digital Image Processing Chapter 6: Color Image Processing Digital Image Processing Chapter 6: Color Image Processing
  • 2. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Spectrum of White Light Spectrum of White Light 1666 Sir Isaac Newton, 24 year old, discovered white light spectrum.
  • 3. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Electromagnetic Spectrum Electromagnetic Spectrum Visible light wavelength: from around 400 to 700 nm 1. For an achromatic (monochrome) light source, there is only 1 attribute to describe the quality: intensity 2. For a chromatic light source, there are 3 attributes to describe the quality: Radiance = total amount of energy flow from a light source (Watts) Luminance = amount of energy received by an observer (lumens) Brightness = intensity
  • 4. The Eye Figure is from slides at Gonzalez/ Woods DIP book website (Chapter 2) UMCP ENEE631 Slides (created by M.Wu © 2004) Cross section illustration Cross section illustration
  • 5. Two Types of Photoreceptors at Retina Two Types of Photoreceptors at Retina • Rods – Long and thin – Large quantity (~ 100 million) – Provide scotopic vision (i.e., dim light vision or at low illumination) – Only extract luminance information and provide a general overall picture • Cones – Short and thick, densely packed in fovea (center of retina) – Much fewer (~ 6.5 million) and less sensitive to light than rods – Provide photopic vision (i.e., bright light vision or at high illumination) – Help resolve fine details as each cone is connected to its own nerve end – Responsible for color vision – Mesopic vision • provided at intermediate illumination by both rod and cones our interest (well-lighted display)
  • 6. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Sensitivity of Cones in the Human Eye Sensitivity of Cones in the Human Eye 6-7 millions cones in a human eye - 65% sensitive to Red light - 33% sensitive to Green light - 2 % sensitive to Blue light Primary colors: Defined CIE in 1931 Red = 700 nm Green = 546.1nm Blue = 435.8 nm CIE = Commission Internationale de l’Eclairage (The International Commission on Illumination)
  • 7. Luminance vs. Brightness Luminance vs. Brightness • Luminance (or intensity) – Independent of the luminance of surroundings I(x,y,λ) -- spatial light distribution V(λ) -- relative luminous efficiency func. of visual system ~ bell shape (different for scotopic vs. photopic vision; highest for green wavelength, second for red, and least for blue ) • Brightness – Perceived luminance – Depends on surrounding luminance Same lum. Different brightness Different lum. Similar brightness
  • 8. Luminance vs. Brightness (cont’d) Luminance vs. Brightness (cont’d) • Example: visible digital watermark – How to make the watermark appears the same graylevel all over the image? from IBM Watson web page “Vatican Digital Library”
  • 9. Look into Simultaneous Contrast Phenomenon Look into Simultaneous Contrast Phenomenon • Human perception more sensitive to luminance contrast than absolute luminance • Weber’s Law: | Ls – L0 | / L0 = const – Luminance of an object (L0) is set to be just noticeable from luminance of surround (Ls) – For just-noticeable luminance difference ∆L: ∆L / L ≈ d( log L ) ≈ 0.02 (const) • equal increments in log luminance are perceived as equally different • Empirical luminance-to-contrast models – Assume L ∈ [1, 100], and c ∈ [0, 100] – c = 50 log10 L (logarithmic law, widely used) – c = 21.9 L1/3 (cubic root law)
  • 10. Mach Bands • Visual system tends to undershoot or overshoot around the boundary of regions of different intensities è Demonstrates the perceived brightness is not a simple function of light intensity Figure is from slides at Gonzalez/ Woods DIP book website (Chapter 2) UMCP ENEE631 Slides (created by M.Wu © 2004)
  • 11. Color of Light Color of Light • Perceived color depends on spectral content (wavelength composition) – e.g., 700nm ~ red. – “spectral color” • A light with very narrow bandwidth • A light with equal energy in all visible bands appears white “Spectrum” from http://www.physics.sfasu.edu/astro/color.html UMCP ENEE408G Slides (created by M.Wu & R.Liu © 2002)
  • 12. Primary and Secondary Colors Primary and Secondary Colors Primary color Primary color Primary color Secondary colors
  • 13. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Primary and Secondary Colors (cont.) Primary and Secondary Colors (cont.) Additive primary colors: RGB use in the case of light sources such as color monitors Subtractive primary colors: CMY use in the case of pigments in printing devices RGB add together to get white White subtracted by CMY to get Black
  • 14. Representation by Three Primary Colors Representation by Three Primary Colors • Any color can be reproduced by mixing an appropriate set of three primary colors (Thomas Young, 1802) • Three types of cones in human retina – Absorption response Si(λ) has peaks around 450nm (blue), 550nm (green), 620nm (yellow-green) – Color sensation depends on the spectral response {α1(C), α2(C), α3(C) } rather than the complete light spectrum C(λ) ∫ S1(λ) C(λ) d λ ∫ S2(λ) C(λ) d λ ∫ S3(λ) C(λ) d λ C(λ) color light α1(C) α2(C) α3(C) Identically perceived colors if αi (C1) = αi (C2)
  • 15. Example: Seeing Yellow Without Yellow Example: Seeing Yellow Without Yellow mix green and red light to obtain perception of yellow, without shining a single yellow photon 520nm 630nm 570nm = “Seeing Yellow” figure is from B.Liu ELE330 S’01 lecture notes @ Princeton; R/G/B cone response is from slides at Gonzalez/ Woods DIP book website
  • 16. Color Matching and Reproduction Color Matching and Reproduction • Mixture of three primaries: C = Sum(βk Pk (λ) ) • To match a given color C1 – adjust βk such that αi (C1) = αi (C), i = 1,2,3. • Tristimulus values Tk (C) – Tk (C) = βk / wk wk – the amount of kth primary to match the reference white • Chromaticity tk = Tk / (T1+T2+T3) – t1+t2+t3 = 1 – visualize (t1, t2 ) to obtain chromaticity diagram
  • 17. Hue: dominant color corresponding to a dominant wavelength of mixture light wave Saturation: Relative purity or amount of white light mixed with a hue (inversely proportional to amount of white light added) Brightness: Intensity Color Characterization Color Characterization Hue Saturation Chromaticity amount of red (X), green (Y) and blue (Z) to form any particular color is called tristimulus.
  • 18. Perceptual Attributes of Color Perceptual Attributes of Color • Value of Brightness (perceived luminance) • Chrominance – Hue • specify color tone (redness, greenness, etc.) • depend on peak wavelength – Saturation • describe how pure the color is • depend on the spread (bandwidth) of light spectrum • reflect how much white light is added • RGB ó HSV Conversion ~ nonlinear HSV circular cone is from online documentation of Matlab image processing toolbox http://www.mathworks.com/access /helpdesk/help/toolbox/images/col or10.shtml UMCP ENEE408G Slides (created by M.Wu & R.Liu © 2002)
  • 19. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. CIE Chromaticity Diagram CIE Chromaticity Diagram Trichromatic coefficients: Z Y X X x + + = Z Y X Y y + + = Z Y X Z z + + = 1 = + + z y x x y Points on the boundary are fully saturated colors
  • 20. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Color Gamut of Color Monitors and Printing Devices Color Gamut of Color Monitors and Printing Devices Color Monitors Printing devices
  • 21. CIE Color Coordinates (cont’d) CIE Color Coordinates (cont’d) • CIE XYZ system – hypothetical primary sources to yield all-positive spectral tristimulus values – Y ~ luminance • Color gamut of 3 primaries – Colors on line C1 and C2 can be produced by linear mixture of the two – Colors inside the triangle gamut can be reproduced by three primaries From http://www.cs.rit.edu/~ncs/color/t_chroma.html
  • 22. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. RGB Color Model RGB Color Model Purpose of color models: to facilitate the specification of colors in some standard RGB color models: - based on cartesian coordinate system
  • 23. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. RGB Color Cube RGB Color Cube R = 8 bits G = 8 bits B = 8 bits Color depth 24 bits = 16777216 colors Hidden faces of the cube
  • 24. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. RGB Color Model (cont.) RGB Color Model (cont.) Red fixed at 127
  • 25. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Safe RGB Colors Safe RGB Colors Safe RGB colors: a subset of RGB colors. There are 216 colors common in most operating systems.
  • 26. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. RGB Safe RGB Safe- -color Cube color Cube The RGB Cube is divided into 6 intervals on each axis to achieve the total 63 = 216 common colors. However, for 8 bit color representation, there are the total 256 colors. Therefore, the remaining 40 colors are left to OS.
  • 27. CMY and CMYK Color Models CMY and CMYK Color Models C = Cyan M = Magenta Y = Yellow K = Black • Primary colors for pigment – Defined as one that subtracts/absorbs a primary color of light & reflects the other two • CMY – Cyan, Magenta, Yellow – Complementary to RGB – Proper mix of them produces black           −           =           B G R Y M C 1 1 1
  • 28. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. HSI Color Model HSI Color Model RGB, CMY models are not good for human interpreting HSI Color model: Hue: Dominant color Saturation: Relative purity (inversely proportional to amount of white light added) Intensity: Brightness Color carrying information
  • 29. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Relationship Between RGB and HSI Color Models Relationship Between RGB and HSI Color Models RGB HSI
  • 30. Hue and Saturation on Color Planes Hue and Saturation on Color Planes 1. A dot is the plane is an arbitrary color 2. Hue is an angle from a red axis. 3. Saturation is a distance to the point.
  • 31. HSI Color Model (cont.) HSI Color Model (cont.) Intensity is given by a position on the vertical axis.
  • 32. HSI Color Model HSI Color Model Intensity is given by a position on the vertical axis.
  • 33. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Example: HSI Components of RGB Cube Example: HSI Components of RGB Cube Hue Saturation Intensity RGB Cube
  • 34. Converting Colors from RGB to HSI Converting Colors from RGB to HSI    > − ≤ = G B G B H if 360 if θ θ [ ] [ ]           − − + − − + − = − 2 / 1 2 1 ) )( ( ) ( ) ( ) ( 2 1 cos B G B R G R B R G R θ B G R S + + − = 3 1 ) ( 3 1 B G R I + + =
  • 35. Converting Colors from HSI to RGB Converting Colors from HSI to RGB ) 1 ( S I B − =       − + = ) 60 cos( cos 1 H H S I R o ) ( 1 B R G + − = RG sector: 120 0 < ≤ H GB sector: 240 120 < ≤ H ) 1 ( S I R − =       − + = ) 60 cos( cos 1 H H S I G o ) ( 1 G R B + − = ) 1 ( S I G − =       − + = ) 60 cos( cos 1 H H S I B o ) ( 1 B G R + − = BR sector: 360 240 ≤ ≤ H 120 − = H H 240 − = H H
  • 36. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Example: HSI Components of RGB Colors Example: HSI Components of RGB Colors Hue Saturation Intensity RGB Image
  • 37. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Example: Manipulating HSI Components Example: Manipulating HSI Components Hue Saturation Intensity RGB Image Hue Saturation Intensity RGB Image
  • 38. Color Coordinates Used in TV Transmission Color Coordinates Used in TV Transmission • Facilitate sending color video via 6MHz mono TV channel • YIQ for NTSC (National Television Systems Committee) transmission system – Use receiver primary system (RN, GN, BN) as TV receivers standard – Transmission system use (Y, I, Q) color coordinate • Y ~ luminance, I & Q ~ chrominance • I & Q are transmitted in through orthogonal carriers at the same freq. • YUV (YCbCr) for PAL and digital video – Y ~ luminance, Cb and Cr ~ chrominance
  • 39. Color Coordinates Color Coordinates • RGB of CIE • XYZ of CIE • RGB of NTSC • YIQ of NTSC • YUV (YCbCr) • CMY
  • 42. Summary Summary • Monochrome human vision – visual properties: luminance vs. brightness, etc. – image fidelity criteria • Color – Color representations and three primary colors – Color coordinates UMCP ENEE631 Slides (created by M.Wu © 2004)
  • 43. Color Image Processing Color Image Processing There are 2 types of color image processes 1. Pseudocolor image process: Assigning colors to gray values based on a specific criterion. Gray scale images to be processed may be a single image or multiple images such as multispectral images 2. Full color image process: The process to manipulate real color images such as color photographs.
  • 44. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Pseudocolor Image Processing Pseudocolor Image Processing Why we need to assign colors to gray scale image? Answer: Human can distinguish different colors better than different shades of gray. Pseudo color = false color : In some case there is no “color” concept for a gray scale image but we can assign “false” colors to an image.
  • 45. Intensity Slicing or Density Slicing Intensity Slicing or Density Slicing    > ≤ = T y x f C T y x f C y x g ) , ( if ) , ( if ) , ( 2 1 Formula: C1 = Color No. 1 C2 = Color No. 2 T Intensity Color C1 C2 T 0 L-1 A gray scale image viewed as a 3D surface.
  • 46. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Intensity Slicing Example Intensity Slicing Example An X-ray image of a weld with cracks After assigning a yellow color to pixels with value 255 and a blue color to all other pixels.
  • 47. Multi Level Intensity Slicing Multi Level Intensity Slicing k k k l y x f l C y x g ≤ < = − ) , ( for ) , ( 1 Ck = Color No. k lk = Threshold level k Intensity Color C 1 C2 0 L-1 l1 l2 l3 lk lk-1 C3 Ck-1 Ck
  • 48. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Multi Level Intensity Slicing Example Multi Level Intensity Slicing Example k k k l y x f l C y x g ≤ < = − ) , ( for ) , ( 1 Ck = Color No. k lk = Threshold level k An X-ray image of the Picker Thyroid Phantom. After density slicing into 8 colors
  • 49. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Color Coding Example Color Coding Example Gray-scale image of average monthly rainfall. Color coded image South America region Gray Scale Color map 0 10 >20
  • 50. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Gray Level to Color Transformation Gray Level to Color Transformation Assigning colors to gray levels based on specific mapping functions Red component Green component Blue component Gray scale image
  • 51. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Gray Level to Color Transformation Example Gray Level to Color Transformation Example An X-ray image of a garment bag with a simulated explosive device An X-ray image of a garment bag Color coded images Transformations
  • 52. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Gray Level to Color Transformation Example Gray Level to Color Transformation Example An X-ray image of a garment bag with a simulated explosive device An X-ray image of a garment bag Color coded images Transformations
  • 53. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Pseudocolor Coding Pseudocolor Coding Used in the case where there are many monochrome images such as multispectral satellite images.
  • 55. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Pseudocolor Coding Example Pseudocolor Coding Example Washington D.C. area Visible blue λ= 0.45-0.52 µm Max water penetration Visible green λ= 0.52-0.60 µm Measuring plant Visible red λ= 0.63-0.69 µm Plant discrimination Near infrared λ= 0.76-0.90 µm Biomass and shoreline mapping 1 2 3 4 Red = Green = Blue = Color composite images 1 2 3 Red = Green = Blue = 1 2 4 Better visualization àShow quite clearly the difference between biomass (red) and human-made features.
  • 56. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Pseudocolor Coding Example Pseudocolor Coding Example Psuedocolor rendition of Jupiter moon Io A close-up Yellow areas = older sulfur deposits. Red areas = material ejected from active volcanoes.
  • 57. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Basics of Full Basics of Full- -Color Image Processing Color Image Processing 2 Methods: 1. Per-color-component processing: process each component separately. 2. Vector processing: treat each pixel as a vector to be processed. Example of per-color-component processing: smoothing an image By smoothing each RGB component separately.
  • 58. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Example: Example: Full Full- -Color Image and Variouis Color Space Components Color Image and Variouis Color Space Components Color image CMYK components RGB components HSI components
  • 59. Color Transformation Color Transformation Formulation: [ ] ) , ( ) , ( y x f T y x g = f(x,y) = input color image, g(x,y) = output color image T = operation on f over a spatial neighborhood of (x,y) When only data at one pixel is used in the transformation, we can express the transformation as: ) , , , ( 2 1 n i i r r r T s K = i= 1, 2, …, n Where ri = color component of f(x,y) si = color component of g(x,y) Use to transform colors to colors. For RGB images, n = 3
  • 60. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Example: Color Transformation Example: Color Transformation ) , ( ) , ( ) , ( ) , ( ) , ( ) , ( y x kr y x s y x kr y x s y x kr y x s B B G G R R = = = Formula for RGB: ) , ( ) , ( y x kr y x s I I = Formula for CMY: ) 1 ( ) , ( ) , ( ) 1 ( ) , ( ) , ( ) 1 ( ) , ( ) , ( k y x kr y x s k y x kr y x s k y x kr y x s Y Y M M C C − + = − + = − + = Formula for HSI: These 3 transformations give the same results. k = 0.7 I H,S
  • 61. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Color Complements Color Complements Color complement replaces each color with its opposite color in the color circle of the Hue component. This operation is analogous to image negative in a gray scale image. Color circle
  • 62. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Color Complement Transformation Example Color Complement Transformation Example
  • 63. Color Slicing Transformation Color Slicing Transformation            > − = ≤ ≤ otherwise 2 if 5 . 0 1 i n j any j j i r W a r s We can perform “slicing” in color space: if the color of each pixel is far from a desired color more than threshold distance, we set that color to some specific color such as gray, otherwise we keep the original color unchanged. i= 1, 2, …, n or ( )      > − = ∑ = otherwise if 5 . 0 1 2 0 2 i n j j j i r R a r s Set to gray Keep the original color Set to gray Keep the original color i= 1, 2, …, n
  • 64. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Color Slicing Transformation Example Color Slicing Transformation Example Original image After color slicing
  • 65. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Tonal Correction Examples Tonal Correction Examples In these examples, only brightness and contrast are adjusted while keeping color unchanged. This can be done by using the same transformation for all RGB components. Power law transformations Contrast enhancement
  • 66. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Color Balancing Correction Examples Color Balancing Correction Examples Color imbalance: primary color components in white area are not balance. We can measure these components by using a color spectrometer. Color balancing can be performed by adjusting color components separately as seen in this slide.
  • 67. Histogram Equalization of a Full Histogram Equalization of a Full- -Color Image Color Image v Histogram equalization of a color image can be performed by adjusting color intensity uniformly while leaving color unchanged. v The HSI model is suitable for histogram equalization where only Intensity (I) component is equalized. ∑ ∑ = = = = = k j j k j j r k k N n r p r T s 0 0 ) ( ) ( where r and s are intensity components of input and output color image.
  • 68. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Histogram Equalization of a Full Histogram Equalization of a Full- -Color Image Color Image Original image After histogram equalization After increasing saturation component
  • 69. Color Image Smoothing Color Image Smoothing 2 Methods: 1. Per-color-plane method: for RGB, CMY color models Smooth each color plane using moving averaging and the combine back to RGB 2. Smooth only Intensity component of a HSI image while leaving H and S unmodified.                   = = ∑ ∑ ∑ ∑ ∈ ∈ ∈ ∈ xy xy xy xy S y x S y x S y x S y x y x B K y x G K y x R K y x K y x ) , ( ) , ( ) , ( ) , ( ) , ( 1 ) , ( 1 ) , ( 1 ) , ( 1 ) , ( c c Note: 2 methods are not equivalent.
  • 70. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Color Image Smoothing Example (cont.) Color Image Smoothing Example (cont.) Color image Red Green Blue
  • 71. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Color Image Smoothing Example (cont.) Color Image Smoothing Example (cont.) Hue Saturation Intensity Color image HSI Components
  • 72. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Color Image Smoothing Example (cont.) Color Image Smoothing Example (cont.) Smooth all RGB components Smooth only I component of HSI (faster)
  • 73. Color Image Smoothing Example (cont.) Color Image Smoothing Example (cont.) Difference between smoothed results from 2 methods in the previous slide. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
  • 74. Color Image Sharpening Color Image Sharpening We can do in the same manner as color image smoothing: 1. Per-color-plane method for RGB,CMY images 2. Sharpening only I component of a HSI image Sharpening all RGB components Sharpening only I component of HSI
  • 75. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Color Image Sharpening Example (cont.) Color Image Sharpening Example (cont.) Difference between sharpened results from 2 methods in the previous slide.
  • 76. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Color Segmentation Color Segmentation 2 Methods: 1. Segmented in HSI color space: A thresholding function based on color information in H and S Components. We rarely use I component for color image segmentation. 2. Segmentation in RGB vector space: A thresholding function based on distance in a color vector space.
  • 77. Color Segmentation in HSI Color Space Color Segmentation in HSI Color Space Hue Saturation Intensity Color image 1 2 3 4 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
  • 78. Color Segmentation in HSI Color Space (cont.) Color Segmentation in HSI Color Space (cont.) Product of and 5 6 7 8 5 2 Binary thresholding of S component with T = 10% Histogram of 6 Segmentation of red color pixels Red pixels (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
  • 79. Color Segmentation in HSI Color Space (cont.) Color Segmentation in HSI Color Space (cont.) Color image Segmented results of red pixels (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
  • 80. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Color Segmentation in RGB Vector Space Color Segmentation in RGB Vector Space 1. Each point with (R,G,B) coordinate in the vector space represents one color. 2. Segmentation is based on distance thresholding in a vector space    > ≤ = T y x D T y x D y x g T T ) ), , ( ( if 0 ) ), , ( ( if 1 ) , ( c c c c cT = color to be segmented. c(x,y) = RGB vector at pixel (x,y). D(u,v) = distance function
  • 81. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Example: Segmentation in RGB Vector Space Example: Segmentation in RGB Vector Space Color image Results of segmentation in RGB vector space with Threshold value Reference color cT to be segmented box the in pixel of color average = T c T = 1.25 times the SD of R,G,B values In the box
  • 82. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Gradient of a Color Image Gradient of a Color Image Since gradient is define only for a scalar image, there is no concept of gradient for a color image. We can’t compute gradient of each color component and combine the results to get the gradient of a color image. Red Green Blue Edges We see 4 objects. We see 2 objects.
  • 83. Gradient of a Color Image (cont.) Gradient of a Color Image (cont.) One way to compute the maximum rate of change of a color image which is close to the meaning of gradient is to use the following formula: Gradient computed in RGB color space: [ ] 2 1 2 sin 2 2 cos ) ( ) ( 2 1 ) (       + − + + = θ θ θ xy yy xx yy xx g g g g g F ( )        − = − yy xx xy g g g 2 tan 2 1 1 θ 2 2 2 x B x G x R gxx ∂ ∂ + ∂ ∂ + ∂ ∂ = 2 2 2 y B y G y R gyy ∂ ∂ + ∂ ∂ + ∂ ∂ = y B x B y G x G y R x R gxy ∂ ∂ ∂ ∂ + ∂ ∂ ∂ ∂ + ∂ ∂ ∂ ∂ =
  • 84. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Obtained using the formula in the previous slide Sum of gradients of each color component Original image Difference between 2 and 3 2 3 2 3 Gradient of a Color Image Example Gradient of a Color Image Example
  • 85. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Gradients of each color component Red Green Blue Gradient of a Color Image Example Gradient of a Color Image Example
  • 86. Noise in Color Images Noise in Color Images Noise can corrupt each color component independently. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Noise is less noticeable in a color image AWGN ση 2=800 AWGN ση 2=800 AWGN ση 2=800
  • 87. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Noise in Color Images Noise in Color Images Hue Saturation Intensity
  • 88. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Noise in Color Images Noise in Color Images Hue Saturation Intensity Salt & pepper noise in Green component
  • 89. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. Color Image Compression Color Image Compression JPEG2000 File Original image After lossy compression with ratio 230:1