Professional Documents
Culture Documents
Image Processing: Chapter (3) Part 1:relationships Between Pixels
Image Processing: Chapter (3) Part 1:relationships Between Pixels
Chapter(3)
Part 1:Relationships between pixels
Hanan Hardan 1
Ch3: Some basic Relationships between pixels
Neighbors of a pixel
Adjacency
V: set of gray level values (L), (V is a subset of L.)
3 types of adjacency
Hanan Hardan 5
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 8-adjacency.
Hanan Hardan 6
Types of Adjacency
Two subsets S1 and S2 are adjacent, if
some pixel in S1 is adjacent to some pixel
in S2. Adjacent means, either 4-, 8- or m-
adjacency.
Hanan Hardan 7
Ch3: Some basic Relationships between pixels
A digital path
A digital 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), and
pixels (xi,yi) and (xi-1,yi-1) are adjacent
for 1 ≤ i ≤ n.
Connectivity
S: a subset of pixels in an image.
Two pixels p and q are said to be
connected in S if there exists a path
between them consisting entirely of
pixels in S.
For any pixel p in S, the set of pixels
that are connected to it in S is called a
connected component of S.
Hanan Hardan 10
Ch3: Some basic Relationships between pixels
Boundary
The boundary (also called border or contour)
of a region R is the set of pixels in the region
that have one or more neighbors that are not
in R.
Hanan Hardan 11
Region and Boundary
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 in the image.
Hanan Hardan 12
Foreground and background
Suppose that the image contains K disjoint
regions Rk none of which touches the
image border .
Ru : the union of all regions .
(Ru)c : is the complement .
Hanan Hardan 13
Ch3: Some basic Relationships between pixels
Distance measures
If we have 3 pixels: p,q,z respectively
p with (x,y)
q with (s,t)
z with (v,w)
Then:
A. D (p,q) ≥ 0 ,D(p,q) = 0 iff p = q
B. D(p,q) = D(q,p)
C. D(p,z) ≤ D(p,q) + D(q,z)
Hanan Hardan 14
Ch3: Some basic Relationships between pixels
Distance measures
Euclidean distance between p and q:
De(p,q) = [(x-s)2 + (y-t)2]1/2
Hanan Hardan 16
Example:
Hanan Hardan 17
Distance measures
Example :
Use the city block distance to prove 4-
neighbors ? 1 2 3
1
d
Pixel A : | 2-2| + |1-2| = 1 2
a p c
Pixel B: | 3-2|+|2-2|= 1
3 b
Pixel C: |2-2|+|2-3| =1
Pixel D: |1-2| + |2-2| = 1
Hanan Hardan 19
Distance Measures
Example:
D8 distance ≤ 2 from (x,y) form the
following contours of constant distance.
Hanan Hardan 21
Distance Measures
Example:
Consider the following arrangement of
pixels and assume that p, p2, and p4 have
value 1 and that p1 and p3 can have a
value of 0 or 1
Suppose that we consider
the adjacency of pixels
values 1 (i.e. V = {1})
Hanan Hardan 22
Distance Measures
Cont. Example:
Now, to compute the Dm between points p
and p4
Here we have 4 cases:
Case1: If p1 =0 and p3 = 0
The length of the shortest m-path
(the Dm distance) is 2 (p, p2, p4)
Hanan Hardan 23
Distance Measures
Cont. Example:
Case2: If p1 =1 and p3 = 0
Hanan Hardan 24
Distance Measures
Cont. Example:
Case3: If p1 =0 and p3 = 1
The same applies here, and the shortest –
m-path will be 3 (p, p2, p3, p4)
Hanan Hardan 25
Distance Measures
Cont. Example:
Case4: If p1 =1 and p3 = 1
The length of the shortest m-path will be 4
(p, p1 , p2, p3, p4)
Hanan Hardan 26