Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
20 views38 pages

Digital Image Processing

This was created for Digital Image Processing
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views38 pages

Digital Image Processing

This was created for Digital Image Processing
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Digital image processing (DIP)

Md. Zasim Uddin, PhD


Associate professor, Dept. Computer Science & Engineering
Begum Rokeya University, Rangpur
Color image processing
 Color fundamentals
 Color models
 Color perception models
Color fundamentals
 Sir Isaac Newton discovered that when a beam of sunlight
passes through a glass prism, the emerging beam is split
into a spectrum of colors
Color Fundamentals (cont…)
 The colors that humans and most animals perceive in an
object are determined by the nature of the light reflected
from the object

 For example, green


objects reflect light
with wave lengths
primarily in the range
Colors
of 500 – 570 nm while Absorbed

absorbing most of the


energy at other
wavelengths.
Color fundamentals
3 basic quantities are used to describe the
quality of a chromatic light source:
 Radiance: the total amount of energy that flows
from the light source (measured in watts)

 Luminance: the amount of energy an observer


perceives from the light source (measured in
lumens)

 Brightness: a subjective (practically


unmeasurable) notion that embodies the
achromatic notion of intensity of light
Color fundamentals
 Chromaticlight spans the electromagnetic
spectrum from approximately 400 to 700 nm.

 Human color vision is achieved through 6 to 7


million cones in each eye.
Color fundamentals
 Three principal sensing groups:
66% of these cones are sensitive to red light
33% to green light
2% to blue light.

 Absorption
curves for the different cones have
been determined experimentally.

 Strangely these do not match the CIE standards


for red (700nm), green (546.1nm) and blue
(435.8nm) light as the standards were developed
before the experiments!
Color fundamentals
Notice that the curves centered
at G and R are very close
Color fundamentals
 Theprimary colors can be
added to produce the
secondary colors.

 Mixing
the three primaries
produces white.

 Mixinga secondary with its


opposite primary produces
white (e.g. red+cyan).
Color fundamentals
Important difference:
 Primary colors of light (red, green, blue)
 Primary colors of pigments (colorants)
 A color that subtracts or absorbs a primary color of
light and reflects the other two.
 These are cyan, magenta and yellow (CMY).
 A proper combination of pigment primaries
produces black.
Color fundamentals
Distinguishing one color from another:
 Brightness: the achromatic notion of intensity.

 Hue: the dominant wavelength in a mixture of


light waves (the dominant color perceived by an
observer, e.g. when we call an object red or
orange we refer to its hue).
 Saturation: the amount of white light mixed with
a hue. Pure colors are fully saturated. Pink
(red+white) is less saturated.
Color fundamentals
 Hue and saturation are called chromaticity.
 Therefore,any color is characterized by its
brightness and chromaticity.
Color fundamentals
A color is then specified by its trichromatic
coefficients:
X Y Z
x , y , z
X Y  Z X Y  Z X Y  Z

x  y  z 1
Color fundamentals
 Specifying colors systematically can be
achieved using the CIE chromaticity diagram.
 On this diagram the x-axis represents the
proportion of red and the y-axis represents the
proportion of green used to produce a specific
color.
 The proportion of blue used in a color is
calculated as:
z = 1 – (x + y)
Color fundamentals
 Point marked “Green”
 62% green, 25% red and
13% blue.

 Point marked “Red”


 32% green, 67% red
and 1% blue.

 The diagram is usefull


for color mixing.
CIE chromacity diagram
 Any color located on
the boundary of the
chromaticity chart is
fully saturated (Pure
colors).
 The point of equal
energy (PEE) has
equal amounts of red,
green and blue.
 It is the CIE standard
for pure white.
CIE chromacity diagram
 Any straight line joining
two points in the
diagram defines all the
different colors that can
be obtained by
combining these two
colors additively.
A line drawn from the
PEE to any point on the
boundary defines all the
shades of that particular
color.
CIE chromacity diagram
 By combining any
three given colors we
may obtain the colors
enclosed in the
triangle defined by
the three initial
colors.
Color models
 From the previous discussion it should be
obvious that there are different ways to model
color.
 We will consider two very popular models used
