minMaxIdx function

(double, double, int, int) minMaxIdx(
  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

(double minVal, double maxVal, int minIdx, int maxIdx) minMaxIdx(
  InputArray src, {
  InputArray? mask,
}) {
  mask ??= Mat.empty();
  final minValP = calloc<ffi.Double>();
  final maxValP = calloc<ffi.Double>();
  final minIdxP = calloc<ffi.Int>();
  final maxIdxP = calloc<ffi.Int>();
  cvRun(() => ccore.cv_minMaxIdx(src.ref, minValP, maxValP, minIdxP, maxIdxP, mask!.ref, ffi.nullptr));
  final rval = (minValP.value, maxValP.value, minIdxP.value, maxIdxP.value);
  calloc.free(minValP);
  calloc.free(maxValP);
  calloc.free(minIdxP);
  calloc.free(maxIdxP);
  return rval;
}