You are on page 1of 111

ECT 385: Topics in digital image processing

S5 Minor

A picture is worth a thousand words

Module 1
Reference : Digital Image Processing By R C Gonzalez and R E Woods
Introduction
 Digital Image Processing
 processing digital images by means of a digital computer
 What is an image?
A 2-D function, f(x, y)
x and y are spatial (plane) coordinates
Amplitude of f is called the intensity or gray level of the image at that
point
 Digital image
x, y, f(x, y) are all finite and discrete
is composed of a finite number of elements
each of which has a particular location and value
These elements are referred to as
picture elements,
image elements,
pels
Pixels -most widely used
 Common image formats include:
1 sample per point (grayscale)
3 samples per point (Red, Green, and Blue)
Video (above information plus time)
 Digital image processing focuses on two major tasks
Improvement of pictorial information for human interpretation
Processing of image data for storage, transmission and representation for
autonomous machine perception

High-level Processing
• Cognitive functions:
Scene understanding,
Mid-level Processing autonomous navigation
• Classification, • Input: Attributes
segmentation Output: Understanding
Low-level Processing • Input: Image
Output: Attributes
• Noise removal, image
sharpening, contrast
enhancement
• Input: Image
Output: Image
 Advantages of digital image processing
Flexibility and Adaptability
 No hardware modifications are necessary in order to reprogram
digital computers to solve different tasks
 Can process image signals adaptively
Data Storage and Transmission
With the development of different image-compression algorithms, the
digital data can be effectively stored
 Can easily transmit from one place to another
 Challenges are
memory and processing speed capabilities of computers
Applications
Medicine
Imaging – X-ray, ultrasound
Image segmentation and pattern recognition is used in digital
mammography to identify tumours.
lossless compression algorithms allow the medical images to be
transmitted effectively from one place to another.
Forensics
Personal identification using biometrics such as face, fingerprint, iris,
vein pattern, etc.
Remote Sensing
information about the earth’s surface and atmosphere
provide data for diverse applications like planning, hydrology,
agriculture, geology and forestry
Applications
Communications
Effective image and video compression algorithms help to transmit the
data effectively for live video conference
Automotives
Night vision system helps to identify obstacles during night time to
avoid accidents
Artistic effects
In this course we will study…
Basics of Image and image formation

9
In this course we will study…

Image enhancement

Why this is possible?


How ?

10
In this course we will study…
Edge detection and image segmentation

How ?
Theory
Practice

11
In this course we will study…

Image restoration

How to do this
Theory

12
In this course we will study…

Image compression

How to do this
Theory

245,760 bytes 5,951 bytes

13
Overview of the course
Overview of the course
Elements of visual perception : Human Visual System
 Goal: help an observer interpret the content of an image
• Developing a basic understanding of the visual process is important

 Eye characteristics
 nearly spherical
 approximately 20 mm in diameter
Elements of visual perception : Human Visual System
 Three membranes
 Cornea (transparent) & sclera (opaque)
outer cover
 Choroid
contains a network of blood vessels

 major source of nutrition to the eye


 heavily pigmented to reduce amount of
extraneous light entering the eye
Also contains the iris diaphragm (2-8 mm to
allow variable amount of light into the eye)
 Retina
inner most membrane, objects are imaged on
the surface
 Amount of light entering the eye is controlled by the pupil
 Which dilates and contracts accordingly
 The cornea and lens, whose shape is adjusted by the ciliary body, focus the
light on the retina, where receptors convert it into nerve signals that pass to
the brain.

18
Human Visual System
 Cones
 located primarily in the central portion of the retina
 6 – 7 million in each eye
 Photopic or bright-light vision
 Highly sensitive to color
 Rods
 75 – 150 million
 Not involved in color vision
 Sensitive to low level of illumination (scotopic or dim-light vision)
 An object appears brightly colored in daylight will be seen colorless in moonlight
(why)
 cone cells are nonfunctional in low visible light