in color image processing:
 RGB (Red Green Blue)
 HSI (Hue Saturation Intensity)
RGB
 Inthe RGB model each color appears in its
primary spectral components of red, green and
blue.

 Themodel is based on a Cartesian coordinate


system.
RGB
 RGB values are at 3
corners.
 Cyan magenta and yellow
are at three other corners.
 Black is at the origin.
 White is the corner furthest
from the origin.
 Different colors are points
on or inside the cube
represented by RGB
vectors.
RGB
 Images represented in the RGB color model
consist of three component images – one for
each primary color.
 Whenfed into a monitor these images are
combined to create a composite color image.
 The number of bits used to represent each
pixel is referred to as the color depth.
A 24-bit image is often referred to as a full-color
image as it allows =  16,777,216 colors.

3
8
2
RGB

These are scalar valued pixels


The HSI color model
 RGB is useful for hardware implementations
and is serendipitously related to the way in
which the human visual system works.
 However, RGB is not a particularly intuitive way
in which to describe colors.
 Rather when people describe colors they tend
to use hue, saturation and brightness.
 RGB is great for color generation, but HSI is
great for color description.
The HSI color model
Reminder:
 Hue: A color attribute that describes a pure
color (pure yellow, orange or red).
 Saturation: Gives a measure of how much a
pure color is diluted with white light.
 Intensity: Brightness is nearly impossible to
measure because it is so subjective. Instead we
use intensity. Intensity is the same achromatic
notion that we have seen in grey level images.
HSI, Intensity & RGB
 Intensity can be extracted from RGB images.
 However, human perception of color does not
refer to percentages of RGB.
HSI, Intensity & RGB
 The intensity component
of any color can be
determined by passing a
plane perpendicular to
the intenisty axis and
containing the color
point.
 The intersection of the plane
with the intensity axis gives us the intensity
component of the color.
HSI, Intensity & RGB
 The saturation of a color
(percentage of white
missing from the color)
increases as a function of
distance from the
intensity axis.
The HSI color model
 Ifwe look straight down at the RGB cube as it was
arranged previously
 we would see a hexagonal
shape with each primary
color separated by 120°
and secondary colors
at 60°from the primaries.
 The HSI model is
composed of a vertical
intensity axis and the locus of color points that lie on
planes perpendicular to that axis.
The HSI color model
 Hexagonal shape at an
arbitrary color point
 The hue is determined by an
angle from a reference point,
usually red.
 The saturation is the distance
from the origin to the point.
 The intensity is determined by
how far up the vertical intensity
axis this hexagonal plane sits
(not apparent from this
diagram).
The HSI color model
 Asthe only important things are the angle and
the length of the saturation vector this plane is
also often represented as a circle or a triangle.
Converting from RGB to HSI
 Given a color as R, G, and B its H, S, and I
values are calculated as follows:

 if B  G
H  
360   if B  G
3
S  1 minR,G,B
R  G  B

 
2 
 1
R  G  R  B 
  cos 
1
1  I  13 R  G  B

 2

  R  G  R  BG  B 
2


Converting from RGB to HSI
 Givena color as H, S, and I it’s R, G, and B
values are calculated as follows:
 RG sector (0 <= H < 120°)
 S cos H 
R  I 1   , G  3I   R  B  , B  I1 S
 cos  60  H  

 GB sector (120° <= H < 240°)



 S cos  H  120  
R  I 1  S  , G  I 1   , B  3I  R  G
 cos  H  60  
Converting From HSI To RGB

 BR sector (240° <= H <= 360°)


 S cos  H  240  
R  3I   G  B  , G  I 1  S  , B  I 1  
 cos  H  180  
HSI & RGB

RGB Color Cube

H, S, and I Components of RGB Color Cube


Manipulating Images In The HSI Model

 In
order to manipulate an image under the HSI
model we:
 First convert it from RGB to HSI
 Perform our manipulations under HSI
 Finally convert the image back from HSI to
RGB
RGB HSI RGB
Image Image Image

Manipulations
RGB -> HSI -> RGB

RGB
Hue
Image

Saturation Intensity
RGB -> HSI -> RGB

Hue
Saturation

Intensity RGB
Image

You might also like