In this section, we introduce three most efficient labeling algorithms: EFS, SAUF and BBDT. For convenience, we assume that the input images are binary images (foreground pixels and background pixels are represented by 1 and 0, respectively) with zero borders and consider only the eight-connectivity. We useto denote the input image andfor the symbolic image. For the general label-equivalence-based algorithms, the mask used in the first scan is shown in Fig. 1. To speedup the labeling procedure, there are two common strategies. One is to reduce the average number of times for checking the processed neighbor pixels in the first scan, and the other is to resolve the label equivalences quickly by an efficient data structure.
He's EFS method process the foreground pixels following a background pixel and those following foreground pixels in a different way, which can reduce the average number of neighbors accessed from 2.25 to 1.75. During the first scan, for each current foreground pixel, we have already known whether the previous pixel is a foreground pixel or not, thus, it can be removed from the mask. Therefore, the mask used here consists of only the three processed neighbor pixels of the current foreground pixel in the row above,, and (that is, , and), as shown in Fig. 2. For processing a current foreground pixel following a background pixel, the same method as proposed in FCL  is used. While, for the current foreground pixel following another foreground pixel, the label of its previous foreground pixel is assigned to it, and the left thing needed to do is only to check whether this label is equivalent to the label assigned to pixel .
To resolve label equivalences between provisional labels, this algorithm adopts an equivalent label set to hold all the provisional labels assigned to a connected component and the smallest label is taken as the representative label. When a new provisional labelis generated, the corresponding equivalent label set is established as, and the representative label is set to itself, i.e.. Whenever label equivalence occurs, say, andin the mask belong to different setsand separately, these two sets are merged together, and their smallest label is regarded as their representative label. They took three simple one-dimensional arrays to implement this process without using pointers, but the drawback is that when a set with more elements is merged into a set with fewer elements, the resolve procedure will cost much time. Anyway, EFS is a most efficient pixel-based scan strategy so far.