You are on page 1of 56

Color Image Processing

EEE 6209 Digital Image Processing

Outline
Motivation and Color Fundamentals
Standard Color Models (RGB/CMYK/HSI)
Demosaicing and Color Filtering
Pseudo-color and Full-color Image Processing
Color Transformation
Tone and Color Corrections
Color Image Smoothing, Sharpening, Segmentation,
Edge detection, and Denoising
Assignments
Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Motivation
Color is a powerful descriptors that simplifies feature extraction
and object identification from a scene
HVS is sensitive to thousands of color shades or intensities
instead of two dozens of shades of gray

Basics
Color spectrum of visible light has six broad regions, viz.,
Violet, Blue, Green, Yellow, Orange, and Red (ViBGYOR)
Achromatic light is void of color. Chromatic light spans
electromagnetic spectrum from 400 nm to 700 nm.
Radiance is the amount of light energy radiates from light
source in Watts. Luminance is the energy perceives by viewer in
Lumen. Infrared spectrum may have significant radiance but zero
luminance
Brightness is a subjective measure, depends on the
reflectance or absorption characteristics of the observed body
Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Color Spectrum

Color spectrum of white light passing through a prism.


Experimented by Sir Isaac Newton in 1666
Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Absorption Characteristics
65% cones
are sensitive to
Red
33% cones
are for Green
2% cones
are for Blue,
but very
sensitive!
Absorption characteristics experimented in 1965.
Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Primary and Secondary Colors


In 1931, CIE (Commission Internationale de lEcairage
International Commission on Illumination) designated three
primary color : Blue = 435.8 nm, Green = 546.1 nm, and Red =
700 nm long before absorption characteristics are obtained.
Additive mixing of primary color lights provides secondary color
of lights: Magenta= Red+Blue, Cyan= Green+Blue,
Yellow=Red+Green.
Additive mixing primary color lights is used as principle of
modern display devices. CRT (cathode ray tube) uses electron
sensitive phosphor. LCD (liquid crystal displays) uses thin film
transistors (TFTs) to block or pass polarized light. In plasma units
pixels are tiny gas cells coated with phosphor.
Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Primary and Secondary Colors

Pigments act like


subtractive colors, and
hence mixtures of pigments
provide common primary
color of light. For example,
Magenta and Yellow
provides Red color.

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Characteristics of Color
Brightness Achromatic notion of intensity.
Hue Dominant wavelength in the mixture of light waves, i.e.,
dominant color perceived by observer, say, Red
Saturation Relative purity or the amount of white light mixed
with a hue. For example, pink (red+white) and lavendar
(violet+white) are saturated. Degree of saturation is inversely
proportional to the amount of white light.
Chromaticity Hue and saturation together is the chromaticity.
Any color is specified a combination of tristimulus values
denotes as X (Red), Y (Green), and Z (Blue)
Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Characteristics of Color
A color is thus specified by trichromatic coefficients

X
Y
z
; y=
; z=
x=
X +Y + Z
X +Y + Z
X +Y + Z
x + y + z =1
CIE chromaticity diagram For a given value of x (red) and y
(green), a corresponding value of z=1-(x+y), i.e., blue is obtained
A color is thus specified by trichromatic coefficients
Any triangle inside chromaticity diagram shows all possible
colors which may be obtained mixing only three distinct
wavelength primary electromagnetic waves.
Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Chromaticity Diagram

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Color Gamuts

CRT Display

Printing

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

RGB Color Model


Color space in terms of three primary colors of light, viz. Red,
Green, and Blue
Hardware oriented models, e.g., monitors, video camera,
internet etc.
Number of bits used to represent a pixel is called pixel-depth.
For a 8-bit image one needs 24 bits in color space

24-bit color cube


Dr. S. M. Mahbubur Rahman

Coordinate

Color Image Processing


EEE 6209 Digital Image Processing

RGB Color Model

Acquiring the RGB


image in the reverse
process shown

Three hidden planes


in the cube
Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Safe RGB Colors


In practice, only 216
colors known as allsystem safe colors are
used in the internet and
represented by two
hexadecimal numbers
for each color

safe color cube


Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

CMY/CMYK Color Model


Color space in terms of the primary colors of pigment, viz.
Cyan, Magenta, Yellow, or Black
Printer or copier those use pigments on paper considers this
model. Four-color printing refers to CMYK model
Conversion of RGB and CMY model:

C
M

Y
Dr. S. M. Mahbubur Rahman

1 R

= 1 G

1 B

Color Image Processing


EEE 6209 Digital Image Processing

HSI Color Model


Color space in terms of its Hue, Saturation and
Brightness
The model is used for interpretation of human
understanding of colors
This model is used for image processing.
The model decouples the intensity component from the
color descriptors
It is known that Hue purity of color
It is also known that Saturation degree of pure color
(diluted with white color)
Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

HSI and RGB Color Model


