CS589-04 Digital Image Processing
CS589-04 Digital Image Processing
Lecture 6. Color Image
Lecture 6. Color Image
Processing
Processing
Spring 2008
Spring 2008
New Mexico Tech
New Mexico Tech
11/07/25 2
Color Fundamentals
Color Fundamentals
11/07/25 3
Color Fundamentals
Color Fundamentals
11/07/25 4
Color Fundamentals
Color Fundamentals
► 6 to 7 million cones in the human eye can be divided
into three principal sensing categories, corresponding
roughly to red, green, and blue.
65%: red 33%: green 2%: blue (blue cones are the
most sensitive)
11/07/25 5
Color Fundamentals
Color Fundamentals
11/07/25 6
11/07/25 7
Color Fundamentals
Color Fundamentals
► The characteristics generally used to distinguish one
color from another are brightness, hue, and saturation
brightness: the achromatic notion of intensity.
hue: dominant wavelength in a mixture of light waves,
represents dominant color as perceived by an observer.
saturation: relative purity or the amount of white light
mixed with its hue.
11/07/25 8
Color Fundamentals
Color Fundamentals
► Tristimulus
Red, green, and blue are denoted X, Y, and Z,
respectively. A color is defined by its trichromatic
coefficients, defined as
X
x
X Y Z
Y
y
X Y Z
Z
z
X Y Z

 

 

 
11/07/25 9
CIE Chromaticity Diagram
CIE Chromaticity Diagram
It shows color
composition
as a function
of x (red) and
y (green)
11/07/25 10
RGB Color Model
RGB Color Model
11/07/25 11
RGB Color Model
RGB Color Model
Pixel depth
The total number of
colors in a 24-bit RGB
image is (28
)3
=
16,777,216
11/07/25 12
11/07/25 13
Safe RGB colors (or
safe Web colors) are
reproduced faithfully,
reasonably
independently of
viewer hardware
capabilities
11/07/25 14
11/07/25 15
The CMY and CMYK Color Models
The CMY and CMYK Color Models
1
1
1
C R
M G
Y B
     
     
 
     
     
     
Equal amounts of the pigment primaries, cyan, magenta,
and yellow should produce black. In practice, combining
these colors for printing produces a muddy-looking black.
To produce true black, the predominant color in printing,
the fourth color, black, is added, giving rise to the CMYK
color model.
11/07/25 16
http://en.wikipedia.org/wiki/CMYK
CMY vs. CMYK
11/07/25 17
HIS Color Model
HIS Color Model
brightness: the achromatic notion of intensity.
hue: dominant wavelength in a mixture of light waves, represents dominant
color as perceived by an observer.
saturation: relative purity or the amount of white light mixed with its hue.
11/07/25 18
HIS Color Model
HIS Color Model
11/07/25 19
HIS Color Model
HIS Color Model
11/07/25 20
HIS Color Model
HIS Color Model
11/07/25 21
Converting Colors from RGB to HSI
Converting Colors from RGB to HSI
► Given an image in RGB color format, the H component
of each RGB pixel is obtained using the equation
if B G
360 if B>G
H







 
 
1
1/2
2
1
( ) ( )
2
cos
( )( )
R G R B
R G R B G B
 
 
  
 
  
 
 
   
 
 
11/07/25 22
Converting Colors from RGB to HSI
Converting Colors from RGB to HSI
► Given an image in RGB color format, the saturation
component is given by
 
3
1 min( , , )
( )
S R G B
R G B
 
 
11/07/25 23
Converting Colors from RGB to HSI
Converting Colors from RGB to HSI
► Given an image in RGB color format, the intensity
component is given by
 
1
3
I R G B
  
11/07/25 24
Converting Colors from HSI to RGB
Converting Colors from HSI to RGB
► RG sector
(1 )
cos
1
cos(60 )
and
3 ( )
B I S
S H
R I
H
G I R B
 
 
 
 

 
  

(0 120 )
H
 
 
11/07/25 25
Converting Colors from HSI to RGB
Converting Colors from HSI to RGB
► RG sector
120
(1 )
cos
1
cos(60 )
and
3 ( )
H H
R I S
S H
G I
H
B I R G
 
 
 
 
 

 
  


(120 240 )
H
 
 
11/07/25 26
Converting Colors from HSI to RGB
Converting Colors from HSI to RGB
► RG sector
240
(1 )
cos
1
cos(60 )
and
3 ( )
H H
G I S
S H
B I
H
R I G B
 
 
 
 
 

 
  


(240 360 )
H
 
 
11/07/25 27
11/07/25 28
11/07/25 29
11/07/25 30
Pseudocolor Image Processing
Pseudocolor Image Processing
► The process of assigning colors to gray values based on
a specified criterion.
► Intensity Slicing
( , ) if ( , )
k k
f x y c f x y V
 
