Professional Documents
Culture Documents
Digital Image Processing: Relationships of Pixel II
Digital Image Processing: Relationships of Pixel II
Relationships of Pixel II
1
Image description
12/15/21 2
Sampling and Quantization
quantization
sampling sampling
3
Sampling and Quantization
Sampling: Digitization of the spatial coordinates (x,y)
Quantization: Digitization in amplitude (also called gray-
level quantization)
8 bit quantization: 28 = 256 gray levels (0: black, 255: white)
Binary (1 bit quantization): 2 gray levels (0: black, 1: white)
4
Sampling and Quantization
. . . . . .
. . . . . .
. . . . . .
f ( M 1,0) f ( M 1,1) . . . f ( M 1, N 1)
N : No of Columns
M : No of Rows
5
Sampling and Quantization
Image coordinate convention (not valid for MATLAB!)
6
Sampling and Quantization
MATLAB Representation
7
Digital Images
8
Sampling
9
Sampling
10
Effect of Sampling and Quantization
12
Effect of Sampling and Quantization
13
Effect of Sampling and Quantization
14
Effect of Sampling and Quantization
15
RGB (color) Images
16
Pixel Neighborhood
• The pixels surrounding a given pixel. Most neighborhoods used in image
processing algorithms are small square arrays with an odd number of pixels.
17
Basic relationships between pixels
Arrangement of pixels: 0 1 1
0 1 0
0 0 1
4 neighbours N4(p): 1
0 1 0
0
19
Basic relationships between Pixels
4-connectivity:
If gray-level p , q V, and q N4(p)
8-connectivity:
If gray-level p , q V, and q N8(p)
20
Basic relationships between pixels
Mixed Connectivity:
Note: Mixed connectivity can eliminate the multiple path
connections that often occurs in 8-connectivity
21
Basic relationships between pixels
Path
Let coordinates of pixel p: (x, y), and of pixel q: (s, t)
A path from p to q is a sequence of distinct pixels with
coordinates: (x0, y0), (x1, y1), ......, (xn, yn) where
(x0, y0) = (x, y) & (xn, yn) = (s, t),
and (xi, yi) is adjacent to (xi-1, yi-1) 1 i n
Regions
A set of pixels in an image where all component pixels are
connected
Boundary of a region
A set of pixels of a region R that have one of more neighbors
that are not in R
22
Distance Measures
Given coordinates of pixels p and q: (x,y) and (s,t)
Euclidean distance between p and q:
De ( p, q ) ( x s) 2 ( y t ) 2
– De distance r from (x,y) define a disk of radius r centered at (x,y)
City-block distance between p and q:
D4 ( p, q) x s y t
– The pixels with D4 distance r from (x,y) form a diamond centered at (x,y)
– the pixels with D4=1 are the 4-neighbors of (x,y)
Chessboard distance between p and q:
D8 ( p, q ) max(| x s |, | y t |)
– The pixels with D8 distance r from (x,y) form a square centered at (x,y)
– The pixels with D8=1 are the 8-neighbors of (x,y)
23
Distance Measures
24
Distance Measures
25
Distance Measures
26
Distance Measures
27
Distance Measures
28
Euclidean distance
29
Distance Measures
30
City Block Distance
31
City Block Distance
32
Chess Board Distance
33
Shape Matching
If we want to find the
difference in shapes .
These 2 shapes are almost
similar except that there is
a hole in the second
shape.
34
Shape Matching
To find the feature of
shapes
We need to take the
skeleton of the shapes
which are shown in the
figures below the shapes
35
The skeleton information
36
Skeleton
What is skeleton?
When we remove some
of the foreground points Now, the question is
in such a way that the
how do we get this
shape information as
skeleton?
well as the dimension is
more or less retained in
the skeleton
37
How to get the Skeleton
assume that the foreground region in the
input binary image is made of some uniform
slow burning material
What if we light fire at all the points across
the boundary of this region that is the
foreground region.
Then as the fire lines go in, there will be
some points in the foreground region where
the fire coming from 2 different boundaries
will meet and at that point, the fire will
extinguish itself.
The set of all those points is what is called
the quench line and the skeleton of the region
is nothing but the quench line that we
obtained by using this fire propagation
concept.
The set of all those points are called the
quench line
The skeleton of the region is “the quench line
obtained by using fire propagation concept”
This is also called “Medial Axis
Transformation”
38
39
Simple description of So, for that we use distance
movement of the fire line measure.
does not give you an idea of When we a lighting the fire
how to compute the across all the boundary
skeleton of a particular points simultaneously and
shape. the fire is moving inside the
foreground region slowly,
We can note at every point
the time the fire takes to
reach the particular point so
it is a distance
transformation of the image.
40
Distance transform is Where the grey level
normally used for binary intensity of the points in
images and we calculate the inside the foreground
the time value for every region had changed to
point the the fire takes to show the distance of that
reach that particular point; point from the closest
so by applying distance boundary point.
transformation, we get an
image or the shape of the
image is in a grey level
image
41
Distance transform
Here, we have a binary
image where the foreground
region is a rectangular
region and if I take the
distance transform,
Image in the right all the
boundary points, they are
getting a distance value
equal to 1.
Then the points inside the
boundary points, they get a The intensity value that we are assigning to
distance value equal to 2 different points within the foreground region,
and the points further the intensity value increases slowly from the
inside, they gets a distance
value equal to 3. boundary to the interior points.
45
Use of skeleton
We can have the length of a shape because by getting the
different end points of the skeleton and the distances
between every pair of end points in the skeleton, then the
maximum of all those pair wise distances will give the
length of the shape
The skeleton gives us the ability of
qualitatively/quantitatively difference between different
shapes
46
Arithmetic and logical operations
48
AND, XOR
Similarly, 2 images - A
and B,
A and B, the logical AND
operation which is shown
in the left image lower.
Similarly, the XOR
operation the image in the
right image lower.
49
Pixel Neighborhood operations
52
Summery of the lecture
Different distance measures
Application of distance measures
Arithmetic and logical operations on images
Neighborhood operation on images
53