
Image Topology 329
Returning again to Figure 11.20(b), since C(p) = 1 the central pixel p is 8-simple and so
can be deleted without affecting the 8-connectivity of the object. But since A(p) = 1, the
central pixel p is not 4-simple and so cannot be deleted without affecting the 4-connectivity
of the object. This is exemplified in Figure 11.3.
Note that A(p) and B(p) can be computed simply by using the various labeling functions
discussed earlier. For example, consider the neighborhood shown in Figure 11.20(b):
MATLAB/Octave
>> n = [1 1 0;1 1 1;0 0 1]
>> n(5) = 0;
>> max(max(bwlabel(n,4)))
ans =
2
>> max(max(bwlabel(n,8)))
ans =
1
Similarly:
Python
In : from skimage.measure ...