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 void DistTransform( CvArr dst, DistanceType distanceType, int maskSize, float[] mask, CvArr labels )
Parameters
- 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. - mask
- Type: SystemSingle
User-defined mask in case of user-defined distance, it consists of 2 numbers (horizontal/vertical shift cost, diagonal shift cost) in case of 3x3 mask and 3 numbers (horizontal/vertical shift cost, diagonal shift cost, knight’s move cost) in case of 5x5 mask. - labels
- Type: OpenCvSharpCvArr
The optional output 2d array of labels of integer type and the same size as src and dst, can now be used only with mask_size==3 or 5.
See Also