Optimizing two-pass connected-component labeling algorithms

  • Authors:
  • Kesheng Wu;Ekow Otoo;Kenji Suzuki

  • Affiliations:
  • University of California, Lawrence Berkeley National Laboratory, Berkeley, CA, USA;University of California, Lawrence Berkeley National Laboratory, Berkeley, CA, USA;The University of Chicago, Department of Radiology, Chicago, IL, USA

  • Venue:
  • Pattern Analysis & Applications
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

We present two optimization strategies to improve connected-component labeling algorithms. Taking together, they form an efficient two-pass labeling algorithm that is fast and theoretically optimal. The first optimization strategy reduces the number of neighboring pixels accessed through the use of a decision tree, and the second one streamlines the union-find algorithms used to track equivalent labels. We show that the first strategy reduces the average number of neighbors accessed by a factor of about 2. We prove our streamlined union-find algorithms have the same theoretical optimality as the more sophisticated ones in literature. This result generalizes an earlier one on using union-find in labeling algorithms by Fiorio and Gustedt (Theor Comput Sci 154(2):165–181, 1996). In tests, the new union-find algorithms improve a labeling algorithm by a factor of 4 or more. Through analyses and experiments, we demonstrate that our new two-pass labeling algorithm scales linearly with the number of pixels in the image, which is optimal in computational complexity theory. Furthermore, the new labeling algorithm outperforms the published labeling algorithms irrespective of test platforms. In comparing with the fastest known labeling algorithm for two-dimensional (2D) binary images called contour tracing algorithm, our new labeling algorithm is up to ten times faster than the contour tracing program distributed by the original authors.