The distance transform is an operator normally only applied to binary images. The result of the transform is a graylevel image that looks similar to the input image, except that the graylevel intensities of points inside foreground regions are changed to show the distance to the closest boundary from each point.
There is a dual to the distance transform which provides the distance for the backgroundregion rather than the foreground region. It is equivalent to inverting the image and applying the regular distance transform.
There are at least the following three distance metrics:
Before | ||||||
After |