minMaxIdxAsync function

Future<(double, double, int, int)> minMaxIdxAsync(
  1. InputArray src, {
  2. InputArray? mask,
})

MinMaxIdx finds the global minimum and maximum in an array.

For further details, please see: https://docs.opencv.org/master/d2/de8/group__core__array.html#ga7622c466c628a75d9ed008b42250a73f

Implementation

Future<(double minVal, double maxVal, int minIdx, int maxIdx)> minMaxIdxAsync(
  InputArray src, {
  InputArray? mask,
}) async =>
    cvRunAsync4(
        (callback) => mask == null
            ? ccore.core_MinMaxIdx_Async(src.ref, callback)
            : ccore.core_MinMaxIdx_Mask_Async(src.ref, mask.ref, callback), (c, p, p1, p2, p3) {
      final minv = p.cast<ffi.Double>().value;
      calloc.free(p);
      final maxv = p1.cast<ffi.Double>().value;
      calloc.free(p1);
      final mini = p2.cast<ffi.Int>().value;
      calloc.free(p2);
      final maxi = p3.cast<ffi.Int>().value;
      calloc.free(p3);
      c.complete((minv, maxv, mini, maxi));
    });