0% found this document useful (0 votes)
10 views61 pages

DIP9

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)
10 views61 pages

DIP9

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/ 61

DIGITAL IMAGE

PROCESSING
Colour Image Processing
Introduction
Today we’ll look at colour image processing, covering:
 Colour fundamentals
 Colour models
Colour Fundamentals
In 1666 Sir Isaac Newton discovered that when a
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

beam of sunlight passes through a glass prism, the


emerging beam is split into a spectrum of colours
Colour Fundamentals (cont…)
The colours 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 Colours
Absorbed
of 500 – 570 nm while
absorbing most of the
energy at other
wavelengths
Colour Fundamentals

 Colours that a human eye can perceive are determined by the


nature of light reflected from an object
 A body that reflects light that is balanced in all visible
wavelengths appears white
 Similarly, reflection in a limited range of wavelengths exhibits
some shade of the colour
 None of the colour abruptly ends but rather blends smoothly
into the next colour
Colour Fundamentals (cont…)
Chromatic light spans the electromagnetic spectrum
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

from approximately 400 to 700 nm


As we mentioned before human colour vision is
achieved through 6 to 7 million cones in each eye
Colour Fundamentals
 The cones in the human eye, responsible for colour vision can be
divided into three principal sensing categories, corresponding to
Red, Green and Blue
Approximately 65% of all cones are
sensitive to red light

33% to green and only 2% are


sensitive to Blue light

The colours are seen as variable


combinations of the so called
primary colours, red, green and
blue (RGB)
Colour Fundamentals
 When the colour attribute of light is not considered, its only
attribute of interest is its intensity
 The term gray level refers to the measure of intensity (ranging
from black to white)
 Three basic quantities are used to describe the quality of a
chromatic light source:
 Radiance: is the total amount of energy that flows from a light source
 Luminance: is the measure of the amount of energy an observer perceives
from a light source
 Brightness: is a subjective descriptor that is practically impossible to
measure (kind of the achromatic notion of intensity)
Colour Fundamentals
 Additive Primaries: Primary colours can be added to produce
secondary colours of light
 Yellow (Red + Green)
 Magenta (Red + Blue)
 Cyan (Blue + Green)
Mixing the three primaries, or the secondary with its
opposite primary produces white colour
Subtractive Primaries (Pigments):

Cyan (Blue + Green) + Yellow (Red + Green)= Green


Cyan (Blue + Green) + Magenta(Red + Blue)= Blue
Magenta (Red + Blue) + Yellow (Red + Green)= Red
Colour Fundamentals
 The characteristics generally used for colour differentiation are:
 Brightness is similar to notion of intensity in monochrome domain
 Hue represents the dominant wavelength in a mixture of light or it
represents the perception of an observer about the dominant colour
 Saturation refers to the purity of a colour or the amount of white light
mixed with hue
 For example, pink (red + white) and lavender (violet + white) are less
saturated
 Hue and Saturation taken together are called chromaticity
 Therefore, chromaticity of a colour shows the perception of the
main colour and the amount of dilution that it has because of
addition of white light
Colour Fundamentals- Chromaticity diagram

 The chromaticity diagram shows colour as a function of x(red)


and y(green)
For any value of red and green, the
corresponding blue can be obtained using:
z=1-(x+y)
Contains 62% green
Red: 32% green,
67% red and
25% red
1% blue And 13% blue

Any point located on the boundary is fully-


saturated

A straight line connecting two points (two colours)


on the chromaticity diagram shows that any
combination of colours (along the line) can be
obtained by adding those two colours (end points)
Colour Fundamentals- Chromaticity diagram

Determining range of colours from three different


colours
•Any colour on the boundary or inside the
triangle (connecting the three colours) can
be produced by mixing the three colours

•Mixing the colours is a hard to control


process

Colour gamut of RGB monitors

Colour gamut of printers


Gamut: subset of colors which can be
accurately represented by a certain output
device.
Colour Models

 Colour models are there to facilitate specification of colours in


some standard
 Colour models provide specification of a coordinate system
where each colour is represented by a single point
 Colour models are either hardware or application oriented
 Colour models used in practice are:
 RGB for colour monitors, video cameras
 CMY and CMYK models for colour printing
 HSI closely corresponds to the way humans describe and interpret colour
RGB
In the RGB model each colour appears in its primary
spectral components of red, green and blue
The model is based on a Cartesian coordinate
system
 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 colours are points on or inside the cube


represented by RGB vectors
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

RGB (cont…)
RGB (cont…)
Images represented in the RGB colour model consist of
three component images – one for each primary
colour
When fed into a monitor these images are combined
to create a composite colour image
The number of bits used to represent each pixel is
referred to as the colour depth
A 24-bit image is often3 referred to as a full-colour
 
image as it allows 28 = 16,777,216 colours
Colour Models – RGB – The Web-safe/All
systems safe colours
 Given the variety of hardware systems the colour reproduction
becomes an issue
 The web-safe colours is a subset (216 colours) that are tested to be
produced in the same way by all hardware systems
 Web safe colours are used whenever it is desired that a certain colour
viewed by most people appear the same
The HSI Colour Model
RGB is useful for hardware implementations and is
related to the way in which the human visual system
works
However, RGB is not a particularly intuitive way in
which to describe colours
 For example, it is not common to say that a car’s colour
contains 30% red, 40% green and 10% blue in a
normal conversation
RGB is great for colour generation, but HSI is great
for colour description
The HSI Colour Model (cont…)
A more useful model is the HSI model
The HSI model uses three measures to describe
colours:
 Hue represents the perception of an observer
