This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

MorphologicalComponents

Updated In 8 Graphic
MorphologicalComponents[image]
gives an array in which each pixel of image is replaced by an integer index representing the connected foreground image component in which the pixel lies.
MorphologicalComponents
treats values above t as foreground.
  • The option setting CornerNeighbors->False treats only the four pixels in the coordinate directions as adjacent.
"Connected"labels connected components (default)
"Nested"labels nested connected components
"Convex"labels objects within non-overlapping convex regions
"ConvexHull"finds non-overlapping convex hulls
"BoundingBox"finds non-overlapping bounding boxes
"BoundingDisk"finds non-overlapping bounding disks
Find the connected components in a binary image:
Connected component labels:
Find the connected components in a binary image:
In[1]:=
Click for copyable input
Out[1]=
 
Connected component labels:
In[1]:=
Click for copyable input
Out[1]//MatrixForm=
8-connected objects:
4-connected objects:
Find the bounding boxes of connected components:
Find the non-overlapping bounding disks:
Find components whose convex hulls do not overlap:
Non-overlapping convex components:
Label each component the same as its embedding component:
Count the number of pixels in each connected component of an image:
Find connected regions in a map:
New in 7 | Last modified in 8