
314 A Computational Introduction to Digital Image Processing, Second Edition
In the fourth row, the first foreground pixel has both its upper and left neighbors
being background pixels, so we assign it a new label—5. The second (foreground)
pixel in the fourth row now has both its upper and left neighbors being foreground
pixels. However, they have different labels. We thus assign either of these labels to
this second pixel, say label 4, and make a note that labels 4 and 5 are equivalent, as
shown in Figure 11.6(c).
This comple tes Step 1.
1
2 1 3
(a)
1
2 1 3
34
(b)
1
2 1 3
34
45
(c)
FIGURE 11.6: Continuing the connectedness algorithm
Step 2. We have the following ...