DistanceTransform

DistanceTransform[image]

gives the distance transform of image, in which the value of each pixel is replaced by its distance to the nearest background pixel.

DistanceTransform[image,t]

treats values above t as foreground.

Details and Options

Examples

open allclose all

Basic Examples  (2)

Distance transform of a binary image:

Distance transform of a 3D image:

Scope  (1)

Distance transform of a color image:

Options  (2)

DistanceFunction  (1)

Padding  (1)

By default, Padding->1 is assumed:

Use zero padding:

Applications  (3)

Find the radius of the thickest branch in a tree:

Apply a LoG filter to the output of a distance transform:

Ultimate erosion of a binary image:

Introduced in 2008
 (7.0)
 |
Updated in 2010
 (8.0)
2014
 (10.0)