meanStdDevAsync function

Future<(Scalar, Scalar)> meanStdDevAsync(
  1. InputArray src, {
  2. InputArray? mask,
})

MeanStdDev calculates a mean and standard deviation of array elements.

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

Implementation

Future<(Scalar mean, Scalar stddev)> meanStdDevAsync(InputArray src, {InputArray? mask}) async {
  final mean = calloc<cvg.Scalar>();
  final stddev = calloc<cvg.Scalar>();
  return mask == null
      ? cvRunAsync0(
          (callback) => ccore.cv_meanStdDev(src.ref, mean, stddev, callback),
          (c) {
            return c.complete((Scalar.fromPointer(mean), Scalar.fromPointer(stddev)));
          },
        )
      : cvRunAsync0(
          (callback) => ccore.cv_meanStdDev_1(src.ref, mean, stddev, mask.ref, callback),
          (c) {
            return c.complete((Scalar.fromPointer(mean), Scalar.fromPointer(stddev)));
          },
        );
}