19
Image formation in the eye
 The principal difference between the lens of the eye and an ordinary optical lens
 Former is flexible
 Shape of the lens is controlled by tension in the fibers of the ciliary body
 To focus on distant objects, the controlling muscles cause the lens to be relatively
flattened
 These muscles allow the lens to become thicker in order to focus on objects near the
eye
 Distance between centre of lens and retina (focal length) vary between 14-17 mm.
 15/100 = h/17

21
Features of human vision system
 Digital Images are displayed as a discrete set of intensities
 Eye’s ability to discriminate intensities is an important consideration when
displaying images
 HVS can adapt to light intensity range on the order of 1010
 Subjective brightness
 Intensity as perceived by the human visual
system
 A logarithmic function of the light
intensity incident on the eye

22
 Brightness adaptation
The HVS cannot operate on such range (10 orders of magnitude)
simultaneously
It accomplishes this through brightness adaptation
The total intensity level the HVS can discriminate simultaneously is
rather small in comparison (about 4 orders of magnitude)
For a given
observation
Sensitivity of the HVS
condition, the
for the given
adaptation level
current sensitivity
level is call the
Anything below Bb will brightness
be perceived as adaptation level
indistinguishable
blacks

23
 Brightness discrimination
The ability of the eye to discriminate between changes in light
intensity at any specific adaptation level

24
 Brightness discrimination
 Weber Ratio : The quantity ΔIc/I, ΔIc is the increment of illumination discriminable
50% of the time with background illumination I
Small weber ratio - a small percentage change in intensity is discriminable -
good brightness discrimination
 Large weber ratio – a large percentage change in intensity is required to
discriminate - poor brightness discrimination

25
Perceived brightness is not a simple function of intensity
 Mach band pattern
 Brightness scalloped near the boundaries
 Exaggerates the contrast between edges
of the slightly differing shades of gray, as soon as they contact one
another, by triggering edge-detection in the human
visual system

26
Perceived brightness is not a simple function of intensity
 Simultaneous contrast
Perceived brightness depends on the intensity of background as well

27
Optical illusion
 The eye fills in non-existing information or wrongly perceives geometrical
properties of objects
 Caused by the structure of both the eye and brain and how they work together
Optical illusion
Optical illusion
Optical illusion
Optical illusion
Light and the EM spectrum
Light and the EM spectrum
 Light : a particular type of electromagnetic radiation that
can be seen and sensed by the human eye
 Visible band of the electromagnetic spectrum : 0.43 μm
(violet) to about 0.79 μm (red)
 Colors that humans perceive in an object are determined
by the nature of the light reflected from the object
 A body that reflects light and is relatively balanced in all
visible wavelengths appears white to the observer
 A body that favors reflectance in a limited range of the
visible spectrum exhibits some shades of color
 Eg: Green objects reflect light with wavelengths
primarily in the 500 to 570 nm range while absorbing
most of the energy at other wavelengths
Light and the EM spectrum
 Monochromatic / achromatic light
 Light that is void of color
 Only attribute is its intensity
 Gray level : used to describe monochromatic intensity because it ranges from
black, to grays, and finally to white
 Chromatic light
 spans the electromagnetic energy spectrum from approximately 0.43 to 0.79 μm
 Three basic quantities used to describe the quality of a chromatic light source
Radiance
 Total amount of energy that flows from the light source, and it is usually
measured in watts (W)
Light and the EM spectrum
Luminance
Gives a measure of the amount of energy that can be observed from a light
source, measured in lumens (lm)
Measure of total quantity of visible light emitted by a source per unit of time
For example, light emitted from a source operating in the far infrared region of the
spectrum could have significant energy (radiance), but an observer would hardly
perceive it; its luminance would be almost zero

Brightness
Subjective descriptor of light perception that is practically impossible to
measure
Image sensing and acquisition
 If a sensor can be developed that is capable of detecting energy radiated
by a band of the electromagnetic spectrum, we can image events of
interest in that band
 The wavelength of an electromagnetic wave required to “see” an object
