WOLFRAM

replaces small connected components in a binary image image with background pixels.

replaces positive integers in a label matrix m with 0 if their tally is small.

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
    Method Automaticmethod 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)Summary of the most common use cases

Delete small components in a binary image:

Out[1]=1

Delete small components in a 3D image:

Out[1]=1

Remove small components from a label matrix:

Scope  (2)Survey of the scope of standard use cases

Remove components with fewer than 1000 pixels:

Out[1]=1

Delete small components from a label matrix:

Options  (2)Common values & functionality for each option

Method  (2)

Use the default cluster variance maximization method:

Out[1]=1

Delete components smaller than the mean component size:

Out[1]=1
Out[2]=2

Applications  (2)Sample problems that can be solved with this function

Clean small foreground and background components:

Out[1]=1

Delete smaller components resulting from image segmentation:

Out[1]=1
Wolfram Research (2010), DeleteSmallComponents, Wolfram Language function, https://reference.wolfram.com/language/ref/DeleteSmallComponents.html (updated 2012).
Wolfram Research (2010), DeleteSmallComponents, Wolfram Language function, https://reference.wolfram.com/language/ref/DeleteSmallComponents.html (updated 2012).

Text

Wolfram Research (2010), DeleteSmallComponents, Wolfram Language function, https://reference.wolfram.com/language/ref/DeleteSmallComponents.html (updated 2012).

Wolfram Research (2010), DeleteSmallComponents, Wolfram Language function, https://reference.wolfram.com/language/ref/DeleteSmallComponents.html (updated 2012).

CMS

Wolfram Language. 2010. "DeleteSmallComponents." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012. https://reference.wolfram.com/language/ref/DeleteSmallComponents.html.

Wolfram Language. 2010. "DeleteSmallComponents." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012. https://reference.wolfram.com/language/ref/DeleteSmallComponents.html.

APA

Wolfram Language. (2010). DeleteSmallComponents. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DeleteSmallComponents.html

Wolfram Language. (2010). DeleteSmallComponents. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DeleteSmallComponents.html

BibTeX

@misc{reference.wolfram_2025_deletesmallcomponents, author="Wolfram Research", title="{DeleteSmallComponents}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/DeleteSmallComponents.html}", note=[Accessed: 05-June-2025 ]}

@misc{reference.wolfram_2025_deletesmallcomponents, author="Wolfram Research", title="{DeleteSmallComponents}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/DeleteSmallComponents.html}", note=[Accessed: 05-June-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_deletesmallcomponents, organization={Wolfram Research}, title={DeleteSmallComponents}, year={2012}, url={https://reference.wolfram.com/language/ref/DeleteSmallComponents.html}, note=[Accessed: 05-June-2025 ]}

@online{reference.wolfram_2025_deletesmallcomponents, organization={Wolfram Research}, title={DeleteSmallComponents}, year={2012}, url={https://reference.wolfram.com/language/ref/DeleteSmallComponents.html}, note=[Accessed: 05-June-2025 ]}