Name

DistanceTransform — calculates the distance transform of an edge image

Calling Sequence

DistanceImage = DistanceTransform(EdgeImage);

Parameters

EdgeImage

2D matrix of type boolean

DistanceImage

2D matrix of type uint8, has the same size as EdgeImage

Description

This function calculates the distance transform of an edge image.

Examples

RGB = ReadImage('contrib\IPD-5.0\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));

See Also

EdgeFilter, Watershed