must be of the same size as or smaller than the object
 Eg: a water molecule has a diameter on the order of 10–10 m
So to study molecules, we would need a source capable of emitting in
the far ultraviolet or soft X-ray region
 Energy from electromagnetic wave is not the only method for image
generation
Ultrasound imaging
Image sensing and acquisition
 Images are generated by the combination of
 an “illumination” source
 the reflection or absorption of energy from that source by the elements of the “scene”
being imaged.
 Incoming energy is transformed into a voltage by the combination of input electrical
power and sensor material that is responsive to the particular type of energy being
detected
 The output voltage waveform is the response of the sensor(s)
 A digital quantity is obtained from each sensor by digitizing its response
 Three principal sensor arrangements used to transform illumination energy into digital
images
 Single Sensor
 Line Sensor
 Array Sensor
Image Acquisition Using Single Sensor
 Familiar sensor of this type
 Photodiode : Constructed of silicon materials and output voltage waveform is proportional to light.

 Filter in front of a sensor improves selectivity


 For example, a green (pass) filter in front of a light sensor favors light
in the green band of the color spectrum
 Sensor output will be stronger for green light than for other
components in the visible spectrum
 To generate a 2-D image using a single sensor, there has to be relative
displacements in both the x- and y-directions between the sensor and
the area to be imaged.
Image Acquisition Using Sensor Strips
 In-line arrangement of sensors in the form of a sensor strip

 Imaging elements in one direction.


 Motion perpendicular to the strip provides imaging in the other
direction
 used in most flat bed scanners
 Sensing devices with 4000 or more in-line sensors
 used in airborne imaging applications
 Imaging system is mounted on an aircraft that flies at a constant
altitude and speed over the geographical area to be imaged
 One-dimensional imaging sensor strips are mounted perpendicular
to the direction of flight
Image Acquisition Using Sensor Strips
 Sensor strips mounted in a ring configuration
 used in medical and industrial imaging to obtain cross-sectional
(“slice”) images of 3-D objects
 A rotating X-ray source provides illumination
 and the portion of the sensors opposite the source collect the X-
ray energy that pass through
the object
 Basis for medical and industrial computerized axial
tomography (CAT) imaging
 Output of the sensors must be processed by reconstruction
algorithms whose objective is to transform the sensed data into
meaningful cross-sectional images
Image Acquisition Using Sensor Arrays
 Individual sensors arranged in the form of a 2-D array
 Numerous electromagnetic and some ultrasonic sensing devices frequently are
arranged in an array format
 Predominant arrangement found in digital cameras
Image Acquisition Using Sensor Arrays
 Energy from an illumination source being reflected from a scene element
 The first function performed by the imaging is to collect the incoming energy and focus it
onto an image plane
 If the illumination is light, the front end of the imaging system is a lens, which projects the
viewed scene onto the lens focal plane
 The sensor array, which is coincident with the focal plane, produces outputs proportional to
the integral of the light received at each sensor
 Digital and analog circuitry sweep these outputs and convert them to a video signal, which is
then digitized by another section of the imaging system
Image Acquisition Using Sensor Arrays
 CCD (Charge coupled device) array
 In a CCD image sensor, pixels are represented by metal–oxide-
semiconductor (MOS) capacitors
 MOS capacitors are biased above the threshold allowing the conversion of
incoming photons into electron charges at the semiconductor-oxide interface
 the charge is transported across the chip and read at one corner of the array
 an analog-to-digital converter turns each photosite’s charge into a digital value.
Image Acquisition Using Sensor Arrays
 CMOS (metal–oxide–semiconductor (MOS) capacitors) sensor
 Has a photodiode and a CMOS transistor switch for each pixel, allowing the pixel signals
to be amplified individually
 By operating the matrix of switches, the pixel signals can be accessed directly and
sequentially, and at a much higher speed than a CCD sensor
 Fast, inexpensive, low power consumption
 More susceptible to Noise
