Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » Miscellaneous Image Transformations » cvDistanceTransform

cvDistanceTransform


Calculates the distance to the closest zero pixel for each pixel of the source image.

Name Type Range Description
inSrc Image UINT8, single-channel input image. Treated as binary.
inDistType CvDistanceType Type of distance.
inMaskSize Integer 3 - 5 Size of the distance transform mask. It can be 3 or 5.
inMaskPrecise Bool
outLabels Image output 2D array of labels (the discrete Voronoi diagram)
outDst Image Output image with calculated distances.

Errors

This filter can throw an exception to report error. Read how to deal with errors here: Error Handling

Error type Description
DomainError Input image must be UINT8 single-channel in cvDistanceTransform.
DomainError inMaskSize must be equal 3 or 5.
DomainError Distance type must be one of DIST_L1, DIST_L2 or DIST_C in cvDistanceTransform.

Complexity Level

This filter is available on Basic Complexity Level.