11/07/25 31
11/07/25 32
11/07/25 33
11/07/25 34
11/07/25 35
11/07/25 36
Pseudocolor Image Processing
Pseudocolor Image Processing
► Intensity to Color Transformation
11/07/25 37
The images are obtained
from an airport X-ray
scanning system.
The left contains ordinary
articles and the right
contains the same articles
as well as a block of
simulated plastic
explosives.
11/07/25 38
11/07/25 39
11/07/25 40
11/07/25 41
Pseudocolor by combining
several of the sensor
images from the Galileo
spacecraft, some of which
are in spectral regions not
visible to the eye.
Bright red depicts
materials newly ejected
from an active volcano on
Io, and the surrounding
yellow materials are older
sulfur deposits.
11/07/25 42
Basics of Full-Color Image Processing
Basics of Full-Color Image Processing
Let represent an arbitrary vector in RGB color space:
At coordinates ( , ),
( , ) ( , )
( , ) ( , ) ( , )
( , ) ( , )
R
G
B
R
G
B
c
c R
c c G
c B
x y
c x y R x y
c x y c x y G x y
c x y B x y
   
   
 
   
   
   
   
   
 
   
   
   
11/07/25 43
Basics of Full-Color Image Processing
Basics of Full-Color Image Processing
11/07/25 44
Color Transformations
Color Transformations
 
( , ) ( , )
g x y T f x y

1 2
( , ,..., ), 1,2,..., .
i i n
s T r r r i n
 
11/07/25 45
11/07/25 46
( , ) ( , )
g x y kf x y

,
1,2,3.
i i
s kr
i


(1 ),
1,2,3.
i i
s kr k
i
  

3 3
s kr

11/07/25 47
11/07/25 48
11/07/25 49
Color slicing
Color slicing
► Highlighting a specific range of colors in an image
1 2
If the colors of interest are enclosed by a cube of width W
and centered at a protypical color with components
( , ,..., ), the necessary set of transformations is
0.5 if
n
i
a a a
s  any 1
| | / 2
otherwise
j j j n
i
r a W
r
 
  
 
  



11/07/25 50
Color slicing
Color slicing
 
0
2 2
0
1
If a sphere is used to specify the colors of interest,
R is the radius of the enclosing of its center.
The transformations is
0.5 if
n
j j
j
i
i
r a R
s
r

 


otherwise





11/07/25 51
Color slicing
Color slicing
11/07/25 52
Tone and
Tone and
Color
Color
Corrections
Corrections
11/07/25 53
11/07/25 54
11/07/25 55
Color Image Smoothing
Color Image Smoothing
( , )
Let denote the set of coordinates defining a neighborhood
centered at ( , ) in an RGB color image. The average of the
RGB component vectors in this neighborhood is
1
( , ) ( , )
xy
xy
s t S
S
x y
c x y c s t
K 

( , )
( , )
( , )
1
( , )
1
( , )
1
( , )
xy
xy
xy
s t S
s t S
s t S
R s t
K
G s t
K
B s t
K



 
 
 
 
 

 
 
 
 
 

 

11/07/25 56
11/07/25 57
11/07/25 58
11/07/25 59
Color Image Sharpening
Color Image Sharpening
 
2
2 2
2
The Laplacian of vector c is
( , )
( , ) ( , )
( , )
R x y
c x y G x y
B x y
 

 
  
 
 

 
11/07/25 60
11/07/25 61
Image
Image
Segmentation
Segmentation
Based on
Based on
Color:
Color:
Segmentation
Segmentation
in HIS Color
in HIS Color
Space
Space
11/07/25 62
Segmentation in RGB Vector Space
Segmentation in RGB Vector Space
1/2
1/2
2 2 2
Let the average color of interest is denoted by the
RGB vector . Let denote an arbitrary point in
RGB space.
( , ) ( ) ( )
( ) ( ) ( )
T
R R G G B B
a z
D z a z a z a z a
z a z a z a
 
    
 
 
     
 
11/07/25 63
11/07/25 64
Color Edge Detection (1)
Color Edge Detection (1)
Let r, g, and b be unit vectors along the R, G, and B
axis of RGB color space, and define vectors
u r g b
and
v r g b
R G B
x x x
R G B
y y y
  
  
  
  
  
  
11/07/25 65
Color Edge Detection (2)
Color Edge Detection (2)
2 2 2
2 2 2
u u=
v v=
and
u v=
xx
yy
xy
R G B
g
x x x
R G B
g
y y y
R R G G B B
g
x y x y x y
  
  
  
  
  
  
     
  
     



