calculates the distance transform of an edge image
DistanceImage = DistanceTransform(EdgeImage);
2D matrix of type boolean
2D matrix of type uint8, has the same size as EdgeImage
This function calculates the distance transform of an edge image.
global IPD_PATH; RGB = ReadImage(IPD_PATH + 'demos\teaset.png'); Image = RGB2Gray(RGB); global EDGE_SOBEL; Gradient = EdgeFilter(Image, EDGE_SOBEL); EdgeImage = ~SegmentByThreshold(Gradient, 60); DistanceImage = DistanceTransform(EdgeImage); figure(); ShowImage(DistanceImage, 'Result of Distance Transform', jetcolormap(256)); | ![]() | ![]() |