minMaxLocAsync function

Future<(double, double, Point, Point)> minMaxLocAsync(
  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

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