Professional Documents
Culture Documents
Digital Image Processing - Lec3
Digital Image Processing - Lec3
Lecture - 3
(x-1, y)
(x, y-1) p (x, y) (x, y+1)
(x-1, y)
3
Adjacency and Connectivity
Let V: a set of intensity values used to define adjacency and
connectivity.
In a binary/black & white image, V = {1}, if we are referring to
adjacency of pixels with value 1.
In a gray-scale image, the idea is the same, but V typically contains
more elements, for example, V = {0, 18, 182, …, 200}
If the possible intensity values are 0 – 255, {V} set can be any
subset of these 256 values.
Types of Adjacency
4-adjacency: Two pixels p and q with values from V are 4-
adjacent if q is in the set N4(p).
8-adjacency: Two pixels p and q with values from V are 8-
adjacent if q is in the set N8(p).
m (mixed)-adjacency: Two pixels p and q with values from V are
m-adjacent if :
• q is in N4(p) or
• q is in ND(p) and the set N4(p) ∩ N4(q) has no pixel whose
4
values are from V (no intersection)
Lets try an example…
0 1 1 2 3
(0,0) (0,1) (0,2) (0,3) (0,4) N4 (p) = {(3,2), (2,3), (3,4), (4,3)}
1 1 2 0 1
(1,0) (1,1) (1,2) (1,3) (1,4) ND (p) = {(2,2), (2,4), (4,2), (4,4)}
2 2 3 3 2
(2,0) (2,1) (2,2) (2,3) (2,4) N8 (p) = {(2,2), (2,3), (2,4), (3,2),
1 3 0 0 1 (3,4), (4,2), (4,3), (4,4)}
(3,0) (3,1) (3,2) (3,3) (3,4)
0 0 2 0 1 A4 (p,q1) = YES; A8 (p,q1) = YES;
(4,0) (4,1) (4,2) (4,3) (4,4) Am(p,q1) = YES
5
A Digital Path
A digital path (or curve) from pixel p with coordinate (x,y) to pixel q with
coordinate (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.
n is the length of the path.
If (x0,y0) = (xn, yn), the path is closed.
We can specify 4-, 8- or m-paths depending on the type of adjacency
specified.
V = {0, 2, 3} 0 1 1 2 3
1 1 2 0 1
2 2 3 3 2
1 3 0 0 1
0 0 2 0 1
6
Distance Measures
For pixels p, q and z, with coordinates (x,y), (s,t) and (v,w),
respectively, D is a distance function if:
(a) D (p,q) ≥ 0 (D (p,q) = 0 iff p = q), D44 ≤
D ≤22 and D88 ≤
and D ≤22
(b) D (p,q) = D (q, p), and 2
(c) D (p,z) ≤ D (p,q) + D (q,z).
2 1 2