11/07/25 66
Color Edge Detection (3)
Color Edge Detection (3)
1
The direction of maximum rate of change of c( , ) is given by
the angle
2
1
( , ) tan
2
The value of the rate of change at ( , ) in the direction of ( , ),
is given by
1
F ( , )=
2
xy
xx yy
x
x y
g
x y
g g
x y x y
x y g




 
  

 
 
   
1/2
cos2 ( , ) 2 sin 2 ( , )
x yy xx yy xy
g g g x y g x y
 
 
 
   
 
 
 
11/07/25 67
11/07/25 68

Lect07.ppt digital image processing for computer and eng student

  • 1.
    CS589-04 Digital ImageProcessing CS589-04 Digital Image Processing Lecture 6. Color Image Lecture 6. Color Image Processing Processing Spring 2008 Spring 2008 New Mexico Tech New Mexico Tech
  • 2.
  • 3.
  • 4.
    11/07/25 4 Color Fundamentals ColorFundamentals ► 6 to 7 million cones in the human eye can be divided into three principal sensing categories, corresponding roughly to red, green, and blue. 65%: red 33%: green 2%: blue (blue cones are the most sensitive)
  • 5.
  • 6.
  • 7.
    11/07/25 7 Color Fundamentals ColorFundamentals ► The characteristics generally used to distinguish one color from another are brightness, hue, and saturation brightness: the achromatic notion of intensity. hue: dominant wavelength in a mixture of light waves, represents dominant color as perceived by an observer. saturation: relative purity or the amount of white light mixed with its hue.
  • 8.
    11/07/25 8 Color Fundamentals ColorFundamentals ► Tristimulus Red, green, and blue are denoted X, Y, and Z, respectively. A color is defined by its trichromatic coefficients, defined as X x X Y Z Y y X Y Z Z z X Y Z         
  • 9.
    11/07/25 9 CIE ChromaticityDiagram CIE Chromaticity Diagram It shows color composition as a function of x (red) and y (green)
  • 10.
    11/07/25 10 RGB ColorModel RGB Color Model
  • 11.
    11/07/25 11 RGB ColorModel RGB Color Model Pixel depth The total number of colors in a 24-bit RGB image is (28 )3 = 16,777,216
  • 12.
  • 13.
    11/07/25 13 Safe RGBcolors (or safe Web colors) are reproduced faithfully, reasonably independently of viewer hardware capabilities
  • 14.
  • 15.
    11/07/25 15 The CMYand CMYK Color Models The CMY and CMYK Color Models 1 1 1 C R M G Y B                                 Equal amounts of the pigment primaries, cyan, magenta, and yellow should produce black. In practice, combining these colors for printing produces a muddy-looking black. To produce true black, the predominant color in printing, the fourth color, black, is added, giving rise to the CMYK color model.
  • 16.
  • 17.
    11/07/25 17 HIS ColorModel HIS Color Model brightness: the achromatic notion of intensity. hue: dominant wavelength in a mixture of light waves, represents dominant color as perceived by an observer. saturation: relative purity or the amount of white light mixed with its hue.
  • 18.
    11/07/25 18 HIS ColorModel HIS Color Model
  • 19.
    11/07/25 19 HIS ColorModel HIS Color Model
  • 20.
    11/07/25 20 HIS ColorModel HIS Color Model
  • 21.
    11/07/25 21 Converting Colorsfrom RGB to HSI Converting Colors from RGB to HSI ► Given an image in RGB color format, the H component of each RGB pixel is obtained using the equation if B G 360 if B>G H            1 1/2 2 1 ( ) ( ) 2 cos ( )( ) R G R B R G R B G B                        
  • 22.
    11/07/25 22 Converting Colorsfrom RGB to HSI Converting Colors from RGB to HSI ► Given an image in RGB color format, the saturation component is given by   3 1 min( , , ) ( ) S R G B R G B    
  • 23.
    11/07/25 23 Converting Colorsfrom RGB to HSI Converting Colors from RGB to HSI ► Given an image in RGB color format, the intensity component is given by   1 3 I R G B   
  • 24.
    11/07/25 24 Converting Colorsfrom HSI to RGB Converting Colors from HSI to RGB ► RG sector (1 ) cos 1 cos(60 ) and 3 ( ) B I S S H R I H G I R B                (0 120 ) H    
  • 25.
    11/07/25 25 Converting Colorsfrom HSI to RGB Converting Colors from HSI to RGB ► RG sector 120 (1 ) cos 1 cos(60 ) and 3 ( ) H H R I S S H G I H B I R G                   (120 240 ) H    
  • 26.
    11/07/25 26 Converting Colorsfrom HSI to RGB Converting Colors from HSI to RGB ► RG sector 240 (1 ) cos 1 cos(60 ) and 3 ( ) H H G I S S H B I H R I G B                   (240 360 ) H    
  • 27.
  • 28.
  • 29.
  • 30.
    11/07/25 30 Pseudocolor ImageProcessing Pseudocolor Image Processing ► The process of assigning colors to gray values based on a specified criterion. ► Intensity Slicing ( , ) if ( , ) k k f x y c f x y V  
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
    11/07/25 36 Pseudocolor ImageProcessing Pseudocolor Image Processing ► Intensity to Color Transformation
  • 37.
    11/07/25 37 The imagesare obtained from an airport X-ray scanning system. The left contains ordinary articles and the right contains the same articles as well as a block of simulated plastic explosives.
  • 38.
  • 39.
  • 40.
  • 41.
    11/07/25 41 Pseudocolor bycombining several of the sensor images from the Galileo spacecraft, some of which are in spectral regions not visible to the eye. Bright red depicts materials newly ejected from an active volcano on Io, and the surrounding yellow materials are older sulfur deposits.
  • 42.
    11/07/25 42 Basics ofFull-Color Image Processing Basics of Full-Color Image Processing Let represent an arbitrary vector in RGB color space: At coordinates ( , ), ( , ) ( , ) ( , ) ( , ) ( , ) ( , ) ( , ) R G B R G B c c R c c G c B x y c x y R x y c x y c x y G x y c x y B x y                                            
  • 43.
    11/07/25 43 Basics ofFull-Color Image Processing Basics of Full-Color Image Processing
  • 44.
    11/07/25 44 Color Transformations ColorTransformations   ( , ) ( , ) g x y T f x y  1 2 ( , ,..., ), 1,2,..., . i i n s T r r r i n  
  • 45.
  • 46.
    11/07/25 46 ( ,) ( , ) g x y kf x y  , 1,2,3. i i s kr i   (1 ), 1,2,3. i i s kr k i     3 3 s kr 
  • 47.
  • 48.
  • 49.
    11/07/25 49 Color slicing Colorslicing ► Highlighting a specific range of colors in an image 1 2 If the colors of interest are enclosed by a cube of width W and centered at a protypical color with components ( , ,..., ), the necessary set of transformations is 0.5 if n i a a a s  any 1 | | / 2 otherwise j j j n i r a W r             
  • 50.
    11/07/25 50 Color slicing Colorslicing   0 2 2 0 1 If a sphere is used to specify the colors of interest, R is the radius of the enclosing of its center. The transformations is 0.5 if n j j j i i r a R s r      otherwise     
  • 51.
  • 52.
    11/07/25 52 Tone and Toneand Color Color Corrections Corrections
  • 53.
  • 54.
  • 55.
    11/07/25 55 Color ImageSmoothing Color Image Smoothing ( , ) Let denote the set of coordinates defining a neighborhood centered at ( , ) in an RGB color image. The average of the RGB component vectors in this neighborhood is 1 ( , ) ( , ) xy xy s t S S x y c x y c s t K   ( , ) ( , ) ( , ) 1 ( , ) 1 ( , ) 1 ( , ) xy xy xy s t S s t S s t S R s t K G s t K B s t K                            
  • 56.
  • 57.
  • 58.
  • 59.
    11/07/25 59 Color ImageSharpening Color Image Sharpening   2 2 2 2 The Laplacian of vector c is ( , ) ( , ) ( , ) ( , ) R x y c x y G x y B x y               
  • 60.
  • 61.
    11/07/25 61 Image Image Segmentation Segmentation Based on Basedon Color: Color: Segmentation Segmentation in HIS Color in HIS Color Space Space
  • 62.
    11/07/25 62 Segmentation inRGB Vector Space Segmentation in RGB Vector Space 1/2 1/2 2 2 2 Let the average color of interest is denoted by the RGB vector . Let denote an arbitrary point in RGB space. ( , ) ( ) ( ) ( ) ( ) ( ) T R R G G B B a z D z a z a z a z a z a z a z a                   
  • 63.
  • 64.
    11/07/25 64 Color EdgeDetection (1) Color Edge Detection (1) Let r, g, and b be unit vectors along the R, G, and B axis of RGB color space, and define vectors u r g b and v r g b R G B x x x R G B y y y                  
  • 65.
    11/07/25 65 Color EdgeDetection (2) Color Edge Detection (2) 2 2 2 2 2 2 u u= v v= and u v= xx yy xy R G B g x x x R G B g y y y R R G G B B g x y x y x y                                    
  • 66.
    11/07/25 66 Color EdgeDetection (3) Color Edge Detection (3) 1 The direction of maximum rate of change of c( , ) is given by the angle 2 1 ( , ) tan 2 The value of the rate of change at ( , ) in the direction of ( , ), is given by 1 F ( , )= 2 xy xx yy x x y g x y g g x y x y x y g                   1/2 cos2 ( , ) 2 sin 2 ( , ) x yy xx yy xy g g g x y g x y                
  • 67.
  • 68.