about the dominant colour
 Saturation refers to the purity of a colour or the
amount of white light mixed with hue
 Intensity (gray level) gives a measure of the
degree of blackness and whiteness
HSI, Intensity & RGB
Intensity can be extracted from RGB images
Remember the diagonal on the RGB colour cube that
we saw previously ran from black to white – called
intensity axis.
Now consider if we stand this cube on the black
vertex and position the white vertex directly above it
HSI, Intensity & RGB (cont…)
Now the intensity component of any
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

colour can be determined by passing


a plane perpendicular to the intenisty
axis and containing the colour point
The intersection of the plane
with the intensity axis gives us the
intensity component of the colour
 Saturation of the colour increases

as the distance from the intensity axis increases


 Saturation of point on the intensity axis is zero
HSI, Hue & RGB
In a similar way we can extract the hue from the RGB
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

colour cube
Consider a plane defined by
the three points cyan, black
and white
All points contained in
this plane must have the
same hue (cyan) as black
and white cannot contribute
hue information to a colour
The HSI Colour Model
Consider if we look straight down at the RGB cube as it
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

was arranged previously


We would see a hexagonal
shape with each primary
colour separated by 120°
and secondary colours
at 60°from the primaries
So the HSI model is
composed of a vertical
intensity axis and the locus of colour points that lie on
planes perpendicular to that axis
The HSI Colour Model (cont…)
To the right we see a hexagonal
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

shape and an arbitrary colour


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
intenisty axis this hexagonal plane sits (not apparent
from this diagram
The HSI Colour Model (cont…)
Because the only important things are the angle and
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

the length of the saturation vector this plane is also


often represented as a circle or a triangle
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

HSI Model Examples


Images taken from Gonzalez & Woods, Digital Image Processing (2002)

HSI Model Examples


Converting From RGB To HSI
Given a colour as R, G, and B its H, S, and I values
are calculated as follows:
 
2 
 if B  G  1
R  G  R  B 
H     cos 
1
1 

360   if B  G 
 
 R  G2  R  BG  B 2


3
S  1 min R,G,B I  13 R  G  B
R  G  B



Converting From HSI To RGB
Given a colour 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 (cont…)

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


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

 

Images taken from Gonzalez & Woods, Digital Image Processing (2002)

HSI & RGB

H, S, and I Components of RGB Colour Cube


RGB Colour Cube
Manipulating Images In The HSI Model

In order to manipulate an image under the HSI model


we:
 Firstconvert it from RGB to HSI
 Perform our manipulations under HSI

 Finally convert the image back from HSI to RGB

RGB RGB
HSI Image
Image Image

Manipulations
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Saturation
Image
RGB
RGB -> HSI -> RGB

Hue

Intensity
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Intensity
Hue
RGB -> HSI -> RGB (cont…)

RGB
Image
Saturation
Pseudocolour Image Processing
Pseudocolour (also called false colour)
image processing consists of assigning
colours to grey values based on a specific
criterion
The principle use of pseudocolour image
processing is for human visualisation
 Humans can discern between thousands of
colour shades and intensities, compared to
only about two dozen or so shades of grey
Pseudo Colour Image Processing –
Intensity Slicing
Intensity slicing and colour coding is one of the
simplest kinds of pseudocolour image processing
First we consider an image as a 3D function
mapping spatial coordinates to intensities (that we
can consider heights)
Now consider placing planes at certain levels
parallel to the coordinate plane
If a value is one side of such a plane it is rendered
in one colour, and a different colour if on the other
side
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

Slicing (cont…)
Pseudocolour Image Processing – Intensity
Pseudocolour Image Processing – Intensity
Slicing (cont…)
In general intensity slicing can be summarised as:
 Let [0, L-1] represent the grey scale
 Let l0 represent black [f(x, y) = 0] and let lL-1 represent
white [f(x, y) = L-1]
 Suppose P planes perpendicular to the intensity axis
are defined at levels l1, l2, …, lp
 Assuming that 0 < P < L-1 then the P planes partition
the grey scale into P + 1 intervals V1, V2,…,VP+1
Pseudocolour Image Processing – Intensity
Slicing (cont…)
 Grey level colour assignments can then be made
according to the relation:
f (x, y)  ck if f (x, y)  Vk
 where ck is the colour associated with the kth intensity
level Vk defined by the partitioning planes at l = k – 1
 and l = k
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

RGB -> HSI -> RGB (cont…)


Images taken from Gonzalez & Woods, Digital Image Processing (2002)

RGB -> HSI -> RGB (cont…)


Images taken from Gonzalez & Woods, Digital Image Processing (2002)

RGB -> HSI -> RGB (cont…)


Images taken from Gonzalez & Woods, Digital Image Processing (2002)

RGB -> HSI -> RGB (cont…)


Chapter 6
Color Image Processing
Chapter 6
Color Image Processing
Chapter 6
Color Image Processing
Chapter 6
Color Image Processing
Chapter 6
Color Image Processing
Chapter 6
Color Image Processing
Chapter 6
Color Image Processing
Chapter 6
Color Image Processing
Chapter 6
Color Image Processing
Chapter 6
Color Image Processing
Chapter 6
Color Image Processing

  W
0.5 if  rj - a j  
si    2  any1 jn
r
 i otherwise
Chapter 6
Color Image Processing
Chapter 6
Color Image Processing
Chapter 6
Color Image Processing
Chapter 6
Color Image Processing
Chapter 6
Color Image Processing
Chapter 6
Color Image Processing
Chapter 6
Color Image Processing

You might also like