Image formation model
 Image : 2-D function, f(x,y),
0 < f(x, y) < ∞
f(x, y) = i(x, y). r(x, y)
 f(x, y) may be characterized by two components:
 The amount of source illumination incident on the scene being viewed, illumination,
i (x, y)
 The amount of illumination reflected by the objects in the scene, reflectance , r (x, y)
0 < i(x, y) < ∞
0 < r(x, y) < 1
 Reflectance is bounded by 0 (total absorption) and 1 (total reflectance)
 The nature of I (x, y) is determined by the illumination source, and r (x, y) is
determined by the characteristics of the imaged objects
 Typical ranges of i (x, y) for visible light
 On a clear day, the sun may produce in excess of 90,000 lm/m2 of illumination on the
surface of the Earth
 Decreases to less than 10,000 lm/m2 on a cloudy day
 On a clear evening, a full moon yields about 0.1 lm/ m2 of illumination
 Typical illumination level in a commercial office is about 1000 lm/ m2.

 typical values of r(x, y):


 0.01 for black velvet
 0.65 for stainless steel
 0.80 for flat-white wall paint
 0.90 for silver-plated metal
 0.93 for snow
Gray level, Gray scale
 Intensity of a monochrome image at any coordinates (x0, y0)
 gray level (l) of the image at that point, l= f(x0, y0)

𝐿𝑚𝑖𝑛 ≤ 𝑙 ≥ 𝐿𝑚𝑎𝑥
 Lmin= imin rmin and Lmax= imax rmax
 The interval [𝐿𝑚𝑖𝑛 , 𝐿𝑚𝑎𝑥 ] is called the gray scale. Common practice is to shift
 this interval numerically to the interval [0, L-1], where l = 0 is considered black and l = L-
1 is considered white on the gray scale
 All intermediate values are shades of gray varying from black to white.
Image sampling and quantization
 Need to generate digital images from sensed data
 The output of most sensors is a continuous voltage waveform whose
amplitude and spatial behavior are related to the physical phenomenon being
sensed
 To create a digital image, we need to convert the continuous sensed data into
digital form
 Involves two processes
Sampling
 Digitizing the coordinate values

Quantization
 Digitizing the amplitude
Result of sampling and quantization
Representation of digital images

 An image f(x, y) is sampled


Resulting digital image has M rows and N columns
Values of the coordinates (x, y) now become discrete quantities
Use integer values for these discrete coordinates, for notational clarity
and convenience
Values of the coordinates at the origin are (x, y)=(0, 0).
 The next coordinate values along the first row of the image, (x, y)=(0, 1)
 The notation (0, 1) is used to signify the second sample along the first row
 not the actual values of physical coordinates when the image was sampled
 M : Number of samples along x direction and N : Number of samples along y direction
 L : Discrete gray levels allowed for each pixel
 M and N should be positive integers
 Due to processing, storage, and sampling hardware considerations, the number of gray
levels typically is an integer power of 2
𝐿 = 2𝑘
 Typically, discrete levels are equally spaced and that they are integers in the interval [0,
L-1]
 Dynamic range : Range of values spanned by the gray scale
 High dynamic range : High contrast when represented with an appreciable number of
pixels
 Low dynamic range : images have a dull, washed out gray look.
 The number, b, of bits required to store a digitized image is
𝑏 =𝑀 ×𝑁×𝑘
 When M=N, this equation becomes
𝑏 = 𝑁2 × 𝑘
 When an image can have 2k gray levels, it is common practice to refer to the image as a
“k-bit image.”
 For example, an image with 256 possible gray-level values is called an 8-bit image
Spatial Resolution and Gray – level resolution
 Spatial resolution
 the smallest discernible detail in an image
 Sampling is the principal factor determining the spatial resolution of an image
 Gray-level resolution
 refers to the smallest discernible change in gray level
 Measuring discernible changes in gray level is a highly subjective process
