distanceTransform function

(Mat, Mat) distanceTransform(
  1. Mat src,
  2. int distanceType,
  3. int maskSize,
  4. int labelType, {
  5. Mat? dst,
  6. Mat? labels,
})

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

distanceType: DistanceTypes maskSize: DistanceTransformMasks labelType: DistanceTransformLabelTypes

For further details, please see: https:///docs.opencv.org/master/d7/d1b/group__imgproc__misc.html#ga8a0b7fdfcb7a13dde018988ba3a43042

Implementation

(Mat dst, Mat labels) distanceTransform(
  Mat src,
  int distanceType,
  int maskSize,
  int labelType, {
  Mat? dst,
  Mat? labels,
}) {
  dst ??= Mat.empty();
  labels ??= Mat.empty();
  cvRun(
    () => cimgproc.cv_distanceTransform(
      src.ref,
      dst!.ref,
      labels!.ref,
      distanceType,
      maskSize,
      labelType,
      ffi.nullptr,
    ),
  );
  return (dst, labels);
}