A Block-Based Union-Find Algorithm to Label Connected Components on GPUs

  • Stefano Allegretti
  • Federico BolelliEmail author
  • Michele Cancilla
  • Costantino Grana
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11752)


In this paper, we introduce a novel GPU-based Connected Components Labeling algorithm: the Block-based Union Find. The proposed strategy significantly improves an existing GPU algorithm, taking advantage of a block-based approach. Experimental results on real cases and synthetically generated datasets demonstrate the superiority of the new proposal with respect to state-of-the-art.


Connected Components Labeling Image processing GPU CUDA 


  1. 1.
    Agam, G., Argamon, S., Frieder, O., Grossman, D., Lewis, D.: The complex document image processing (CDIP) test collection project. Illinois Institute of Technology (2006)Google Scholar
  2. 2.
    Allegretti, S., Bolelli, F., Cancilla, M., Grana, C.: Optimizing GPU-based connected components labeling algorithms. In: Third IEEE International Conference on Image Processing, Applications and Systems (IPAS), pp. 175–180. IEEE (2018)Google Scholar
  3. 3.
    Allegretti, S., Bolelli, F., Cancilla, M., Pollastri, F., Canalini, L., Grana, C.: How does connected components labeling with decision trees perform on GPUs? In: Vento, M., Percannella, G. (eds.) CAIP 2019. LNCS, vol. 11678, pp. 39–51. Springer, Cham (2019)CrossRefGoogle Scholar
  4. 4.
    Andrecut, M.: Parallel GPU implementation of iterative PCA algorithms. J. Comput. Biol. 16(11), 1593–1599 (2009)MathSciNetCrossRefGoogle Scholar
  5. 5.
    Baltieri, D., Vezzani, R., Cucchiara, R.: 3DPeS: 3D people dataset for surveillance and forensics. In: Proceedings of the 2011 Joint ACM Workshop on Human Gesture and Behavior Understanding, pp. 59–64. ACM (2011)Google Scholar
  6. 6.
    Bolelli, F.: Indexing of historical document images: ad hoc dewarping technique for handwritten text. In: Grana, C., Baraldi, L. (eds.) IRCDL 2017. CCIS, vol. 733, pp. 45–55. Springer, Cham (2017). Scholar
  7. 7.
    Bolelli, F., Baraldi, L., Cancilla, M., Grana, C.: Connected components labeling on DRAGs. In: International Conference on Pattern Recognition (ICPR), pp. 121–126. IEEE (2018)Google Scholar
  8. 8.
    Bolelli, F., Borghi, G., Grana, C.: Historical handwritten text images word spotting through sliding window HOG features. In: Battiato, S., Gallo, G., Schettini, R., Stanco, F. (eds.) ICIAP 2017. LNCS, vol. 10484, pp. 729–738. Springer, Cham (2017). Scholar
  9. 9.
    Bolelli, F., Borghi, G., Grana, C.: XDOCS: an application to index historical documents. In: Serra, G., Tasso, C. (eds.) IRCDL 2018. CCIS, vol. 806, pp. 151–162. Springer, Cham (2018). Scholar
  10. 10.
    Bolelli, F., Cancilla, M., Baraldi, L., Grana, C.: Toward reliable experiments on the performance of connected components labeling algorithms. J. Real-Time Image Process. 1–16 (2018).
  11. 11.
    Bolelli, F., Cancilla, M., Grana, C.: Two more strategies to speed up connected components labeling algorithms. In: Battiato, S., Gallo, G., Schettini, R., Stanco, F. (eds.) ICIAP 2017. LNCS, vol. 10485, pp. 48–58. Springer, Cham (2017). Scholar
  12. 12.
    Brunie, N., Collange, S., Diamos, G.: Simultaneous branch and warp interweaving for sustained GPU performance. In: 39th Annual International Symposium on Computer Architecture (ISCA), pp. 49–60 (2012)Google Scholar
  13. 13.
    Cabaret, L., Lacassagne, L., Etiemble, D.: Distanceless label propagation: an efficient direct connected component labeling algorithm for GPUs. In: Seventh International Conference on Image Processing Theory, Tools and Applications (IPTA), pp. 1–6. IEEE (2017)Google Scholar
  14. 14.
    Canalini, L., Pollastri, F., Bolelli, F., Cancilla, M., Allegretti, S., Grana, C.: Skin lesion segmentation ensemble with diverse training strategies. In: Vento, M., Percannella, G. (eds.) CAIP 2019. LNCS, vol. 11678, pp. 89–101. Springer, Cham (2019)CrossRefGoogle Scholar
  15. 15.
    Cucchiara, R., Grana, C., Prati, A., Vezzani, R.: Computer vision techniques for PDA accessibility of in-house video surveillance. In: First ACM SIGMM International Workshop on Video Surveillance, pp. 87–97. ACM (2003)Google Scholar
  16. 16.
    Dong, F., Irshad, H., Oh, E.Y., et al.: Computational pathology to discriminate benign from malignant intraductal proliferations of the breast. PLoS ONE 9(12), e114885 (2014)CrossRefGoogle Scholar
  17. 17.
    Dubois, A., Charpillet, F.: Tracking mobile objects with several kinects using HMMs and component labelling. In: Workshop Assistance and Service Robotics in a Human Environment, International Conference on Intelligent Robots and Systems, pp. 7–13 (2012)Google Scholar
  18. 18.
    Eklund, A., Dufort, P., Villani, M., LaConte, S.: BROCCOLI: software for fast fMRI analysis on many-core CPUs and GPUs. Front. Neuroinformatics 8, 24 (2014)CrossRefGoogle Scholar
  19. 19.
    Grana, C., Baraldi, L., Bolelli, F.: Optimized connected components labeling with pixel prediction. In: Blanc-Talon, J., Distante, C., Philips, W., Popescu, D., Scheunders, P. (eds.) ACIVS 2016. LNCS, vol. 10016, pp. 431–440. Springer, Cham (2016). Scholar
  20. 20.
    Grana, C., Bolelli, F., Baraldi, L., Vezzani, R.: YACCLAB - yet another connected components labeling benchmark. In: 23rd International Conference on Pattern Recognition (ICPR), pp. 3109–3114. IEEE (2016)Google Scholar
  21. 21.
    Grana, C., Borghesani, D., Cucchiara, R.: Optimized block-based connected components labeling with decision trees. IEEE Trans. Image Process. 19(6), 1596–1609 (2010)MathSciNetCrossRefGoogle Scholar
  22. 22.
    Hawick, K.A., Leist, A., Playne, D.P.: Parallel graph component labelling with GPUs and CUDA. Parallel Comput. 36(12), 655–678 (2010)CrossRefGoogle Scholar
  23. 23.
    He, L., Chao, Y., Suzuki, K.: A linear-time two-scan labeling algorithm. In: International Conference on Image Processing, vol. 5, pp. 241–244 (2007)Google Scholar
  24. 24.
    He, L., Zhao, X., Chao, Y., Suzuki, K.: Configuration-transition-based connected-component labeling. IEEE Trans. Image Process. 23(2), 943–951 (2014)MathSciNetCrossRefGoogle Scholar
  25. 25.
    Huiskes, M.J., Lew, M.S.: The MIR flickr retrieval evaluation. In: Proceedings of the 2008 ACM International Conference on Multimedia Information Retrieval, MIR 2008. ACM, New York (2008)Google Scholar
  26. 26.
    Kalentev, O., Rai, A., Kemnitz, S., Schneider, R.: Connected component labeling on a 2D grid using CUDA. J. Parallel Distrib. Comput. 71(4), 615–620 (2011)CrossRefGoogle Scholar
  27. 27.
    Komura, Y.: GPU-based cluster-labeling algorithm without the use of conventional iteration: application to the Swendsen-Wang multi-cluster spin flip algorithm. Comput. Phys. Commun. 194, 54–58 (2015)MathSciNetCrossRefGoogle Scholar
  28. 28.
    Lelore, T., Bouchara, F.: FAIR: a fast algorithm for document image restoration. IEEE Trans. Pattern Anal. Mach. Intell. 35(8), 2039–2048 (2013)CrossRefGoogle Scholar
  29. 29.
    Lewis, D., Agam, G., Argamon, S., Frieder, O., Grossman, D., Heard, J.: Building a test collection for complex document information processing. In: Proceedings of the 29th Annual International ACM SIGIR Conference, pp. 665–666 (2006)Google Scholar
  30. 30.
    Maltoni, D., Maio, D., Jain, A.K., Prabhakar, S.: Handbook of Fingerprint Recognition. Springer, London (2009). Scholar
  31. 31.
    Oliveira, V.M., Lotufo, R.A.: A study on connected components labeling algorithms using GPUs. In: SIBGRAPI, vol. 3, p. 4 (2010)Google Scholar
  32. 32.
    Playne, D.P., Hawick, K.: A new algorithm for parallel connected-component labelling on GPUs. IEEE Trans. Parallel Distrib. Syst. 29(6), 1217–1230 (2018)CrossRefGoogle Scholar
  33. 33.
    Pollastri, F., Bolelli, F., Paredes, R., Grana, C.: Improving skin lesion segmentation with generative adversarial networks. In: 2018 IEEE 31st International Symposium on Computer-Based Medical Systems (CBMS), pp. 442–443. IEEE (2018)Google Scholar
  34. 34.
    Pollastri, F., Bolelli, F., Paredes, R., Grana, C.: Augmenting data with GANs to segment melanoma skin lesions. Multimed. Tools Appl. 1–18 (2019).
  35. 35.
    Rosenfeld, A., Pfaltz, J.L.: Sequential operations in digital picture processing. J. ACM 13(4), 471–494 (1966)CrossRefGoogle Scholar
  36. 36.
    Source code of the proposed strategy. Accessed 16 May 2019
  37. 37.
    Wu, K., Otoo, E., Suzuki, K.: Two strategies to speed up connected component labeling algorithms. Technical report, LBNL-59102, Lawrence Berkeley National Laboratory (2005)Google Scholar
  38. 38.
    Zavalishin, S., Safonov, I., Bekhtin, Y., Kurilin, I.: Block equivalence algorithm for labeling 2D and 3D images on GPU. Electron. Imaging 2016(2), 1–7 (2016)CrossRefGoogle Scholar

Copyright information

© Springer Nature Switzerland AG 2019

Authors and Affiliations

  • Stefano Allegretti
    • 1
  • Federico Bolelli
    • 1
    Email author
  • Michele Cancilla
    • 1
  • Costantino Grana
    • 1
  1. 1.Dipartimento di Ingegneria “Enzo Ferrari”Università degli Studi di Modena e Reggio EmiliaModenaItaly

Personalised recommendations