62 Basic Relationships Between Pixels

 Neighborhood

 Adjacency

 Connectivity

 Paths

 Regions and boundaries


Basic Relationships Between Pixels
63  Neighbors of a pixel p at coordinates (x,y)
➢ 4-neighbors of p, denoted by N4(p):
(x-1, y), (x+1, y), (x,y-1), and (x, y+1).
 Each pixel is at unit distance from (x, y)
 Some of the neighbors of p lie outside the digital image if (x, y) is
on the border of the image.
64 ➢ 4 diagonal neighbors of p, denoted by ND(p):
(x-1, y-1), (x+1, y+1), (x+1,y-1), and (x-1, y+1).
65 ➢ 8 neighbors of p, denoted N8(p)
N8(p) = N4(p) U ND(p)
Basic Relationships Between Pixels
66
 Adjacency
Let V be the set of intensity values used to define adjacency

➢ 4-adjacency: Two pixels p and q with values from V are 4-adjacent if q is in


the set N4(p).

➢ 8-adjacency: Two pixels p and q with values from V are 8-adjacent if q is in


the set N8(p).
Basic Relationships Between Pixels
67

➢ m-adjacency (Mixed adjacency): Two pixels p and q with


values from V are m-adjacent if

(i) q is in the set N4(p), or

(ii) q is in the set ND(p) and the set N4(p) ∩ N4(q) has no pixels
whose values are from V.
68 Examples: Adjacency V = {1}

An arrangement of pixels 8 -Adjacency m-Adjacency


69 Examples: Adjacency V = {1, 2}

1 1 0 1 1 0 1 1 0
0 2 0 0 2 0 0 2 0
1 0 0 1 0 0 1 0 0

8-adjacent m-adjacent
Basic Relationships Between Pixels
70
 Path
➢ A (digital) path (or curve) from pixel p with coordinates (x0, y0) to pixel q
with coordinates (xn, yn) is a sequence of distinct pixels with coordinates

(x0, y0), (x1, y1), …, (xn, yn)

Where (xi, yi) and (xi-1, yi-1) are adjacent for 1 ≤ i ≤ n.

➢ Here n is the length of the path.

➢ If (x0, y0) = (xn, yn), the path is closed path.

➢ We can define 4-, 8-, and m-paths based on the type of adjacency used.
71
Examples: Adjacency and Path V = {1, 2}

0 1 1
1,1 1,2 1,3 0 1 1 0 1 1
0 2 0
2,1 2,2 2,3 0 2 0 0 2 0
0 0 1
3,1 3,2 3,3 0 0 1 0 0 1
8-adjacent m-adjacent

The 8-path from (1,3) to (3,3): The m-path from (1,3) to (3,3):
(i) (1,3), (1,2), (2,2), (3,3) (1,3), (1,2), (2,2), (3,3)
(ii) (1,3), (2,2), (3,3)

Is there a 4-path from (1,3) to (3,3)??


Basic Relationships Between Pixels
72  Connected in S
Let S represent a subset of pixels in an image.
 Two pixels p with coordinates (x0, y0) and q with coordinates (xn, yn) are said to be
connected in S if there exists a path between them consisting entirely of pixels in
S.
 For every pixel p in S, the set of pixels in S that are connected to p is called a
connected component of S.
 If S has only one connected component, then S is called Connected Set.
Let R represent a subset of pixels in an image
 We call R a region of the image if R is a connected set
 Two regions, Ri and Rj are said to be adjacent if their union forms a connected set.
 Regions that are not to be adjacent are said to be disjoint.
Question
73
 In the following arrangement of pixels, are the two regions (of
1s) adjacent? (if 8-adjacency is used) v={1}

1 1 1
Region 1
1 0 1
0 1 0
Region 2
0 0 1
1 1 1
1 1 1

 What if 4-adjacency is used?


Basic Relationships Between Pixels
74
 Boundary (or border)
