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

DeleteSmallComponents

DeleteSmallComponents[image]
replaces small connected components in a binary image image with background pixels.
DeleteSmallComponents[m]
replaces positive integers in a label matrix m with if their tally is small.
DeleteSmallComponents
replaces components consisting of n or less elements.
  • The option setting CornerNeighbors->False treats only the four pixels in the coordinate directions as adjacent.
  • The default setting is Method, corresponding to cluster variance maximization.
  • Possible settings for the Method option include:
"Cluster"cluster variance maximization (Otsu's algorithm)
"Mean"use the mean of component sizes as the threshold
"Median"use the median of component sizes as the threshold
Delete small components in a binary image:
Remove small components from a label matrix:
Delete small components in a binary image:
In[1]:=
Click for copyable input
Out[1]=
 
Remove small components from a label matrix:
In[1]:=
Click for copyable input
Out[1]//MatrixForm=
Remove components with less than 1000 pixels:
Delete small components from a label matrix:
Use the default cluster variance maximization method:
Delete components smaller than the mean component size:
Clean small foreground and background components:
Delete smaller components resulting from image segmentation:
New in 8