Table of Contents

Method DistanceTransformWithLabels

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

DistanceTransformWithLabels(InputArray, OutputArray, OutputArray, DistanceTypes, DistanceTransformMasks, DistanceTransformLabelTypes)

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

public static void DistanceTransformWithLabels(InputArray src, OutputArray dst, OutputArray labels, DistanceTypes distanceType, DistanceTransformMasks maskSize, DistanceTransformLabelTypes labelType = DistanceTransformLabelTypes.CComp)

Parameters

src InputArray

8-bit, single-channel (binary) source image.

dst OutputArray

Output image with calculated distances. It is a 8-bit or 32-bit floating-point, single-channel image of the same size as src.

labels OutputArray

Output 2D array of labels (the discrete Voronoi diagram). It has the type CV_32SC1 and the same size as src.

distanceType DistanceTypes

Type of distance

maskSize DistanceTransformMasks

Size of the distance transform mask, see #DistanceTransformMasks. #DIST_MASK_PRECISE is not supported by this variant. In case of the #DIST_L1 or #DIST_C distance type, the parameter is forced to 3 because a 3x3 mask gives the same result as 5x5 or any larger aperture.

labelType DistanceTransformLabelTypes

Type of the label array to build