Connected components labeling - algorithms in Mathematica, Java, C++ and C#.
Mariusz Jankowski Department of Electrical Engineering, University of Southern Maine, USA
[email protected]
Jens-Peer Kuska Department for Computer Graphics and Image Processing, University of Leipzig, Germany
[email protected]
2
1.
Chapter Title
Abstract
Image segmentation is an important processing step in numerous image processing applications. A multitude of techniques and algorithms fall into this broad category from simple thresholding, to edge-detection, connected components labeling and watershed transformations. Of all these techniques, connected components labeling and analysis is a relatively simple grouping algorithm that has been used for many years to isolate, measure and identify potential object regions in an image. It is widely used in industrial and biomedical applications where an image often consists of objects against a contrasting background. Such images may be binarized yielding data that retains useful shape and size information of the objects under observation. The labeling operation assigns a unique name or number to all 1-pixels that belong to the same connected component of the image. As a result of the labeling, individual components can be extracted from the image programmatically and therefore be available for further processing and analysis. A variety of region labeling algorithms have been described in the literature. In this paper we will demonstrate Mathematica implementations of selected algorithms. Several alternative implementations will be presented. The unique contribution of this paper lies in a detailed discussion of realizations of a selected algorithm in several compiled languages and their performance comparison. The languages include C++, Java, and C#.
2.
Component Labeling Algorithms
This paper discusses several alternative implementations of connected components labeling algorithms in Mathematica. The main objective of the paper is to illustrate with a useful image processing example, the many implementation alternatives available to the Mathematica user and discuss their advantages and disadvantages. Particular attention will be paid to the problem of computational speed. Finding the connected components in a binary image can be done in several different ways [ Haralick 1992, Glassner 2001, Rosenfeld 1966]. The simplest method is to iteratively replace each label with the minimum of it's 8-connected neighborhood [Haralick 1992]. The algorithm begins with an initial labeling of all 1-pixels and ends when no more replacements can be made. It has a very simple Mathematica implementation.
Chapter Title
3
$nncell = 88−1, 0