Abstract
Removing noise in a given binary image is a common operation. A generalization of the operation is to erase an arbitrarily specified component by reversing pixel values in the component. This paper shows that this operation can be done without using any data structure like a stack or queue, or more exactly using only constant extra memory (consisting of a constant number of words of O(log n) bits for an image of n pixels) in O(mlog m) time for a component consisting of m pixels. This is an in-place algorithm, but the image matrix cannot be used as work space since it has just one bit for each pixel. Whenever we flip a pixel value in a target component, the component shape is also deformed, which causes some difficulty. The main idea for our constant work space algorithm is to deform a component so that its connectivity is preserved.
Similar content being viewed by others
References
Asano, T., Bitou, S., Motoki, M., Usui, N.: In-place algorithm for image rotation. In: Proc. ISAAC 2007, Sendai, Dec. 2007, pp. 704–715 (2007)
Asano, T.: Constant-working-space image scan with a given angle. In: Proc. 24th European Workshop on Computational Geometry, Nancy, France, pp. 165–168 (2008)
Asano, T., Bereg, S., Kirkpatrick, D.: Finding nearest larger neighbors: a case study in algorithm design and analysis. In: Albers, S., Alt, H., Naeher, S. (eds.) Efficient Algorithms. Lecture Notes in Computer Science, pp. 249–260. Springer, Berlin (2009)
Asano, T., Tanaka, H.: Constant-working space algorithm for connected components labeling. Technical report, Special Interest Group on Computation, IEICE of Japan, 2008
Bose, P., Morin, P.: An improved algorithm for subdivision traversal without extra storage. Int. J. Comput. Geom. Appl. 12(4), 297–308 (2002)
Brönnimann, H., Chen, E.Y., Chan, T.M.: Towards in-place geometric algorithms and data structures. In: Proc. 20th Annual ACM Symposium on Computational Geometry, pp. 239–246 (2004)
de Berg, M., van Kreveld, M., van Oostrum, R., Overmars, M.: Simple traversal of a subdivision without extra storage. Int. J. Geogr. Inf. Sci. 11(4), 359–373 (1997)
Klette, R., Rosenfeld, A.: Digital Geometry: Geometric Methods for Digital Picture Analysis. Elsevier, Amsterdam (2004)
Kwok, P.: A thinning algorithm by contour generation. Commun. ACM, 31(11), 1314–1324 (1988)
Lam, L., Lee, S.-W., Suen, C.Y.: Thinning methodologies—a comprehensive survey. IEEE Trans. Pattern Anal. Mach. Intell. 14(9), 869–885 (1992)
Malgouyresa, R., Moreb, M.: On the computational complexity of reachability in 2D binary images and some basic problems of 2D digital topology. Theor. Comput. Sci. 283, 67–108 (2002)
Rosenfeld, A.: Connectivity in digital pictures. J. ACM 17(3), 146–160 (1970)
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Asano, T. In-place Algorithm for Erasing a Connected Component in a Binary Image. Theory Comput Syst 50, 111–123 (2012). https://doi.org/10.1007/s00224-011-9335-6
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00224-011-9335-6