solveCubicAsync function

Future<(int, Mat)> solveCubicAsync(
  1. InputArray coeffs, {
  2. OutputArray? roots,
})

SolveCubic finds the real roots of a cubic equation.

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

Implementation

Future<(int rval, Mat roots)> solveCubicAsync(InputArray coeffs, {OutputArray? roots}) async {
  roots ??= Mat.empty();
  final p = calloc<ffi.Int>();
  return cvRunAsync0(
    (callback) => ccore.cv_solveCubic(coeffs.ref, roots!.ref, p, callback),
    (c) {
      final rval = p.value;
      calloc.free(p);
      return c.complete((rval, roots!));
    },
  );
}