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[image, t] treats values above t as foreground. MorphologicalComponents[video, ...] computes connected components in frames of video.
Find the connected components in a binary image: In[1]:=MorphologicalComponents[]// Colorize Out[1]=
CornerNeighbors | Method | Padding
MorphologicalPerimeter | ComponentMeasurements | SelectComponents | WatershedComponents | ClusteringComponents | Colorize | HighlightImage | HighlightVideo | VideoObjectTracking
introduced in Version 7 (November 2008) last modified in Version 14.2 (January 2025)