Digital Image Processing: Lecture # 3 Connected Component Analysis
Digital Image Processing: Lecture # 3 Connected Component Analysis
Lecture # 3
Connected Component Analysis
1
Relationships between pixels
y-1 y y+1
x-1
x
x+1
3
What
Whatare the
arethe
coordinates
coordinatesofofeach of
eachof
the
theblue pixels
bluepixels
x
x+1
x-1
y-1 y
y+1
4
Diagonal Neighbors of a Pixel –ND(p)
y-1 y y+1
x-1
x
x+1
5
8- Neighbors of a Pixel –N8(p)
y-1 y y+1
x-1
x
x-1
N8 ( p ) N 4 ( p ) N D ( p )
7
Connectivity
Establishing boundaries of objects and components in an image
Group the same region by assumption that the pixels being the same
color or equal intensity
Two pixels p & q are connected if
They are adjacent in some sense
If their gray levels satisfy a specified criterion of
similarity
8
Connectivity
V: Set of gray levels used to define the criterion of similarity
4-connectivity
4-connectivity
Set
Setofofgray
graylevels
levelsVV=={1}
{1}
10
Connectivity
V: Set of gray levels used to define the criterion of similarity
8-connectivity
8-connectivity
Set
Setofofgray
graylevels
levelsVV=={1}
{1}
11
Connectivity
V: Set of gray levels used to define the criterion of similarity
m-connectivity
m-connectivity(Mixed
(MixedConnectivity)
Connectivity)
If gray level
12
Example: m – Connectivity
Note: Mixed connectivity can eliminate the multiple path connections that often
occurs in 8-connectivity
13
Paths
Path: Let coordinates of pixel p: (x, y), and of pixel q: (s, t)
where (x0, y0) = (x, y) & (xn,yn) = (s, t), and (xi,yi) is adjacent
to (xi-1,yi-1) 1≤i ≤n
14
Test Yourself
CC labeling – 4 Connectivity
16
CC labeling – 4 Connectivity
Process the image from left to
right, top to bottom:
1.) If the next pixel to process is 1
i.) If only one of its neighbors
(top or left) is 1, copy its label.
17
CC labeling – 4 Connectivity
18
CC labeling – 4 Connectivity
19
CC labeling – 8 Connectivity
Same
Samealgorithm
algorithmbut
butexamine
examinealso
alsothe
theupper
upperdiagonal
diagonalneighbors
neighborsofofpp
20
CC labeling – 8 Connectivity
Background pixel
Background pixel
Unlabeled Pixel
Unlabeled Pixel
Label 1
21
CC labeling – 8 Connectivity
22
CC labeling – 8 Connectivity
23
CC labeling – 8 Connectivity
Label 1 Label 1
Label 2 Label 2
Label 3 Label 3
24
CC labeling – 8 Connectivity
25
Distance Metrics
Let pixels p, q and z have coordinates (x,y), (s,t) and (u,v) respectively.
26
City block distance (D4 distance)
D4 ( p, q) x s y t
27
Chessboard distance (D8 distance)
D8 ( p, q) max( x s , y t )
28
Euclidean Distance
De ( p, q) ( x s) 2 ( y t ) 2
q(s,t)
p(x,y)
29
Acknowledgements
Statistical Pattern Recognition: A Review – A.K Jain et al., PAMI (22) 2000
Material in these slides has been taken from, the following resources
30