vdist3d(1) perform a 3D distance transform


vdist3d [-option ...] [infile] [outfile]


vdist3d performs a 3D distance transform on the source image to produce a file of a distance transformed destination image. Each pixel in the output image contains the distance to the nearest feature element measured in a Euclidean or Chamfer metric. If needed, three images containing the addresses of the nearest foreground pixels will also be produced.

The input image must be of type VBit. The output image will be of type VFloat. If present, the vector images will be of type VShort.

Input and output files can be specified on the command line or allowed to default to stdin and stdout.

If the metric is euclidean, and no vectors are needed, the algorithm used is Saito/Toriwaki's algorithm. If the metric is euclidean, but vectors are needed, then Daniellson's algorithm is used. For the chamfer metric the algorithm by Borgefors is used. Note that Daniellson's algorithm is the most expensive (both w.r.t computing time as well as w.r.t space). The second most expensive algorithm is Saito/Toriwaki's. However, it is not possible to obtain the distance vectors from this algorithm. The cheapest is Borgefors's, which also does not yield the distance vectors.

Note that in some rare cases, Daniellson's algorithm fails. In that case, use Saito's algorithm (which always works) and do without the distance vectors.


Toyofumi Saito, Jun-Ichiro Toriwaki, New algorithms for euclidean distance transformation of a n-dimensional picture with applications, Pattern Recognition, Vol. 27, No. 11, pp 1551-1565, 1994.

Gunilla Borgefors, "Distance Transformations in Arbitrary Dimensions", Computer Vision, Graphics and Image Processing, Vol 27, pp. 321-345, 1984.

P.-E. Daniellson, "Euclidean Distance Mapping", Computer Graphics and IMage Processing, Vol. 14, pp. 227-248, 1980.


vdist3d accepts the following options in any order:
Causes vdist3d to print out a message describing its options.
-metric euclidean/chamfer
Determines which metric to use.
-vector yes/no
Determines whether or not a vector image will be produced. Default: no.


Gabriele Lohmann <[email protected]>