Digital Image Processing
Dr. Faraz Akram
The University of Faisalabad
Prerequisites:
- Signals and Systems
- Digital Signal Processing
- Computer Programming (MATLAB or C++)
Textbook:
- Digital Image Processing, third edition,
by R. Gonzalez and R. Woods,
Introduction
One picture is worth more than ten
thousand words
Anonymous
Contents
This lecture will cover:
What is a digital image?
What is digital image processing?
State of the art examples of digital image
processing
What is a Digital Image?
a two-dimensional function, f(x, y), where x and y are spatial
coordinates, and the amplitude of f at any pair of
coordinates (x, y) is called the intensity (gray level of the
image) at that point. When x, y, and the amplitude values of f
are all finite, discrete quantities, we call the image a digital
image.
(Gonzalez and Woods)
What is a Digital Image?
DIGITALIMAGES are electronic
snapshots taken of a scene or scanned
from documents, such as photographs,
manuscripts, printed texts, and artwork.
The digital image is sampled and
mapped as a grid of dots or picture
elements (pixels). Each pixel is assigned
a tonal value (black, white, shades of
gray or color)
What is a Digital Image?
A digitalimage is a representation of a twodimensional image as a finite set of digital
values, called picture elements or pixels.
What is pixel?
Pixel is the smallest element of an image. Each pixel
correspond to any one value.
The value of a pixel at any point correspond to the light
intensity at that particular location.
What is megapixel of your camera?
And what does that mean?
10
What is a Digital Image? (cont)
Pixel values typically represent gray levels,
colors, heights, opacities etc.
Remember digitization implies that a digital image
is an approximation of a real scene
1 pixel
11
What is a Digital Image? (cont)
Common image formats include:
1 sample per point (B&W or Grayscale)
3 samples per point (Red, Green, and Blue)
4 samples per point (Red, Green, Blue, and Alpha,
a.k.a. Opacity)
For most of this course we will focus on grey-scale
12
Gray level?
The value of the pixel at any point denotes
the intensity of image at that location, and
that is also known as gray level.
13
What is Digital Image Processing?
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
14
Why we need Digital Image
Processing?
15
Examples: Artistic Effects
Artistic effects are
used to make
images more
visually appealing,
to add special
effects and to make
composite images
16
Examples: Image Enhancement
One of the most common uses of DIP
techniques: improve quality, remove noise
etc
17
Examples: PCB Inspection
Printed Circuit Board (PCB) inspection
Machine inspection is used to determine that
all components are present and that all solder
joints are acceptable
Both conventional imaging and x-ray imaging
are used
18
Examples: Industrial Inspection
Human operators are
expensive, slow and
unreliable.
Make machines do the
job instead.
Industrial vision systems
are used in all kinds of
industries.
Can we trust them?
19
Examples: Medical Imaging
20
Examples: Law Enforcement
Image processing
techniques are used
extensively by law
enforcers
Number plate
recognition for speed
cameras/automated
toll systems
Fingerprint recognition
Enhancement of
CCTV images
21
Examples: Hurdle detection
Hurdle detection is one of the common task
that has been done through image
processing, by identifying different type of
objects in the image and then calculating
the distance between robot and hurdles.
22
Examples: The Hubble Telescope
Launched in 1990 the Hubble
telescope can take images of
very distant objects
However, an incorrect mirror
made many of Hubbles
images useless
Image processing
techniques were
used to fix this
23
Examples: GIS
Geographic Information Systems
Digital image processing techniques are used
extensively to manipulate satellite imagery
Terrain classification
Meteorology
25
Examples: HCI
Try to make human
computer interfaces more
natural
Face recognition
Gesture recognition
What we learned today?
26
Digital images
Basic terms of digital imaging
Pixel
Grayscale
Digital Image processing
Applications of Digital Image Processing
Digital Image Processing
Lecture-2
Dr. Faraz Akram
The University of Faisalabad
Concept of Dimensions
28
Dimensions define the minimum number of points required to point
a position of any particular object within a space.
1 dimension signal: The common example of a 1D signal is a
waveform [F(x)].
2 dimension signal: The common example of a two dimensional
signal is an image [F(x, y)].
1DSignal
2DImage
29
Bits Per Pixel and shades
How many numbers can be represented by one bit?
Shades:
The famous gray scale image is of 8 bpp, means it has =256
different colors in it or 256 shades (0 - 255).
30
Black color: Remember , 0 pixel value always
denotes black color. But there is no fixed value
that denotes white color.
White color: The value that denotes white color
can be calculated as:
White in Binary?
White in 8 bit?
31
Varying # of bits per pixel
Image Size
32
The size of an image depends upon three things.
Number of rows
Number of columns
Number of bits per pixel
Grayscaleimage,having256differentshades
ofgray
NoofRows=1024
NoofColumns=1024
WhatistheimagesizeinMb?
33
Sampling and Quantization
The basic idea behind converting an analog signal to
its digital signal is to convert both of its axis (x, y)
into a digital format.
Sampling: Digitizing coordinate values
Quantization: Digitizing Amplitude values
34
Sampling and Quantization
Sampling:related to coordinates values
(Nyquist frequency)
Quantization:related to intensity values
0
75
75
75 128 128 128 128
75
75
75 128 128 128 255 255 255
75
75
75 200 200 200 255 255 255 200
128 128 128 200 200 255 255 200 200 200
128 128 128 255 255 200 200 200 75
175 175 175 225 225 225 75
75
75
75 100
175 175 100 100 100 225 225 75
75 100
75
75
75
35
35
35
35
35
35
35
35
35
35
75
75
75
75 100 100 100 200 200 200 200
35
Sampling and Quantization
a
(a) Continuous image
projected onto a sensor
array. (b) Result of image
sampling
and
quantization.
36
1024
512
256
128
64
32
37
Aliasing and moir patterns
Aliasing occurs when a signal is sampled at a less
than twice the highest frequency present in the
signal.
moirpattern
Properlysampledimage
Spatialaliasinginthe
formofamoirpattern
38
Relationship between Pixels
Neighbors of a pixel:
A pixel at coordinates (x, y) has 4 horizontal and
vertical neighbors whose coordinates are?
A1
A2
A3
A4
A5
A6
A7
A8
A9
This set of pixels are called the 4-neighbors of P, and
is denoted by .
39
Relationship between Pixels
The four diagonal neighbors of are given by,
A1
A2
A3
A4
A5
A6
A7
A8
A9
This set is denoted by .
40
Relationship between Pixels
The points and are together known as 8-neighbors
of the point , denoted by
Note: Some of the points in the , and may fall
outside image when lies on the border of image.
41
Neighbors of a Pixel
4-neighbors of a pixel are its
vertical and horizontal
neighbors denoted by
8-neighbors of a pixel are its
vertical, horizontal and 4
diagonal neighbors denoted
by
42
Adjacency
Two pixels are connected if they are neighbors
and their gray levels satisfy some specified
criterion of similarity.
For example, in a binary image two pixels are
connected if they are 4-neighbors and have
same value (0/1).
Types of Adjacency
43
Let V be set of gray levels values used to define
adjacency.
4-adjacency: Two pixels p and q with values from V are 4adjacent if q is in the set .
8-adjacency: Two pixels p and q with values from V are 8adjacent if q is in the set .
m-adjacency: Two pixels p and q with values from V are
m-adjacent if,
q is in
q is in and the set [ ] is empty
(has no pixels whose values are from V).
Types of Adjacency
44
Mixed adjacency is a modification of 8adjacency. It is introduced to eliminate the
ambiguities that often arise when 8-adjacency
is used.
For example:
45
Types of Adjacency
In this example, we can note that to connect between
two pixels (finding a path between two pixels):
In 8-adjacency way, you can find multiple paths
between two pixels
While, in m-adjacency, you can find only one path
between two pixels
So, m-adjacency has eliminated the multiple path
connection that has been generated by the 8adjacency.
Distance Measures
46
The Euclidean distance between two 2-D points ,
is defined by
City Block Distance ()
Chessboard distance ()
47
Distance Measures
Given pixels p, q and z with coordinates
(x, y), (s, t), (u, v) respectively,
the distance function D has following properties:
a.
[]
b.
c.