thresholdAsync function

Future<(double, Mat)> thresholdAsync(
  1. InputArray src,
  2. double thresh,
  3. double maxval,
  4. int type,
)

Threshold applies a fixed-level threshold to each array element.

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

Implementation

Future<(double, Mat dst)> thresholdAsync(
  InputArray src,
  double thresh,
  double maxval,
  int type,
) async =>
    cvRunAsync2((callback) => cimgproc.Threshold_Async(src.ref, thresh, maxval, type, callback),
        (completer, p, p1) {
      final rval = p.cast<ffi.Double>().value;
      calloc.free(p);
      completer.complete((rval, Mat.fromPointer(p1.cast<cimgproc.Mat>())));
    });