Sampling and Quantization
1 7/12/2018
Intensity Plot along scan line
Scan line AB
A B
2 7/12/2018
Sampling and Quantization
Sampling: Digitizing Coordinate Values
Quantization: Digitizing Amplitude values
3 7/12/2018
Sampling of 1D signal
4 7/12/2018
Sampling: with increasing sampling time
T
Sampled waveform Sampled waveform
0 0
1 201 1 201
Sampled waveform Sampled waveform
0 0
1 201 1 201
5 7/12/2018
Image Sampling and Quantization
Digitizing the
coordinate values Digitizing the
amplitude values
6 7/12/2018
Image Sampling and Quantization
7 7/12/2018
Digital image Representation
The representation of an M×N numerical array as
f (0, 0) f (0,1) ... f (0, N 1)
f (1, 0) f (1,1) ... f (1, N 1)
f ( x, y )
... ... ... ...
f ( M 1, 0) f ( M 1,1) ... f ( M 1, N 1)
a0,0 a0,1 ... a0, N 1
a a1,1 ... a1, N 1
A 1,0
... ... ... ...
8 aM 1,0 aM 1,1 ... aM 1, N 1 7/12/2018
Digital image Representation
9 7/12/2018
Spatial and Intensity Resolution
Spatial resolution
— A measure of the smallest discernible (visible) detail in an
image
— stated with line pairs per unit distance, dots (pixels) per unit
distance, dots per inch (dpi)
Eg: newspapers are printed with resolution with 75 dpi
magazines at 133 dpi
glossy brochures at 175 dpi
book page printed at 2400 dpi
Intensity resolution
— The smallest discernible change in intensity level
— stated with 8 bits, 16 bits, 24 bits, etc.
10 7/12/2018
Spatial Resolution: Downsampling
Effects of varying number of samples in a digital image
1024X1024 down-sampled to 32X32 by factor of 2
There size differences make it difficult to see the effects resulting
from
11 a reduction in the number of samples. 7/12/2018
Interpolation Method: Point sampling
Interpolation: Process of using known data estimate
the values of unknown locations.
12 7/12/2018
13 7/12/2018
Interpolation Method: Local Averaging
14 7/12/2018
15 7/12/2018
Spatial Resolution: Resampling
By Row and column duplication
1 2 3
(1) 1024x1024
(2) 512x512
(3) 256x256
(4) 128x128
(5) 64x64
(6) 32x32
4 5 6
16 7/12/2018
Resampling by pixel replication
17 7/12/2018
18 7/12/2018
Resampling by Bilinear Interpolation
(3+4+5+6+8+9+10+11)/
8
3 5 3 4 5
9 11 6 7 8 (5+11)/2
9 10 11
19 7/12/2018
Spatial Resolution
Effect of reducing Spatial Resolution
20 image at 1250 dpi image at 300 dpi 7/12/2018
Spatial Resolution
Effect of reducing Spatial Resolution
21 image at 150 dpi image at 72 dpi 7/12/2018
Gray level/Intensity/Brightness Resolution
• The smallest discernible change in intensity level
• Stated with 8 bits, 12 bits, 16 bits, etc.
• It indicates number of gray levels used to represent a pixel of an
image.
• Max. gray level resolution is 256.
1 2
(1) Gray level = 16
(2) Gray level = 8
(3) Gray level = 4
(4) Gray level = 2
3 4
22 7/12/2018
Example: Gray Level Resolution
False Contouring can be caused by the use of insufficient no of gray
levels in smooth areas of digital image 7/12/2018
23
Basic Relationships Between Pixels
Neighborhood
Adjacency
Connectivity
Paths
Distance Measure
Regions and boundaries
24 7/12/2018
Basic Relationships Between Pixels
( x 1, y 1) ( x 1, y) ( x 1, y 1)
( x, y 1) p ( x, y) ( x, y 1)
( x 1, y 1) ( x 1, y) ( x 1, y 1)
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).
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).
8 neighbors of p, denoted N8(p)
N8(p) = N4(p) U ND(p)
25 7/12/2018
Connectivity/ Adjacency
The two pixels are connected/adjacent if
They are neighbors
Their gray levels satisfy specified criteria of similarity
For example, in a binary image two pixels are
connected if they are 4-neighbors and have same
value (0/1).
0 1 1 0
1 1 0 1
(p)
0 0 1 1
26 7/12/2018
Types of Adjacency
Let V be the set of gray-level values used to define
adjacency,
4-adjacency: Two pixels p and q with values from
V are 4-adjacency if q is in the set N4(p)
Let set of colors consist of color 1 i.e. v={1}
0 1 1 0
q=(1,1)
1 1 0 1 N4(p)={(1,1))
(p) (q) Since q is in set N4(p) p and q are adjacent
0 0 1 1
27 7/12/2018
Types of Adjacency
Let set of colors consist of color 1 i.e v={1}
0 1 1 0
(q) q=(0,2)
N4(p)={(0,1), (1,0)
1 1 0 1 Since q is in not in set N4(p) p and q are not
(p) adjacent
0 0 1 1
0 1 1 0
1 1 0 1
0 0 1 1
28 7/12/2018
Types of Adjacency
Let V : The set of gray-level values used to
define adjacency
8-adjacency: Two pixels p and q with values
from V are 8-adjacency if q is in the set N8(p)
Let set of colors consist of color 1 i.e v={1}
0 1 1 0 q=(0,1)
(q) N8(p)={(0,1),(1,1))
1 1 0 1 Since q is in set N8(p) p and q are adjacent
(p)
0 0 1 1
29 7/12/2018
Types of Adjacency
Let set of colors consist of color 1 i.e v={1}
0 1 1 0
1 1 0 1
0 0 1 1
30 7/12/2018
Types of Adjacency
m-adjacency (mixed adjacency):
a modification of 8-adjacency.
To eliminate the ambiguities that often arise when 8-
adjacency is used
Two pixels p and q with values from V are m-adjacency if
q is in N4(p) , or
q is in ND(p) and the set N 4 ( p) N 4 (q) is empty
31 7/12/2018
Types of Adjacency
m-adjacency (mixed adjacency): Two pixels p and q with
values from V are m-adjacency if
q is in N4(p) , or
q is in ND(p) and the set N 4 ( p) N 4 (q) is empty
Pixels that are 8- adjacent. m- adjacency
Arrangement of pixel
(Note the ambiguity)
32 7/12/2018
Path
0 1 1 0
1 1 0 1
(p) (q)
0 0 1 1
A path from pixel P with coordinates (x,y) to pixel Q with coordinates
(s,t) is a sequence of distinct pixels with coordinates.
(x0,y0), (x1,y1)…….(xn,yn)
Where (x0,y0)=(x,y) and (xn,yn)=(s,t) (xi,yi) and (xi-1,yi-1) are adjacent for
1<=i<=n
33 7/12/2018
Distance measures
Given pixels p, q and z with coordinates (x, y), (s, t), (u, v)
respectively, the distance function D has following
properties:
D(p, q) >=0 [D(p, q) = 0, iff p = q]
D(p, q) = D(q, p)
D(p, z)<= D(p, q) + D(q, z)
34 7/12/2018
Distance measures
Common Distance Measures:
1. Euclidean:
De(p,q)2 = (x-s)2 + (y-t)2
2. City Block: (4-connected)
D4(p,q) = |x-s| + |y-t|
3. Chess Board: (8-connected)
D8(p,q) = max {|x-s|, |y-t|}
Distance between two pixels p, q is the length of the shortest
path (4-connected or 8-connected) between these two
pixels
35 7/12/2018
Example
For pixels p and q shown in figure with co-ordinates (0,0) and (4,3)
and V={2 ,3, 4}. find D4 (city block distance) and D8 (chessboard
distance)?
2 4 5 3 4
5 3 2 4 5
7 6 2 1 5
6 5 3 4 0
4 5 7 2 6
36 7/12/2018
Example
For pixels p and q shown in figure with co-ordinates (0,0) and (4,3) and V={2 ,3,
4}. find D4 (city block distance), D8 (chessboard distance)?
2(p) 4 5 3 4 Ans: p(x1, y1)= p(0,0)
5 3 2 4 5 q(x2 , y2)= q(4,3)
7 6 2 1 5
a) D4(p,q)=|x1-x2|+|y1-y2|
6 5 3 4 0
=|0-4|+|0-3|
4 5 7 2(q) 6 =7
37 7/12/2018
Example
For pixels p and q shown in figure with co-ordinates (0,0) and (4,3)
and V={2 ,3, 4}. find D4 (city block distance), D8 (chessboard
distance)?
2(p) 4 5 3 4 Ans: p(x1, y1)= p(0,0)
1. 5 3 2 4 5 q(x2 , y2)= q(4,3)
7 6 2 1 5
b) D8(p,q)=max(|x1-x2|,|y1-y2|)
6 5 3 4 0
=max(4, 3)
4 5 7 2(q) 6 =4
38 7/12/2018