Skip to main content
Log in

An efficient two-scan algorithm for computing basic shape features of objects in a binary image

  • Original Research Paper
  • Published:
Journal of Real-Time Image Processing Aims and scope Submit manuscript

Abstract

The basic shape features of an object in a binary image, i.e., the area, perimeter, circularity, and centroid, are important for image analysis and pattern recognition. In conventional algorithms, to calculate the basic shape features of objects in a binary image, it is usually necessary to first perform connected-component labeling to generate a labeled image (intermediate image), in which every image object is assigned a unique label so that it may be distinguished. Using the labeled image, the basic shape features of the object corresponding to each label can then be calculated. When a two-scan labeling algorithm is used, three scans are necessary. This paper proposes an efficient algorithm for calculating the shape features of objects in a binary image. Instead of a labeled image, our proposed algorithm calculates the basic shape features of objects using the image and the representative label table generated by the first scan of an efficient two-scan labeling algorithm. Thus, we can compute shape features using two scans. Experiments demonstrate that our proposed algorithm is much more efficient than conventional algorithms for calculating the basic shape features of objects in a binary image.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9

Similar content being viewed by others

Notes

  1. In fact, as indicated in [13], any label propagation algorithm will process some object pixels many times. Therefore, strictly speaking, label propagation algorithms are not one-scan algorithms.

  2. Obviously, all foreground pixels in the mask have already been processed (thus, have a provisional label) and belong to the same connected component (thus, all labels assigned to the foreground pixels in the mask are equivalent labels).

  3. Note that the CT algorithm used here is specifically for labeling objects without holes.

  4. The density of a binary image is the percent of foreground pixels in the image.

  5. Because we only fill holes, the number of objects in the original and corresponding revised images are exactly the same.

