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 {
  final minValP = calloc<ffi.Double>();
  final maxValP = calloc<ffi.Double>();
  final minIdxP = calloc<ffi.Int>();
  final maxIdxP = calloc<ffi.Int>();
  return cvRunAsync0<(double, double, int, int)>(
    (callback) => mask == null
        ? cffi.core_MinMaxIdx_Async(src.ref, minValP, maxValP, minIdxP, maxIdxP, callback)
        : cffi.core_MinMaxIdx_Mask_Async(src.ref, mask.ref, minValP, maxValP, minIdxP, maxIdxP, callback),
    (c) {
      final ret = (minValP.value, maxValP.value, minIdxP.value, maxIdxP.value);
      calloc.free(minValP);
      calloc.free(maxValP);
      calloc.free(minIdxP);
      calloc.free(maxIdxP);
      c.complete(ret);
    },
  );
}