➢ The boundary of the region R is the set of pixels in the region that have one or
more neighbors that are not in R.
➢ If R happens to be an entire image, then its boundary is defined as the set of
pixels in the first and last rows and columns of the image.

 Foreground and background

➢ An image contains K disjoint regions, Rk, k = 1, 2, …, K. Let Ru denote the


union of all the K regions, and let (Ru)c denote its complement.
All the points in Ru is called foreground;
All the points in (Ru)c is called background.
75  In the following arrangement of pixels, the two regions
(of 1s) are disjoint (if 4-adjacency is used)

1 1 1 foreground
1 0 1
0 1 0
background
0 0 1
1 1 1
1 1 1
76 Question

 In the following arrangement of pixels, the circled point is


part of the boundary of the 1-valued pixels if 8-adjacency is
used, true or false?

0 0 0 0 0
0 1 1 0 0
0 1 1 0 0
0 1 1 1 0
0 1 1 1 0
0 0 0 0 0
77 Distance Measures
 Given pixels p, q and s with coordinates (x, y), (u, v), (w, z)
respectively, the distance function D has following
properties:

a. D(p, q) ≥ 0 [D(p, q) = 0, if p = q]

b. D(p, q) = D(q, p)

c. D(p, s) ≤ D(p, q) + D(q, s)


Distance Measures
78

The following are the different Distance measures:

a. Euclidean Distance :
De(p, q) = [(x-u)2 + (y-v)2]1/2

b. City Block Distance:


D4(p, q) = |x-u| + |y-v|

c. Chess Board Distance:


D8(p, q) = max(|x-u|, |y-v|)
79 Question
 In the following arrangement of pixels, what’s the value of
the chessboard distance between the circled two points?

0 0 0 0 0
0 0 1 1 0
0 1 1 0 0
0 1 0 0 0
0 0 0 0 0
0 0 0 0 0
80 Question
 In the following arrangement of pixels, what’s the value of
the city-block distance between the circled two points?

0 0 0 0 0
0 0 1 1 0
0 1 1 0 0
0 1 0 0 0
0 0 0 0 0
0 0 0 0 0
Introduction to Mathematical Operations in DIP
81

 Array vs. Matrix Operation

 a11 a12   b11 b12 


A=  B=
 a21 a22  
Array
product  21 22 
b b
operator
 a11b11 a12b12  Array product
A .* B =  
Matrix
 21 21 22 22 
a b a b
product
operator
 a11b11 + a12b21 a11b12 + a12b22  Matrix product
A*B= 
+ a b a b +
 21 11 22 21 21 12 22 22 
a b a b
Arithmetic Operations
82
 Arithmetic operations between images are array operations. The four
arithmetic operations are denoted as

s(x,y) = f(x,y) + g(x,y)


d(x,y) = f(x,y) – g(x,y)
p(x,y) = f(x,y) × g(x,y)
v(x,y) = f(x,y) ÷ g(x,y)
 Logical Operations:
 Union
 Intersection
 Complement
83
84
85 An Example of Image Multiplication

Weeks 1 & 2
Logical Operations
86
Hue • Hue represents the dominant
colour as perceived by an observer.
• Usually measured in degrees. It
could be represented using a colour
wheel.

• Can be represented quantitatively


by a single number, often
corresponding to an angular
position around a central or neutral
point
Saturation
 Saturation refers to the purity or intensity of
colour.
 Amount of white light mixed with a hue
 Primary colours red, blue and green are fully
saturated.
 Colours like pink (red + white), lavender (Violet
+ white) are less saturated
 As the saturation decreases, the colours appear to
be more washed-out or pale
Brightness
• Achromatic notion of intensity

• Brightness refers to the overall


lightness or darkness of the image

• Increasing the brightness every pixel


in the frame gets lighter

• Decreasing saturation turns the


colours into shades of grey,
increasing brightness turns the hue
lighter but without making it grey
Contrast

Contrast is the difference in