References

  1. Gonzalez, R.C., Woods, R.E.: Digital Image Processing. Addison-Wesley, Reading (1993)

    Google Scholar 

  2. Rosenfeld, A., Kak, A.C.: Digital Picture Processing, vol. 2, 2nd edn. Academic Press, San Diego (1982)

    MATH  Google Scholar 

  3. Pratt, W.K.: Introduction to Digital Image Processing. CRC Press, Boca Raton (2013)

    Book  Google Scholar 

  4. Szeliski, R.: Computer Vision: Algorithms and Applications. Springer, Berlin (2011)

    Book  MATH  Google Scholar 

  5. Rosenfeld, A., Pfalts, J.L.: Sequential operations in digital picture processing. J. ACM 13(4), 471–494 (1966)

    Article  MATH  Google Scholar 

  6. Rosenfeld, A.: Connectivity in digital pictures. J. ACM 17(1), 146–160 (1970)

    Article  MathSciNet  MATH  Google Scholar 

  7. Suzuki, K., Horiba, I., Sugie, N.: Linear-time connected-component labeling based on sequential local operations. Comput. Vis. Image Underst. 89, 1–23 (2003)

    Article  MATH  Google Scholar 

  8. Lumia, R., Shapiro, L., Zungia, O.: A new connected components algorithm for virtual memory computers. Comput. Vis. Graph. Image Process. 22(2), 287–300 (1983)

    Article  Google Scholar 

  9. Wu, K., Otoo, E., Suzuki, K.: Optimizing two-pass connected-component labeling algorithms. Pattern Anal. Appl. 12(2), 117–135 (2009)

    Article  MathSciNet  Google Scholar 

  10. He, L., Chao, Y., Suzuki, K.: A linear-time two-scan labeling algorithm. In: 2007 IEEE International Conference on Image Processing (ICIP), pp. V-241–V-244, September 2007, San Antonio, Texas, USA (2007)

  11. He, L., Chao, Y., Suzuki, K.: A run-based two-scan labeling algorithm. IEEE Trans. Image Process. 17(5), 749–756 (2008)

    Article  MathSciNet  Google Scholar 

  12. He, L., Chao, Y., Suzuki, K., Wu, K.: Fast connected-component labeling. Pattern Recogn. 42(9), 1977–1987 (2009)

    Article  MATH  Google Scholar 

  13. He, L., Chao, Y., Suzuki, K.: An efficient first-scan method for label-equivalence-based labeling algorithms. Pattern Recogn. Lett. 31(1), 28–35 (2010)

    Article  Google Scholar 

  14. He, L., Chao, Y., Suzuki, K.: A run-based one-and-a-half-scan connected-component labeling algorithm. Int. J. Pattern Recogn. Artif. Intell. 24(4), 557–579 (2010)

    Article  Google Scholar 

  15. Grana, C., Borghesani, D., Cucchiara, R.: Optimized block-based connected components labeling with decision trees. IEEE Trans. Image Process. 9(6), 1596–1609 (2010)

    Article  MathSciNet  MATH  Google Scholar 

  16. He, L., Zhao, X., Chao, Y., Suzuki, K.: Configuration-transition-based connected-component labeling. IEEE Trans. Image Process. 23(2), 943–951 (2014)

    Article  MathSciNet  MATH  Google Scholar 

  17. Chang, W., Chiu, C., Yang, J.: Block-based connected-component labeling algorithm using binary decision trees. Sensors 15(9), 23763–23787 (2015)

    Article  Google Scholar 

  18. Shoji, K., Miyamichi, J.: Connected component labeling in binary images by run-based contour tracing. Trans. Inst. Electron. Inf. Commun. Eng. D-II J83-D-II(4), 1131–1139 (1995)

    Google Scholar 

  19. Shima, Y., Murakami, T., Koga, M., Yashiro H., Fujisawa, H.: A high-speed algorithm for propagation-type labeling based on block sorting of runs in binary images. In: Proceedings of 10th International Conference Pattern Recognition, pp. 655–658 (1990)

  20. Chang, F., Chen, C.J., Lu, C.J.: A linear-time component-labeling algorithm using contour tracing technique. Comput. Vis. Imaging Underst. 93, 206–220 (2004)

    Article  Google Scholar 

  21. Jain, A.K., Vailaya, A.: Shape-based retrieval: a case-study with trademark image databases. Pattern Recogn. 31, 1369–1390 (1998)

    Article  Google Scholar 

  22. Proffitt, D.: The measurement of circularity and ellipticity on a digital grid. Pattern Recogn. 15, 383–387 (1982)

    Article  Google Scholar 

  23. Wang, L., Tan, T.N., Hu, W.M., Ning, H.Z.: Automatic gait recognition based on statistical shape analysis. IEEE Trans. Image Process. 12, 1120–1131 (2003)

    Article  MathSciNet  Google Scholar 

  24. Zunic, J., Hirota, K., Rosin, P.L.: A Hu invariant as a shape circularity measure. Pattern Recogn. 43, 47–57 (2010)

    Article  MATH  Google Scholar 

  25. Gotoh, T., Ohta, Y., Yoshida, M., Shirai, Y.: Component labeling algorithm for video rate processing. In: Proceeding of the SPIE, Advances in Image Processing, vol. 804, pp. 217–224 (1987)

  26. Tarjan, R.E.: Efficiency of a good but not linear set union algorithm. J. ACM 22(2), 215–225 (1975)

    Article  MathSciNet  MATH  Google Scholar 

  27. Tarjan, R.E., Leeuwen, J.V.: Worst-case analysis of set union algorithms. J. ACM 31(2), 245–281 (1984)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Acknowledgments

We would like to thank our editor and the anonymous referees for their valuable comments, which greatly improved this paper. This work was supported in part by the Grant-in-Aid for the National Natural Science Foundation of China under Grant No. 61471227, the Scientific Research (C) of the Ministry of Education, Science, Sports and Culture of Japan under Grant No. 26330200, and the Scientific Research of Shaanxi Province of China under Grant No. 2014K11-02-01-13.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Xiwei Ren.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

He, L., Ren, X., Zhao, X. et al. An efficient two-scan algorithm for computing basic shape features of objects in a binary image. J Real-Time Image Proc 16, 1277–1287 (2019). https://doi.org/10.1007/s11554-016-0626-7

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11554-016-0626-7

Keywords

Navigation