An efficient algorithm for finding all maximal square blocks in a matrix

  • Heinz Breu
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 382)


An efficient algorithm for computing the medial axis transform of an an m by n binary image, that is, an image represented as a matrix of ones and zeros with m rows and n columns, is developed. The medial axis transform is, effectively, the set of all maximal square blocks of ones in the image where a square block is maximal if it is not contained by any other square blocks of ones. The algorithm presented requires O(mn) time and O(n) space and runs in a single pass through the image. This property makes it ideally suited to processing, in real time, images obtained from a linear array scanner since the memory requirements do not grow as the image is scanned and the medial axis is generated as the image is scanned.

The algorithm is not only efficient in theory but practical as well; the algorithm has been implemented in four pages of fully commented C code.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    H. Blum, “A transformation for extracting new descriptors of shape”, in W. Wathen-Dunn, Ed., Models for the Perception of Speech and Visual Form, pp. 362–280, MIT Press, Cambridge, Mass. 1967.Google Scholar
  2. [2]
    A. Rosenfeld and A.C. Kak, Digital Picture Processing, Academic Press, 1982.Google Scholar
  3. [3]
    T. Wakayama, “A core-line tracing algorithm based on maximal square moving”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 4(1), pp.68–74, 1982.Google Scholar
  4. [4]
    L.J. Guibas, Editor, “Problems”, Journal of Algorithms, 3, pp. 362–380, 1982.Google Scholar
  5. [5]
    D. G. Kirkpatrick, “Efficient computation of continuous skeletons”, Proc. 20th Symposium on the Foundations of Computer Science, pp. 18–27, October 1979.Google Scholar
  6. [6]
    D.T. Lee, “Medial axis transformation of a planar shape”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 4(4), pp.363–369, 1982.Google Scholar
  7. [7]
    H. Breu, “An efficient digital medial axis transform under the L metric”, Hewlett Packard Labs Technical Report, in press, 1989.Google Scholar
  8. [8]
    R.E. Tarjan, “Amortized computational complexity”, SIAM J. Alg. Disc. Meth., 6(2), pp. 306–318, April 1985.Google Scholar
  9. [9]
    N. Ahuja and W. Hoff, “Augmented medial axis transform”, Seventh International Conference on Pattern Recognition, pp. 336–338, 1984.Google Scholar
  10. [10]
    A. Wu, S. Bhaskar, and A. Rosenfeld, “Computation of geometric properties from the medial axis transform in O(n log n) time”, Computer Vision, Graphics, and Image Processing, 34, pp. 76–92, 1982.Google Scholar
  11. [11]
    M. Garey and D. Johnson, Computers and Intractability: a Guide to the Theory of NP-Completeness, page 232, W.H. Freeman and Company, San Francisco, 1979.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1989

Authors and Affiliations

  • Heinz Breu
    • 1
  1. 1.Hewlett-Packard LaboratoriesPalo Alto

Personalised recommendations