luminance or colour that
makes an object (or its
representation in an image or
display) distinguishable
• Increasing the contrast
makes light areas lighter
and dark area in the frame
becomes much darker
Machband effect
• Effect where the human brain
subconsciously increases the
contrast between 2 surfaces with
different luminance
• Actually intensity is uniform over
the width of the bar.
• But visual perception is that each
strip is darker at its left side than
its right.
• The spatial interaction of
luminance from the object & its
surroundings creates the machband
effect
Need for Colour image processing

• We can easily extract objects of


interest from a colour image
• Human eye can distinguish
between thousands of colour shades
than 2 dozens of grey shades
(intensity distributions).
Applications of colour image processing

Radiation test pattern 8 color regions


* See the gradual gray-level changes
Applications of colour image processing

Rainfall statistics
Primary and secondary colors
 In 1931, CIE (International Commission on Illumination) defines
specific wavelength values to the primary colors
 Secondary colors: G+B=Cyan, R+G=Yellow, R+B=Magenta
CIE chromaticity diagram
 Specifying colours systematically can be
achieved using the CIE chromacity diagram
 On this diagram the x-axis represents the
proportion of red and the y-axis represents
the proportion of green used
 The amounts of red, green, and blue needed
to form any particular color are called the
tristimulus values, denoted by X, Y, and Z.
 The proportion of blue used in a colour is
calculated as:
 z = 1 – (x + y)

Green: 62% green, 25% red and 13% blue


Red: 32% green, 67% red and 1% blue
 Any colour located on the boundary
of the chromacity chart is fully
saturated
 The point of equal energy has equal
amounts of each colour and is the
CIE standard for pure white
 Any straight line joining two points
in the diagram defines all of the
different colours that can be obtained
by combining these two colours
additively
 This can be easily extended to three
points
Colour Models
 Specifications of colours in some standard
 Specification of a coordinate system and a subspace within that system
where each colour is represented by a single point
 RGB Model : Hardware-oriented model – colour monitors and colour
video camera
 CMY and CMYK model : colour printing
 HSI model: corresponds closely with the way humans describe and
interpret colour
RGB Model
 Additive model
 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
 Pixel depth: the number of bits used to represent each pixel in RGB
space
 Full-color image: 24-bit RGB color image
 (R, G, B) = (8 bits, 8 bits, 8 bits)
 A 24-bit image is often referred to as a full-colour image as it allows
16,777,216 colours
 Subset of colors is enough for some application
 Safe RGB colors (safe Web colors, safe browser colors)
RGB Example

Original Red Band Green Band Blue Band

102
CMY / CMYK

➢C,M,Y are the primary


colours of pigment or
secondary colours of light
➢Subtractive colour model
C+M+Y=BLACK

 C  1  R 
 M  = 1 − G 
    
 Y  1  B 

➢ Passive displays, such as color inkjet printers, absorb light instead


of emitting it. Combinations of cyan, magenta and yellow inks are
used.
HSI color model
 Will you describe a color using its R, G, B components?

 Human describe a color by its hue, saturation, and brightness


 Hue: A colour attribute that describes a pure colour (pure yellow, orange or
red)
 Saturation: Gives a measure of how much a pure colour 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

 RGB is great for colour generation, but HSI is great for colour description
HSI, Intensity & RGB
 Remember the diagonal on the RGB
colour cube that we saw previously ran
from black to white
 Now consider if we stand this cube on
the black vertex and position the white
vertex directly above it
 Now the intensity component of any
colour can be determined by passing a
plane perpendicular to
the intensity axis and containing the
colour point
 The intersection of the plane with the
intensity axis gives us the intensity
component of the colour
The HSI Colour Model
 Consider if we look straight down at the RGB cube as it 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 hue is determined by an angle from a reference point,
usually red
 The saturation is the length of the vector 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 the length of
the saturation vector this plane is also often represented as a
circle or a triangle
HSI Model Examples
HSI Model Examples
Converting colors from RGB to HSI
Converting from HSI to RGB

You might also like