Back to FabImage Studio website

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

cvDistanceTransform


Module: OpenCV

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

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

Errors

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

List of possible exceptions:

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

Complexity Level

This filter is available on Basic Complexity Level.