Pruning

Pruning[image]

removes the outermost branches of thin objects in image by setting their values to black.

Pruning[image,n]

removes branches that are at most n pixels long.

Pruning[image,{n}]

removes n pixels from each branch.

Pruning[image,n,t]

treats values above t as foreground.

Details and Options

  • Morphological pruning is typically applied after morphological thinning.
  • Pruning works with binary, grayscale, and multichannel images, as well as real matrices.
  • Pruning takes a Padding option that specifies the values to assume for pixels outside the image. The default setting is Padding->0.

Examples

open allclose all

Basic Examples  (4)

Prune the outermost branches:

Prune branches that are no longer than 35 pixels:

Prune 35 pixels from branches:

Prune all branches:

Scope  (1)

Apply pruning to a numeric array of data:

Applications  (3)

Count the legs of a centipede:

Compute the difference between skeleton and pruned skeleton:

Count of legs would be equivalent to the number of pruned branches:

Find the loops of a graph:

Iteratively prune an image:

Neat Examples  (1)

Solve a maze puzzle by thinning all paths and pruning dead ends:

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

Text

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

CMS

Wolfram Language. 2010. "Pruning." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Pruning.html.

APA

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

BibTeX

@misc{reference.wolfram_2024_pruning, author="Wolfram Research", title="{Pruning}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/Pruning.html}", note=[Accessed: 21-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_pruning, organization={Wolfram Research}, title={Pruning}, year={2010}, url={https://reference.wolfram.com/language/ref/Pruning.html}, note=[Accessed: 21-December-2024 ]}