Table of Contents

Method DistanceTransform

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

DistanceTransform(InputArray, OutputArray, DistanceTypes, DistanceTransformMasks, int)

computes the distance transform map

public static void DistanceTransform(InputArray src, OutputArray dst, DistanceTypes distanceType, DistanceTransformMasks maskSize, int dstType = 4)

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.

distanceType DistanceTypes

Type of distance

maskSize DistanceTransformMasks

Size of the distance transform mask, see #DistanceTransformMasks. 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.

dstType int

Type of output image. It can be MatType.CV_8U or MatType.CV_32F. Type CV_8U can be used only for the first variant of the function and distanceType == #DIST_L1.