Notes Colour Image Processing
Notes Colour Image Processing
Preview
Preview
Light
What do we see?
If its wavelength is comprised between 400 and 700 nm 1) a dominant wavelength (or frequency) which is the color
(visible spectrum), the wave can be detected by the human of the light (hue),
eye and is called monochromatic light 2) brightness (luminance), intensity of the light (value),
1
18-11-2015
Primary Primary
color color Subtractive primary colors: CMY
use in the case of pigments in
printing devices
White subtracted by CMY to get
Black
2
18-11-2015
3
18-11-2015
Color Monitors
Printing devices
Y Z printing.
X y z
x
X Y Z X Y Z X Y Z and HSI model, which corresponds closely with the way humans
Here we assume that r,g,b are real numbers in the interval [0,1].
You will often see the values of r,g,b as integers in the interval
[0,255].
4
18-11-2015
Source: [Link]
R = 8 bits
Color depth 24 bits Red fixed at 127
G = 8 bits
= 16777216 colors
B = 8 bits
Hidden faces
of the cube
(Images from Rafael C. Gonzalez and Richard E. (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition. Wood, Digital Image Processing, 2nd Edition.
• Eight bits means the channel can make eight combinations of on or off
of the color, per pixel, 256 colors total. You have three channels. How
many colors can be generated?
5
18-11-2015
(Images from Rafael C. Gonzalez and Richard E. (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition. Wood, Digital Image Processing, 2nd Edition.
6
18-11-2015
C 1 R
M 1 G
Y 1 B
• Why?
Pigments absorb light
7
18-11-2015
c 1 r
Cyan, Magenta and Yellow are the secondary colors m 1 g
of light
y 1 b
Most devices that deposit colored pigments on
Example 11.2: The red colour is written in RGB as (1,0,0). In CMY it is
paper, such as color printers and copiers, require written as
CMY data input.
c 1 r 1 1 0
C 1 R m 1 g 1 0 1
M 1 G
y 1 b 1 0 1
Y 1 B that is, magenta and yellow.
0 1 r
1 1 g
0 1 b
giving,
8
18-11-2015
Relationship Between RGB and HSI Color Models Relationship Between RGB and HSI Color Models
• Will you describe a color using its R, G, B components? RGB, CMY models are not good for human interpreting
• Human describe a color by its hue, saturation, and
HSI Color model:
brightness
Hue: Dominant color
– Hue : color attribute
Color carrying
– Saturation : purity of color (white->0, primary color->1) Saturation: Relative purity (inversely proportional information
– Brightness : achromatic notion of intensity to amount of white light added)
Intensity: Brightness
H
dominant
wavelength
S
purity
% white
I
Intensity RGB HSI
Source: [Link]
53 (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
9
18-11-2015
Intensity is given by a position on the vertical axis. Intensity is given by a position on the vertical axis.
Example: HSI Components of RGB Cube Converting Colors from RGB to HSI
if B G
H
RGB Cube 360 if B G
1
( R G) ( R B)
cos1 2
1/ 2
( R G ) ( R B)(G B)
2
3
S 1
RG B
1
I ( R G B)
3
10
18-11-2015
Converting Colors from HSI to RGB Example: HSI Components of RGB Colors
RG sector: 0 H 120 GB sector: 120 H 240
H H 120
S cos H
R I 1 R I (1 S ) RGB
cos(60 H )
Image Hue
B I (1 S ) S cos H
G I 1
cos(60 H )
G 1 ( R B)
B 1 ( R G)
BR sector: 240 H 360
H H 240
S cos H
B I 1 Saturation Intensity
cos(60 H )
G I (1 S )
R 1 (G B) (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
shades of gray.
T C2
C1
0 T L-1
Intensity
A gray scale image viewed as a 3D surface.
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
11
18-11-2015
Ck = Color No. k
An X-ray image of a weld with cracks lk = Threshold level k
Color
Ck
Ck-1
C3
Color
map
Blue component
Color
coded
images
12
18-11-2015
Color
coded
images
A close-up
(Images from Rafael C. Gonzalez and Richard E. (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition. Wood, Digital Image Processing, 2nd Edition.
13
18-11-2015
Example: Full-Color Image and Variouis Color Space Components Color Transformation
Use to transform colors to colors.
Color image
Formulation:
g ( x, y ) T f ( x, y )
CMYK components f(x,y) = input color image, g(x,y) = output color image
T = operation on f over a spatial neighborhood of (x,y)
si Ti (r1, r2 ,, rn ) i= 1, 2, …, n
HSI components
Where ri = color component of f(x,y) For RGB images, n = 3
(Images from Rafael C. Gonzalez and Richard E.
si = color component of g(x,y)
Wood, Digital Image Processing, 2nd Edition.
Color circle
Formula for CMY: I H,S
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. (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition. Wood, Digital Image Processing, 2nd Edition.
W
0.5 if rj a j Set to gray
si 2 any 1 j n
ri otherwise Keep the original
i= 1, 2, …, n color
or
0.5 if rj a j R0
n
2 2 Set to gray
si j 1
ri otherwise Keep the original
color
i= 1, 2, …, n
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
14
18-11-2015
Original image
Contrast enhancement
(Images from Rafael C. Gonzalez and Richard E. (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition. Wood, Digital Image Processing, 2nd Edition.
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.
1
R( x, y )
K ( x , y )S xy
1 1
After histogram After increasing c ( x, y ) c
K ( x , y )S xy
( x , y ) K G ( x , y )
equalization saturation component ( x , y )S xy
1 B( x, y )
K ( x ,
y )S xy
15
18-11-2015
Color Image Smoothing Example (cont.) Color Image Smoothing Example (cont.)
HSI Components
Green Blue
(Images from Rafael C. Gonzalez and Richard E. (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition. Wood, Digital Image Processing, 2nd Edition.
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. (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition. Wood, Digital Image Processing, 2nd Edition.
16
18-11-2015
3 4
Color Segmentation in HSI Color Space (cont.) Color Segmentation in HSI Color Space (cont.)
Binary thresholding of S component Product of 2 and 5
with T = 10%
5 6
7 8
(Images from Rafael C. (Images from Rafael C.
Gonzalez and Richard E. Gonzalez and Richard E.
Wood, Digital Image Histogram of 6 Segmentation of red color pixels Wood, Digital Image
Processing, 2nd Edition. Processing, 2nd Edition.
Color Segmentation in RGB Vector Space Example: Segmentation in RGB Vector Space
Color image
17
18-11-2015
F ( ) ( g xx g yy ) ( g xx g yy ) cos 2 2 g xy sin 2
Red Green Blue We see 1 2
2 objects. 2
1 2 g xy
tan 1
We see 2 g xx g yy
4 objects. 2 2 2
R G B R G B
2 2 2
Edges g xx g yy
x x x y y y
R R G G B B
g xy
x y x y x y
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
(Images from Rafael C. Gonzalez and Richard E. (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition. Wood, Digital Image Processing, 2nd Edition.
AWGN sh2=800
Noise is less
noticeable
in a color
image
18
18-11-2015
Saturation Intensity
JPEG2000 File
(Images from Rafael C. Gonzalez and Richard E. After lossy compression with ratio 230:1 (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition. Wood, Digital Image Processing, 2nd Edition.
19