Intensity of HSI space is the projection of a point on the
vertical line (connected line between black and white, called
intensity axis) shown in the RGB space
Locus of the color points lie on the plane perpendicular to the
intensity axis.

Conceptual
model in HSI
space

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Hue/Saturation in HSI Model


The color vector perpendicular to the intensity axis creates a
triangular or hexagonal shape with the boundaries of the cube
or circular shape inside the cube.
The saturation is the length of the color vector. Hue is the
angle of the vector.

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Hue/Saturation in HSI Model

Hue and saturation in the


triangular or circular color
planes

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

RGB to HSI Model



H =
Hue
360
with

= cos 1

[(R

if

B G

if

B > G

[(R
2
G)

1
2

G ) + (R B
+ (R B

3
Saturation S = 1
(R + G + B
Intensity
Dr. S. M. Mahbubur Rahman

1
(R + G + B
I =
3

)
)

)(G

)]

)] 2
1

[min {R , G , B }]

Color Image Processing


EEE 6209 Digital Image Processing

HSI to RGB Model


RG Sector (0 0 H < 120

S cos H
B = I (1 S ); R = I 1 +
; G = 3 I- (R + B

0
cos 60 H

GB Sector

(120

H < 240

H = H 120

S cos H
R = I (1 S ); G = I 1 +
; B = 3 I- (R + G

0
cos 60 H

BR Sector
G =

I (1

S );

Dr. S. M. Mahbubur Rahman

(240

H 360

H = H 240

S cos H
B = I 1 +
; R = 3 I- (R + B

0
cos 60 H

Color Image Processing


EEE 6209 Digital Image Processing

Components of HSI Model

(a) Original RGB


image. The
component images
are (b) Hue (c)
Saturation (d) Intensity

Dr. S. M. Mahbubur Rahman

(a) (b)
(c) (d)

Color Image Processing


EEE 6209 Digital Image Processing

Image Demosaicing
Demosaicing is a process of obtaining a full color image from
incomplete color samples
A single image sensor associated with the color filter array
(CFA) performs the demosaicing
A digital camera may store the raw data so that user-defined
software for CFA may be chosen instead of built-in firmware.
Problems of image demosaicing includes chromatic aliases,
zippering (abrupt change in intensity), and purple fringing.
Most commonly used CFA for demosaicing is the Bayer
Filter.
Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Bayer Filter
Bayer Filter has alternating Red
(R) and Green (G) filters in odd rows
and alternating Blue (B) and Green
(G) filters in the even rows.
Green filters are twice since HVS is
widely sensitive to Green color!
Optical anti-aliasing filter is used
between sensor and lens.
Image
due to
CFA
Original
Dr. S. M. Mahbubur Rahman

CFA on pixel array


of image sensor

Reconstructed
(Adobe)

Color Image Processing


EEE 6209 Digital Image Processing

Pseudocolor Image Processing


In intensity slicing, a set of intensity levels are coded with a
particular color

Functional diagram

Dr. S. M. Mahbubur Rahman

Geometric interpretation

Color Image Processing


EEE 6209 Digital Image Processing

Intensity Slicing
Monochrome is
color coded

Two colors
Eight colors
Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Intensity Slicing
Monochrome is color coded for SAR images

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Pseudo-color Processing
Pseudo-color enhancement by gray level to color transformation

Explosive
detection

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Pseudo-color Processing
Two gray level transformation
functions for detection of
explosives in a luggage in a
typical airport

Functional diagram

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Pseudo-color Processing
Pseudo-color enhancement
of multispectral images

(a)-(d) Images of four


bands. (e) First three are
treated as RGB
components (f) Infrared
image is shown in red
(a) (b)
(c) (d)
(e) (f)
Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Pseudo-color Processing

Pseudo-color enhancement
in terms of material deposition,
e.g., sulfur content shown in
yellow for Jupiter moon Io

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Full-color Processing
Full-color processing uses independent mask processing of
individual RGB components

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Full-color Processing

Components for full


color processing in
different color spaces

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Color Transformation
General transformation
For RGB or CMY or HSI
For CMYK
Color mapping
HSI

s 3 = kr 3

RGB

s i = kr i

CMY

s i = T i (r1 , r 2 , L , r n
n = 3
n = 4

(0 < k
(0 < k

s i = kr i + (1 k )

Dr. S. M. Mahbubur Rahman

< 1 ) s 1 = r1 s 2 = r 2

< 1 ) i = 1, 2 ,3

(0

< k < 1 ) i = 1, 2 ,3

Color Image Processing


EEE 6209 Digital Image Processing

Color Transformation
Intensity
reduction by
33% in three
different color
spaces using
full-color
processing

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Color Complements
Hues directly
opposite to color
circle are called
color complements
Complements
are used to
generate color film
negatives

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Color Complements
(a) Original image
(b) Transformation
functions for
generating
complements (c)
Resultant image for
RGB space (d)
Resultant image for
HSI space

Dr. S. M. Mahbubur Rahman

(a) (b)
(c) (d)

Color Image Processing


EEE 6209 Digital Image Processing

Color Slicing
Selection of a color using a hypercube in a color space

Red color in the RGB space using two


different set of cubes
Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Tone and Color Corrections


Digital darkroom Allows tone adjustment and color
corrections digitally by avoiding traditional wet processing
Most common use are photo enhancement and color
reproduction in the printing media and compression
For adjustment or corrections device-independent color
model should be used
Many color management system (CMS) consider the CIE

L * a *b *

or simply CIELAB model

CIELAB is proposed in 1976

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

CIELAB Model
The L * a * b * color components are
Y
16
L * = 116 h
YW
X

h
a * = 500 h

XW
Y

h
b* = 200 h

YW
where

Y
YW

Z
ZW

3 q

h (q ) =
16
7 . 787 q +
116

Dr. S. M. Mahbubur Rahman

q > 0 . 008856
q 0 . 008856

Color Image Processing


EEE 6209 Digital Image Processing

CIELAB Model
The X W , YW , ZW

are the reference white tristimulus


values of a perfectly reflecting diffuser under CIE standard D65
illumination, which is defined as x=0.3127 and y=0.3290 in the
CIE chromaticity diagram
Features of

L * a *b *

color space

Colormetric Colors perceived as matching are


encoded identically.
Uniform perceptuality Color differences among
various hues are perceived uniformly
Device independent and gamut encompasses the
entire visible spectrum
Transformation to another color space is common
Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

CIELAB Model
Other features of

L * a *b *

color space

Transformation to another color space is necessary


Excellent decoupler of intensity L * and color
Red-Green and b * for Green-Blue

a * for

Tonal adjustment and color corrections are done


independently and interactively (in other words
sequentially)
Three common tonal ranges (or key types) are (i) Highkey (colors at high intensities) (ii) Low-key (colors at low
intensities) (iii) Middle-key (lie in between high and lowkeys)
Intensites should be uniform in colors or shadows

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Tonal Transformation
Tonal or contrast
correction and
corresponding
transformation function in
RGB color space

MiddleKey

HighKey

LowKey

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Color Transformation
Color balancing
correction and
corresponding
transformation function in
CMYK color space

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Histogram Processing
Histogram equalization
followed by saturation
adjustment in HSI color
space

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Processing of Color Image


RGB Components

HSI Components

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Smoothing of Color Image

(a) (b) (c)

Image smoothing by 55 averaging mask using (a) RGB


components and (b) Intensity component of HSI space.
(c) Absolute difference between (a) and (b)

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Sharpening of Color Image

(a) (b) (c)

Image sharpening by Laplacian using (a) RGB


components and (b) Intensity component of HSI space.
(c) Absolute difference between (a) and (b)

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Segmentation of Color Image


Approaches for enclosing data regions for RGB vector
segmentation

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Segmentation of Color Image


(a) Original RGB image (b)
Segmented region of red
color from the image

Dr. S. M. Mahbubur Rahman

(a)
(b)

Color Image Processing


EEE 6209 Digital Image Processing

Gradient of Color Image


Gradient of color image
Maximum rate of
change would be at
2 g xy
1
1
(x, y ) = tan

2
g xx g yy

R
G
B
+
g xx =
+
x
x
x
2

R
G
B
g yy =
+
+
y
y
y

R R G G B B
g xy =
+
+
x y x y x y

The maximum gradient would be

F (x, y ) = {(g xx + g yy ) + (g xx g yy )cos 2 (x, y ) + 2 g xy sin 2 (x, y )}


2

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Gradient of Color Image


(a) Original color image (b) Color
gradient (c) Added result of
individual gradients of RGB
components (d) Absolute
difference between (b) and (c)

Individual
gradients of RGB
components
Dr. S. M. Mahbubur Rahman

(a) (b)
(c) (d)

Color Image Processing


EEE 6209 Digital Image Processing

Noisy Color Image


(a) Red (b) Green (c)
Blue components of
RGB color space for
AWGN (d) Noisy
color image

Dr. S. M. Mahbubur Rahman

(a) (b)
(c) (d)

Color Image Processing


EEE 6209 Digital Image Processing

Noisy Color Image


(a) (b) (c)

(a) Hue (b) Saturation (c) Intensity components of HSI color


image for AWGN

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Noisy Color Image


(a) Color image
corrupted by Saltand-Pepper noise (b)
Hue (c) Saturation (d)
Intensity components
of HSI color space

Dr. S. M. Mahbubur Rahman

(a) (b)
(c) (d)

Color Image Processing


EEE 6209 Digital Image Processing

Assignments
Problem #1

Problem #2

Dr. S. M. Mahbubur Rahman

Color Image Processing


EEE 6209 Digital Image Processing

Assignments
Problem #3
Derive the CMY intensity mapping function from its RGB counterpart.

Problem #4

Dr. S. M. Mahbubur Rahman

You might also like