Module1 Full
Module1 Full
S5 Minor
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
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
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
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.
𝐿𝑚𝑖𝑛 ≤ 𝑙 ≥ 𝐿𝑚𝑎𝑥
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
Neighborhood
Adjacency
Connectivity
Paths
(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}
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
➢ 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)
1 1 1
Region 1
1 0 1
0 1 0
Region 2
0 0 1
1 1 1
1 1 1
1 1 1 foreground
1 0 1
0 1 0
background
0 0 1
1 1 1
1 1 1
76 Question
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)
a. Euclidean Distance :
De(p, q) = [(x-u)2 + (y-v)2]1/2
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
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.
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)
102
CMY / CMYK
C 1 R
M = 1 − G
Y 1 B
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