Color Image Processing
Color Image Processing
Chapter 6:
Color Image Processing
Spectrum of White Light
1666 Sir Isaac Newton, 24 year old, discovered white light spectrum.
The Eye
UMCP ENEE631 Slides (created by M.Wu © 2004)
Primary colors:
Defined CIE in 1931
Red = 700 nm
Green = 546.1nm
Blue = 435.8 nm
composition)
– e.g., 700nm ~ red.
– “spectral color”
• A light with very narrow bandwidth
Primary
color
Secondary
colors
Primary Primary
color color
Primary and Secondary Colors (cont.)
570nm
520nm 630nm
“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
Hue
Chromaticity
Saturation
amount of red (X), green (Y) and blue (Z) to form any particular
color is called tristimulus.
Perceptual Attributes of Color
• Value of Brightness
(perceived luminance)
UMCP ENEE408G Slides (created by M.Wu & R.Liu © 2002)
• 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
HSV circular cone is from online
x + y + z =1
Color Monitors
Printing devices
From http://www.cs.rit.edu/~ncs/color/t_chroma.html
RGB Color Model
Purpose of color models: to facilitate the specification of colors in
some standard
Hidden faces
of the cube
C 1 R
M = 1 − G
Y 1 B
HSI Color Model
RGB, CMY models are not good for human interpreting
Intensity: Brightness
RGB HSI
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Hue and Saturation on Color Planes
RGB Cube
θ if B ≤ G
H =
360 − θ if B > G
1
[( R − G ) + ( R − B)]
θ = cos −1 2
1/ 2
[ ]
( R − G ) + ( R − B )(G − B )
2
3
S = 1−
R+G+ B
1
I = ( R + G + B)
3
Converting Colors from HSI to RGB
RG sector: 0 ≤ H < 120 GB sector:120 ≤ H < 240
H = H − 120
S cos H
R = I 1 + R = I (1 − S )
cos( 60 o
− H )
B = I (1 − S ) S cos H
G = I 1 +
cos( 60 o
− H )
G = 1 − ( R + B)
B = 1 − ( R + G)
BR sector: 240 ≤ H ≤ 360
H = H − 240
S cos H
B = I 1 +
cos( 60 o
− H )
G = I (1 − S )
R = 1 − (G + B )
Example: HSI Components of RGB Colors
RGB
Image Hue
Saturation Intensity
• RGB of CIE
• XYZ of CIE
• RGB of NTSC
• YIQ of NTSC
• YUV (YCbCr)
• CMY
Examples
RGB
HSV
YUV
Examples
RGB
HSV
YIQ
Summary
UMCP ENEE631 Slides (created by M.Wu © 2004)
Color
T C2
C1
0 T L-1
Intensity
A gray scale image viewed as a 3D surface.
Intensity Slicing Example
Ck = Color No. k
lk = Threshold level k
Color
Ck
Ck-1
C3
C2
C
1
0 l1 l2 l3 lk-1 lk
L-1
Intensity
Multi Level Intensity Slicing Example
Ck = Color No. k
g ( x , y ) = Ck for lk −1 < f ( x, y ) ≤ lk lk = Threshold level k
Gray Color
Scale 10 map
Red component
Blue component
Color
coded
images
Gray Level to Color Transformation Example
An X-ray image An X-ray image of a
of a garment bag garment bag with a
simulated explosive
device
Color
coded
images
Pseudocolor Coding
Used in the case where there are many monochrome images such as multispectral
satellite images.
3 4 Red = 1 Red = 1
Green = 2 Green = 2
Blue = 3 Blue = 4
Psuedocolor rendition
of Jupiter moon Io
A close-up
Color image
CMYK components
RGB components
HSI components
Formulation:
g ( x , y ) = T [ f ( x , y )]
si = Ti ( r1 , r2 ,K, rn ) i= 1, 2, …, n
sC ( x, y ) = krC ( x, y ) + (1 − k )
sM ( x, y ) = krM ( x, y ) + (1 − k ) These 3 transformations give
sY ( x, y ) = krY ( x, y ) + (1 − k ) the same results.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
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
W Set to gray
0.5 if rj − a j >
si = 2 any 1≤ j ≤n
ri otherwise Keep the original
i= 1, 2, …, n color
or
( )
n
0.5 if ∑ rj − a j > R0
2 2 Set to gray
si = j =1
ri otherwise Keep the original
color
i= 1, 2, …, n
Color Slicing Transformation Example
Original image
Contrast enhancement
where r and s are intensity components of input and output color image.
Histogram Equalization of a Full-
Full-Color Image
Original image
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
1
∑ R ( x, y )
K ( x , y )∈S xy
1 1
c ( x, y ) = ∑ c( x , y ) =
K ( x , y )∈S xy K
∑ G ( x, y )
( x , y )∈S xy
1
K ( x ,∑ B ( x , y )
y )∈S xy
Green Blue
Color image
HSI Components
Difference between
smoothed results from 2
methods in the previous
slide.
Difference between
sharpened results from 2
methods in the previous
slide.
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.
1 2
3 4
5 6
Red pixels
7 8
(Images from Rafael C.
Gonzalez and Richard E.
Wood, Digital Image Histogram of 6 Segmentation of red color pixels
Processing, 2nd Edition.
Color Segmentation in HSI Color Space (cont.)
1 if D (c( x, y ), cT ) ≤ T
g ( x, y ) =
0 if D (c( x, y ), cT ) > T
cT = color to be segmented.
D(u,v) = distance function c(x,y) = RGB vector at pixel (x,y).
Example: Segmentation in RGB Vector Space
Color image
Results of segmentation in
RGB vector space with Threshold
value
T = 1.25 times the SD of R,G,B values
In the box
We see
4 objects.
Edges
F (θ ) = [( g xx + g yy ) + ( g xx − g yy ) cos 2θ + 2 g xy sin 2θ ]
1 2
2
1 −1
2 g xy
θ = tan
2 (g xx − g yy )
2 2 2
∂R ∂G ∂B ∂R ∂G ∂B
2 2 2
g xx = + + g yy = + +
∂x ∂x ∂x ∂y ∂y ∂y
∂R ∂R ∂G ∂G ∂B ∂B
g xy = + +
∂x ∂y ∂x ∂y ∂x ∂y
Gradient of a Color Image Example
2
Sum of
gradients of Difference
each color between
component 22 and 33
AWGN ση2=800
Noise is less
noticeable
in a color
image
Saturation Intensity
JPEG2000 File
After lossy compression with ratio 230:1 (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.