Distance Transform Separable by Mathematical Morphology in GPU

  • Francisco de Assis Zampirolli
  • Leonardo Filipe
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8258)


The Distance Transform (DT) is one of the classical operators in image processing, and can be used in Pattern Recognition and Data Mining, and there is currently a great demand for efficient parallel implementations on graphics cards, known as GPU. This paper presents simple and effective ways to implement the DT using decompositions of erosions with structuring functions implemented on GPU. The DT is equivalent to a morphological erosion of the binary image by a specific structuring function. However, this erosion can be decomposed by a sequence of erosions using small structuring functions. Classical and efficient algorithms of the DT are implemented on CPU. New 1D and 2D algorithms are implemented on GPU, using decomposition of structuring functions, inspired by implementations of convolution filters. All the GPU implementations used in this paper are known as brute-force, and even then present excellent results, comparable to the best CPU algorithms, which might contribute to future applications in image processing.


Distance Transform Mathematical Morphology GPU 


  1. 1.
    Banon, G.J.F., Barrera, J.: Decomposition of mappings between complete lattices by mathematical morphology, Part I: general lattices. Signal Processing 30, 299–327 (1993)CrossRefzbMATHGoogle Scholar
  2. 2.
    Borgefors, G.: Distance transformations in digital images. Computer Vision, Graphics and Image Processing 34, 344–371 (1986)CrossRefGoogle Scholar
  3. 3.
    Breu, H., Gil, J., Kirkpatrick, D., Werman, M.: Linear time euclidean distance transform algorithms. IEEE - TPAMI 17(5), 529–533 (1995)CrossRefGoogle Scholar
  4. 4.
    Danielsson, P.E.: Euclidean distance mapping. Computer Graphics and Image Processing 14, 227–248 (1980)CrossRefGoogle Scholar
  5. 5.
    Eggers, H.: Two fast euclidean distance transformations in z 2 based on sufficient propagation. In: Computer Vision and Image Understanding (1998)Google Scholar
  6. 6.
    Falcao, A.X., Stolfi, J., Lotufo, R.A.: The image foresting transform: theory, algorithms, and applications. IEEE Transactions Pattern Analysis and Machine Intelligence 26(1), 19–29 (2004)CrossRefGoogle Scholar
  7. 7.
    Heijmans, H.J.A.M.: Morphological Image Operators. Acad. Press, Boston (1994)Google Scholar
  8. 8.
    Huang, C.T., Mitchell, O.R.: A euclidean distance transform using grayscale morphology decomposition. IEEE Transactions on Pattern Analysis and Machine Intelligence 16, 443–448 (1994)CrossRefGoogle Scholar
  9. 9.
    Lotufo, R.A., Zampirolli, F.A.: Fast multidimensional parallel euclidean distance transform based on mathematical morphology. In: Proceedings of SIBGRAPI, pp. 100–105 (2001)Google Scholar
  10. 10.
    Podlozhnyuk, V.: Image convolution with cuda. In: nVidia (2007)Google Scholar
  11. 11.
    Ragnemalm, I.: Neighborhoods for distance transformations using ordered propagation. In: CVGIP: Image Understanding (1992)Google Scholar
  12. 12.
    Rosenfeld, A., Pfalz, J.L.: Distance functions on digital pictures. Pattern Recognition 1, 33–61 (1968)MathSciNetCrossRefGoogle Scholar
  13. 13.
    Schneider, J., Kraus, M., Westermann, R.: GPU-based real-time discrete euclidean distance transforms with precise error bounds. In: International Conference on Computer Vision Theory and Applications, pp. 435–442 (2009)Google Scholar
  14. 14.
    Sharaiha, Y., Christofides, N.: Graph-theoretic approach to distance transformations. Pattern Recognition Letters (1994)Google Scholar
  15. 15.
    Shih, F.Y.C., Mitchell, O.R.: A mathematical morphology approach to euclidean distance transformation. IEEE Trans. on Image Processing 1, 197–204 (1992)CrossRefGoogle Scholar
  16. 16.
    Vincent, L.: Morphological algorithms. Mathematical Morphology in Image Processing Edition. vol. Marcel-Dekker, ch. 8, pp. 255–288. E. Dougherty (September 1992)Google Scholar
  17. 17.
    Vincent, L., Soille, P.: Watersheds in digital spaces: an efficient algorithm based on immersion simulations. IEEE Transactions on Pattern Analysis and Machine Intelligence 13(6), 583–598 (1991)CrossRefGoogle Scholar
  18. 18.
    Vincent, L.: Exact euclidean distance function by chain propagations. In: IEEE Int. Computer Vision and Pattern Recog. Conf., Maui, HI, pp. 520–525 (June 1991)Google Scholar
  19. 19.
    Wang, X., Bertrand, G.: An algorithm for a generalized distance transformation based on minkowski operations. In: 9th International Conference on Pattern Recognition, vol. 2, pp. 1164–1168 (November 1988)Google Scholar
  20. 20.
    Zampirolli, F.A., Lotufo, R.A.: Classification of the distance transformation algorithms under the mathematical morphology approach. In: Proceedings of SIBGRAPI, pp. 292–299 (2000)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Francisco de Assis Zampirolli
    • 1
  • Leonardo Filipe
    • 1
  1. 1.Universidade Federal do ABCSão PauloBrazil

Personalised recommendations