CvDistTransform Method (CvArr, CvArr, DistanceType, Int32) OpenCvSharp Class Library
Calculates distance to closest zero pixel for all non-zero pixels of source image.

Namespace:  OpenCvSharp
Assembly:  OpenCvSharp (in OpenCvSharp.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax

public static void DistTransform(
	CvArr src,
	CvArr dst,
	DistanceType distanceType,
	int maskSize
)

Parameters

src
Type: OpenCvSharpCvArr
Source 8-bit single-channel (binary) image.
dst
Type: OpenCvSharpCvArr
Output image with calculated distances (32-bit floating-point, single-channel).
distanceType
Type: OpenCvSharpDistanceType
Type of distance.
maskSize
Type: SystemInt32
Size of distance transform mask; can be 3, 5 or 0. In case of CV_DIST_L1 or CV_DIST_C the parameter is forced to 3, because 3×3 mask gives the same result as 5x5 yet it is faster. When mask_size==0, a different non-approximate algorithm is used to calculate distances.
See Also

Reference