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 {
  mask ??= Mat.empty();
  final minValP = calloc<ffi.Double>();
  final maxValP = calloc<ffi.Double>();
  final minIdxP = calloc<ffi.Int>();
  final maxIdxP = calloc<ffi.Int>();
  return cvRunAsync0(
    (callback) => ccore.cv_minMaxIdx(src.ref, minValP, maxValP, minIdxP, maxIdxP, mask!.ref, callback),
    (c) {
      final rval = (minValP.value, maxValP.value, minIdxP.value, maxIdxP.value);
      calloc.free(minValP);
      calloc.free(maxValP);
      calloc.free(minIdxP);
      calloc.free(maxIdxP);
      return c.complete(rval);
    },
  );
}