This Article 
 Bibliographic References 
 Add to: 
Efficient Dilation, Erosion, Opening, and Closing Algorithms
December 2002 (vol. 24 no. 12)
pp. 1606-1617

Abstract—We propose an efficient and deterministic algorithm for computing the one-dimensional dilation and erosion (max and min) sliding window filters. For a p\hbox{-}{\rm{element}} sliding window, our algorithm computes the 1D filter using 1.5 + o(1) comparisons per sample point. Our algorithm constitutes a deterministic improvement over the best previously known such algorithm, independently developed by van Herk and by Gil and Werman (the HGW algorithm). Also, the results presented in this paper constitute an improvement over the Gevorkian et al. (GAA) variant of the HGW algorithm. The improvement over the GAA variant is also in the computation model. The GAA algorithm makes the assumption that the input is independently and identically distributed (the i.i.d. assumption), whereas our main result is deterministic. We also deal with the problem of computing the dilation and erosion filters simultaneously, as required, e.g., for computing the unbiased morphological edge. In the case of i.i.d. inputs, we show that this simultaneous computation can be done more efficiently then separately computing each. We then turn to the opening filter, defined as the application of the min filter to the max filter and give an efficient algorithm for its computation. Specifically, this algorithm is only slightly slower than the computation of just the max filter. The improved algorithms are readily generalized to two dimensions (for a rectangular window), as well as to any higher finite dimension (for a hyperbox window), with the number of comparisons per window remaining constant. For the sake of concreteness, we also make a few comments on implementation considerations in a contemporary programming language.

[1] E. Breen and P. Soille, “Generalization of van Herk Recursive Erosion/Dilation Algorithm to Lines at Arbitrary Angles,” Proc. DICTA '93: Digital Image Computing: Techniques and Applications, Dec. 1993.
[2] R.W. Brockett and P. Maragos, “Evolution Equations for Continuous-Scale Morphology,” Proc. IEEE Int'l Conf. Acoustics, Speech, and Signal Processing, pp. 1-4, Mar. 1992.
[3] R.W. Brockett and P. Maragos, “Evolution Equations for Continuous-Scale Morphological Filtering,” IEEE Trans. Signal Processing, vol. 42, no. 12, pp. 3377-3386, 1994.
[4] B. Chaudhuri, “An Efficient algorithm for Running Window Pel Grey Level Ranking in 2D Images,” Pattern Recognition Letters, vol. 11, no. 2, pp. 77-80, 1990.
[5] T.H. Cormen,C.E. Leiserson, and R.L. Rivest,Introduction to Algorithms.Cambridge, Mass.: MIT Press/McGraw-Hill, 1990.
[6] P. Danielson, “Euclidean Distance Mapping,” Computer Graphics and Image Processing, vol. 14, pp. 227-248, 1980.
[7] M. Davis, “Efficient Methods of Performing Morphological Operations,” US patent US5960127, 1999.
[8] L. Dorst and R. van den Boomgaard, “Morphological Signal Processing and the Slope Transform,” Signal Processing, vol. 38, pp. 79-98, 1994.
[9] D. Gevorkian, J. Astola, and S. Atourian, “Improving Gil-Werman Algorithm for Running Min and Max Filters,” IEEE Trans. Pattern Analysis and Machine Intelligence, vol. 19, no. 5, pp. 526-529, May 1997.
[10] J.Y. Gil and Z. Gutterman, “Compile Time Symbolic Derivation with C++ Templates,” Proc. Fourth Conf. Object-Oriented Technologies and Systems (COOTS '98), May 1998.
[11] J.Y. Gil and R. Kimmel, “Efficient Dilation, Erosion, Opening and Closing Algorithms,” Mathematical Morphology and Its Applications to Image and Signal Processing, J. Goutsias, L. Vincent, and D.S. Bloomberg, eds., pp. 301-310, Boston: Kluwer Academic, 2000.
[12] J. Gil and M. Werman, “Computing 2D Min, Median, and Max Filters,” IEEE Trans. Pattern Analysis and Machine Intelligence, vol. 15, no. 5, pp. 504-507, May 1993.
[13] T. Huang, G. Yang, and G. Tang, "A Fast Two-Dimensional Median Filtering Algorithm," IEEE Trans. Acoustics, Speech, and Signal Processing, vol. 27, pp. 13-18, 1979.
[14] B. W. Kernighan and D. M. Ritchie,The C Programming Language. Englewood Cliffs, NJ: Prentice-Hall, 1988, 2nd ed.
[15] J.S.J. Lee, R.M. Haralick, and L.G. Shapiro, “Morphological Edge Detection,” Int'l J. Robotics and Automation, vol. RA-3, no. 2, pp. 142-156, 1987.
[16] W.D. Wallis, P. Shoubridge, M. Kraetz, and D. Ray, “Graph Distances Using Graph Union,” Pattern Recognition Letters, vol. 22, nos. 6-7, pp. 701-704, 2001.
[17] I. Pitas, "Fast Algorithms for Running Ordering and Max/Min Calculation," IEEE Trans. Circuits and Systems, vol. 36, no. 6, pp. 795-804, June 1989.
[18] J. Rivest, P. Soille, and S. Beucher, “Morphological Gradients,” J. Electronic Imaging, vol. 2, no. 4, pp. 326-336, 1993.
[19] G. Sapiro, R. Kimmel, D. Shaked, B. Kimia, and A.M. Bruckstein, “Implementing Continuous-Scale Morphology via Curve Evolution,” Pattern Recognition, vol. 26, no. 9, pp. 1363-1372, 1993.
[20] J. Serra, Image Analysis and Mathematical Morphology. New York: Academic Press, 1982.
[21] P. Soille, Morphological Image Analysis. Berlin, Heidelberg, New York: Springer-Verlag, 1999.
[22] P. Soille, E. Breen, and R. Jones, “Recursive Implementation of Erosions and Dilations Along Discrete Lines at Arbitrary Angles,” IEEE Trans. Pattern Analysis and Machine Intelligence, vol. 18, no. 5, pp. 562-567, May 1996.
[23] B. Stroustrup, The C++ Programming Language. third ed. Addison-Wesley, 1997.
[24] Geometry-Driven Diffusion in Computer Vision, B.M. ter Haar Romeny, ed. Kluwer, 1994.
[25] M. van Herk, “A Fast Algorithm for Local Minimum and Maximum Filters on Rectangular and Octogonal Kernels,” Pattern Recognition Letters, vol. 13, pp. 517-521, 1992.

Index Terms:
Mathematical morphology, running maximum filter, min-max filter, computational efficiency.
Joseph (Yossi) Gil, Ron Kimmel, "Efficient Dilation, Erosion, Opening, and Closing Algorithms," IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 24, no. 12, pp. 1606-1617, Dec. 2002, doi:10.1109/TPAMI.2002.1114852
Usage of this product signifies your acceptance of the Terms of Use.