05 pixel connectivity b
-
Upload
institute-of-space-technology-ist -
Category
Technology
-
view
42 -
download
1
Transcript of 05 pixel connectivity b
Khawar Khurshid, 20123
(X,Y) (X+1,Y)
(X,Y‐1)
(X‐1,Y)
(X,Y+1)
(X+1,Y‐1)(X‐1,Y‐1)
(X+1,Y+1)(X‐1,Y+1)
Neighbors of pixel are the pixels that are adjacent to the identified pixel.
Pixel Neighborhood
(4 Connectivity)
(Diagonal Pixels)
(8 Connectivity)
City Block Distance – D4
Chess Board Distance – D8
Euclidean Distance - DE
Distance Measures
Khawar Khurshid, 20124
We can divide distance between pixels in following categories
Khawar Khurshid, 20125
Distance Measures
City block distance (D4 distance)
0 11
1
12
22
2
4 ( , )D p q x s y t
Khawar Khurshid, 20126
Distance Measures
Euclidean Distance
2 2( , ) ( ) ( )eD p q x s y t
p(x,y)
q(s,t)
D = {(1‐4)^2 + (1‐4)^2}^0.5
D = 4.24
Khawar Khurshid, 20127
Distance Measures
Chessboard distance (D8 distance)
0
111
1
111
1
22222
2
2
2
2 2 2 2 2
2
2
2
8 ( , ) max( , )D p q x s y t
D8 = D4 U Dd
Khawar Khurshid, 20128
Distance Measures
Find minimum number of pixels between highlighted pixels using
4 Connectivity ?8 Connectivity ?Euclidean Distance ?
4 connectivity = 12
8 connectivity = 6
Euclidean Distance = 8.05
Khawar Khurshid, 20129
Distance Measures
Which color is representing 4 connectivity , 8 connectivityor both
Black = 4 & 8 Connectivity
Red = 8 Connectivity
Yellow = 4 & 8 Connectivity
Green = 8 Connectivity
Blue = 4 & 8 Connectivity
• Establishing boundaries of objects and components ofregions in an image.
• Group the same region by assumption that the pixelsare of 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
Connectivity
Khawar Khurshid, 201211
V: Set of gray levels used to define the criterion of similarity
p,q: Pixels being observed
4( , ) , ( )p q V and q N p
Set of gray levels V = {1}Set of gray levels V = {1}
4-Connectivity
Khawar Khurshid, 201212
V: Set of gray levels used to define the criterion of similarity
P,q: Pixels being observed
Set of gray levels V = {1}Set of gray levels V = {1}
8-Connectivity
Khawar Khurshid, 2012
8( , ) , ( )p q V and q N p
13
Process the image from left toright, 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.
ii.) If both are 1 and have the same label, copy it.
iii.) If they have different labels Copy the label from the left. Update the equivalence table.
iv.) Otherwise, assign a new label.
Re‐label with the smallest of equivalentlabels
Pass 1
Pass 2
4-Connectivity Labeling
Khawar Khurshid, 201214
Khawar Khurshid, 201215
4-Connectivity Labeling
1
Table : 1
2 2 2 2 2
2
13 3 3
3
2 2 13 3 2 2 2 2
, 2
3 2 2 222 2 2
4 4 4
4
2
What will be values of table in second scan ?
Background pixel
Unlabeled Pixel
Background pixel
Unlabeled Pixel
Label 1
8-Connectivity Labeling
Khawar Khurshid, 201216
Background pixel
Unlabeled Pixel
Label 1
Label 2
Background pixel
Unlabeled Pixel
Label 1
Label 2
Label 3
8-Connectivity Labeling
Khawar Khurshid, 201217
Background pixel
Unlabeled Pixel
Label 1
Label 2
Label 3
Background pixel
Unlabeled Pixel
Label 1
Label 2
Label 3
8-Connectivity Labeling
Khawar Khurshid, 201218
Background pixel
Label 1
Label 2
Label 3
Unlabeled pixel
Background pixel
Label 1
Label 2
Label 3
Unlabeled pixel
8-Connectivity Labeling
Khawar Khurshid, 201219
Background pixel
Label 1
Label 2
Label 3
Unlabeled pixel
Label 4
Background pixel
Label 1
Label 2
Label 3
Unlabeled pixel
Label 4
8-Connectivity Labeling
Khawar Khurshid, 201220