minMaxLoc function

(double, double, Point, Point) minMaxLoc(
  1. InputArray src, {
  2. InputArray? mask,
})

MinMaxLoc finds the global minimum and maximum in an array.

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

Implementation

(double minVal, double maxVal, Point minLoc, Point maxLoc) minMaxLoc(InputArray src, {InputArray? mask}) {
  mask ??= Mat.empty();
  final minValP = calloc<ffi.Double>();
  final maxValP = calloc<ffi.Double>();
  final minLocP = calloc<cvg.CvPoint>();
  final maxLocP = calloc<cvg.CvPoint>();
  cvRun(() => ccore.cv_minMaxLoc(src.ref, minValP, maxValP, minLocP, maxLocP, mask!.ref, ffi.nullptr));
  final rval = (minValP.value, maxValP.value, Point.fromPointer(minLocP), Point.fromPointer(maxLocP));
  calloc.free(minValP);
  calloc.free(maxValP);
  return rval;
}