Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 17

Lect # 4

Digital Image Processing


Topic:
Image Topology: neighborhood and connectivity
Pixel neighborhood

(x,y)
Pixel adjacency or
connectivity
Pixels: p(x,y) and q(s,t)

• V = {1} – set of intensity values used to define
adjacency
• 4-adjacency: p and q with values from V, are 4-
adjacent if they are 4 neighbors
• 8-adjacency: p and q with values from V, are 8-
adjacent if they are 8 neighbors
• m-adjacency (mixed adjacency): p and q with values
from V, are m-adjacent if:
• q is 4-neighbor of p, or
• Q is diagonal neighbor of p and there is no common 4-
neighbor fro p and q, that is, N4(p)⋂ N4(q) = Φ
Question:
• For the binary image [1 1 1 0 1 1; 0 1 1 0 0 1;1 1 0 0 0
1;1 1 0 0 1 1; 1 1 0 1 1 1], if objects are identified as
V={0}
• Determine the number of objects in the image.
• Determine the number of pixels in each object.
• Determine the pixel length of the boundary of each object.
• Steps:
1. Start reading row wise.
2. For each white pixel
a. label it
b. find the connected neighbours and give them same label
c. if not connected with any previous label but belongs to
foreground, give the next label.
Connectivity, Regions & Boundaries

• 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 all elements of S
form one connected component, then set S is called a
connected set.
• A subset of pixels in an image, R is a region of the image if R is
a connected set. 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.
Boundary and Edge

• Boundary of finite regions form a closed


path and edges may be open.

• Boundaries are based on connectivities


and edges on a measure of gray-level
discontinuties.
Pixel distances
• For pixels p, q, and z, with coordinates (x, y), (s, t), and (v, w),
respectively, D is a distance function or metric if

• Euclidean distance

the points with distance ‘d’ are contained in a disk of radius ‘d’ centered
at (x, y).
Pixel Distances (Contd.)
• TheD4 distance (also called city-block distance) between p and q is

• TheD8 distance (also called chessboard distance) between p and q is

Note that the D4 and D8 distances


between p and q are independent
of any paths that might exist
between the points because these
distances involve only the
coordinates of the points
Pixel Distances (Contd.)

• Dm distance: shortest m-path between the points.


• Dm distance between two pixels will depend on the values of the pixels
along the path, as well as the values of their neighbors.

0 1 0 1 1 1
0 1 1 1 1 1
1 1 1

Dm = 2 Dm = 3 Dm = 4
Find the number of objects in the
given image using (i) 4-connectivity
(ii) 8-connectivity and (iii) m-
connectivity
Find the number of objects in the
given image using (i) 4-connectivity
(ii) 8-connectivity and (iii) m-
connectivity
Find the number of objects in the
given image using (i) 4-connectivity
(ii) 8-connectivity and (iii) m-
connectivity
Find the boundary length( in terms of
number of pixels) for each object with 8-
connectivity used.
Boundary with 8-connectivity Boundary with 4-connectivity
Find the boundary length( in terms of
number of pixels) for each object with 8-
connectivity used.
Boundary with 8-connectivity Boundary with 4-connectivity

You might also like