Professional Documents
Culture Documents
1
Neighbors of a Pixel (cont.)
Basic Relations between Pixels
Neighbors of a pixel
(x-1,y-1) (x,y-1) (x+1,y-1) 8-neighbors of p: Horizontal and vertical neighbors.
(x+1, y), (x-1, y), (x, y+1), (x, y-1)
(x-1,y) p (x+1,y)
(x-1,y-1) Four diagonal neighbors: ND(p)
(x,y-1) (x+1, y+1), (x+1, y-1), (x-1, y+1), (x-1, y-1)
(x+1,y-1) 4-neighbors of p = N4(p).
(x-1,y+1) (x,y+1) (x+1,y+1)
(x-1,y) 8-neighbors of p = N8(p).
N8(p) = (x+1,y) N8(p) = N4(p) ∪ ND(p)
(x-1,y+1) Each neighbor is at a unit distance from point p
The points ND(P) and N4(P) are
If p is a boundary pixel then it will have less no. of neighbors
together known as 8-neighbors of the (x,y+1)
point P, denoted by N8(P).
(x+1,y+1)
Connectivity
8-neighborhood relation considers all neighbor pixels. Adjacency
Connectivity
Example
Connectivity is adapted from neighborhood relation.
Two pixels are connected if they are in the same class (i.e. the
same color or the same range of intensity) and they are
neighbors of one another.
w mixed-connectivity (m-connectivity):
p and q are m-connected if q N4(p) or • m-connectivity eliminates the multiple path connections that
q ND(p) and N4(p) N4(q) = arise in 8-connectivity.
2
• 4-adjacency: if q is in the set N4(p).
Adjacency • 8-adjacency: if q is in the set N8(p).
A pixel p is adjacent to a pixel q if they are connected. • m-adjacency: if
– if q is in the set N4(p), or
– if q is in the set ND(p) and the set N4(p)∩N4(q) has no
pixels whose values are from V.
• Mixed adjacency is a modification of 8-adjacency and is
p p used to eliminate the multiple path connections that often
arise when 8-adjacency is used.
8-adjacency:
4-adjacency: N4(p) ∪N (p)
D
N4(p)
We can define type of adjacency: 4-adjacency, 8-adjacency
or m-adjacency depending on type of connectivity.
Adjacency
m-Adjacency
A mixed adjacency combines 4- and 8-adjacency to avoid A pixel p is adjacent to pixel q is they are connected.
the ambiguities. Two image subsets S1 and S2 are adjacent if some pixel
in S1 is adjacent to some pixel in S2
3
Path Path (cont.)
Distance measures for pixel p, q and z with coordinates (x,y), (s,t) and
2
Euclidean distance 2 1 2
(u,v) respectively,
City-block distance or D4 distance. 2 1 0 1 2 Any function D holding the following three condition is a
D4(p, q)= |x - s | + |y - t | 2 1 2 'distance' (or a metric)
D8 distance or chessboard distance. 2 D is a distance function or metric if
D8(p, q)= max (|x - s |, | y - t |) (a) D(p,q) ≥ 0 ; D(p,q) = 0 iff p=q
2 2 2 2 2 (b) D(p,q) = D(q,p)
2 1 1 1 2
(c) D(p,z) ≤ D(p,q) + D(q,z)
2 1 0 1 2
2 1 1 1 2
2 2 2 2 2
4
Euclidean distance
between p and q
The distance between points with co-ordinates (x, y) and
(s, t) may be defined in several different ways. Here, we
discuss the following distance metrics:
the Euclidean distance,
the 'city block' distance, and
the 'chessboard' distance.
City-block distance:
D4 distance
The distance between two points can also be expressed
as the minimum number of elementary steps in the digital
grid which are needed to move from the starting point to
the end point. If only horizontal and vertical moves are
allowed, the distance D4 is obtained.
5
Chessboard distance: D8 distance
If moves in diagonal directions are allowed in the
digitization grid, we obtain the distance D8, often called
the 'chessboard' distance.
The distance D8 is equal to the number of minimal king-
moves on the chessboard from one part to another: