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

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.
  • DistanceTransform gives an Image object in which the value of each pixel is the absolute Euclidean distance in pixels to the nearest pixel of background.
  • For multichannel images, DistanceTransform operates on the intensity averaged over all channels.
  • The following option can be given:
DistanceFunctionEuclideanDistancedistance metric function
Create a binary image:
Compute its distance transform and normalize the result:
Distance transform of random disks:
Create a binary image:
In[1]:=
Click for copyable input
Out[1]=
Compute its distance transform and normalize the result:
In[2]:=
Click for copyable input
Out[2]=
 
Distance transform of random disks:
In[1]:=
Click for copyable input
Out[1]=
Apply a LoG filter to the output of a distance transform:
New in 7