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 0 if their tally is small.

DeleteSmallComponents[,n]

replaces components consisting of n or fewer elements.

Details and Options

  • DeleteSmallComponents works with arbitrary 2D and 3D images or label matrices.
  • The following options can be given:
  • CornerNeighborsTruewhether to include corner neighbors
    MethodAutomaticmethod to determine a size threshold
  • 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
  • The default setting is Method->"Cluster", corresponding to cluster variance maximization.

Examples

open allclose all

Basic Examples  (3)

Delete small components in a binary image:

In[1]:=
Click for copyable input
Out[1]=

Delete small components in a 3D 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=

Scope  (2)

Options  (2)

Applications  (2)

See Also

MorphologicalComponents  ComponentMeasurements  DeleteBorderComponents  SelectComponents

Introduced in 2010
(8.0)
| Updated in 2012
(9.0)