Connected Component Labeling Algorithm
F. Chang, C-J. Chen, and C-J. Lu, A Linear-Time Component-Labeling Algorithm Using Contour Tracing Technique, Computer Vision and Image Understanding, vol. 93, no. 2, pp. 206-220, 2004.