Relationships Between Pixels
Relationships Between Pixels
Relationships Between Pixels
UNIT-1
Relationships between pixels
Neighbors of a Pixel
P (x,y)
(x+1, y)
(x, y+1)
Neighbors of a Pixel
(x-1, y+1)
(x+1, y-1)
P (x,y)
(x-1, y-1)
(x+1, y+1)
(x-1, y+1)
(x, y-1)
(x+1, y-1)
(x-1, y)
P (x,y)
(x+1, y)
As before, some
of the
points in ND (p) (x,
andy+1)
N8 (p) fall outside(x+1,
the image
(x-1,
y-1)
y+1) if (x,y) is on the
border of the image.
Types of Adjacency
1. 4-adjacency: Two pixels p and q with
values from V are 4-adjacent if q is in the
set N4(p).
2. 8-adjacency: Two pixels p and q with
values from V are 8-adjacent if q is in the
set N8(p).
3. m-adjacency =(mixed)
Types of Adjacency
m-adjacency:
Two pixels p and q with values from V are
m-adjacent if :
q is in N4(p) or
Types of Adjacency
Types of Adjacency
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.
A Digital Path
Return to the previous example:
Connectivity
Let S represent 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. If it only has one connected
component, then set S is called a connected
set.
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.
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),
(b) D (p,q) = D (q, p), and
(c) D (p,z) D (p,q) + D (q,z).
Distance Measures
The Euclidean Distance between p and q
is defined as:
De (p,q) = [(x s)2 + (y - t)2]1/2
De
p (x,y)
q)
,
(p
q (s,t)
Distance Measures
The D4 distance (also called city-block
distance) between p and q is defined as:
D4 (p,q) = | x s | + | y t |
q (s,t)
D4
Distance Measures
Example:
The pixels with distance D4 2 from (x,y)
form the following contours of constant
distance.
The pixels with D4 = 1 are
the 4-neighbors of (x,y)
Distance Measures
The D8 distance (also called chessboard
distance) between p and q is defined as:
D8 (p,q) = max(| x s |,| y t |)
q (s,t)
D8(b)
8(a)
8(a) ,
D8(b))
Distance Measures
Example:
D8 distance 2 from (x,y) form the following
contours of constant distance.
Distance Measures
Dm distance:
is defined as the shortest m-path between
the points.
In this case, the distance between two
pixels will depend on the values of the
pixels along the path, as well as the
values of their neighbors.
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 can
have a value of 0 or 1
Suppose that we consider
the adjacency of pixels
values 1 (i.e. V = {1})
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)
Distance Measures
Cont. Example:
Case2: If p1 =1 and p3 = 0
now, p1 and p will no longer be adjacent
(see m-adjacency definition)
then, the length of the shortest
path will be 3 (p, p1, p2, p4)
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)
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)