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


Updated In 8 Graphic
gives the distance transform of image, in which the value of each pixel is replaced by its distance to the nearest background pixel.
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
Distance transform of a binary image:
Distance transform of a binary image:
Click for copyable input
Distance transform of a color image:
Apply a LoG filter to the output of a distance transform:
Ultimate erosion of a binary image:
New in 7 | Last modified in 8