distanceTransformAsync function

Future<(Mat, Mat)> distanceTransformAsync(
  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

Future<(Mat dst, Mat labels)> distanceTransformAsync(
  Mat src,
  int distanceType,
  int maskSize,
  int labelType, {
  Mat? dst,
  Mat? labels,
}) {
  dst ??= Mat.empty();
  labels ??= Mat.empty();
  return cvRunAsync0(
    (callback) => cimgproc.cv_distanceTransform(
      src.ref,
      dst!.ref,
      labels!.ref,
      distanceType,
      maskSize,
      labelType,
      callback,
    ),
    (c) {
      return c.complete((dst!, labels!));
    },
  );
}