distance transform for binary image and gray-scale image.