solvePnPRansacAsync function

Future<(bool, Mat, Mat, Mat)> solvePnPRansacAsync(
  1. InputArray objectPoints,
  2. InputArray imagePoints,
  3. InputArray cameraMatrix,
  4. InputArray distCoeffs, {
  5. OutputArray? rvec,
  6. OutputArray? tvec,
  7. bool useExtrinsicGuess = false,
  8. int iterationsCount = 100,
  9. double reprojectionError = 8.0,
  10. double confidence = 0.99,
  11. OutputArray? inliers,
  12. int flags = SOLVEPNP_ITERATIVE,
})

Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.

https://docs.opencv.org/4.11.0/d9/d0c/group__calib3d.html#ga50620f0e26e02caa2e9adc07b5fbf24e

Implementation

Future<(bool rval, Mat rvec, Mat tvec, Mat inliers)> solvePnPRansacAsync(
  InputArray objectPoints,
  InputArray imagePoints,
  InputArray cameraMatrix,
  InputArray distCoeffs, {
  OutputArray? rvec,
  OutputArray? tvec,
  bool useExtrinsicGuess = false,
  int iterationsCount = 100,
  double reprojectionError = 8.0,
  double confidence = 0.99,
  OutputArray? inliers,
  int flags = SOLVEPNP_ITERATIVE,
}) async {
  rvec ??= Mat.empty();
  tvec ??= Mat.empty();
  inliers ??= Mat.empty();
  final prval = calloc<ffi.Bool>();
  return cvRunAsync0(
      (callback) => ccalib3d.cv_solvePnPRansac(
            objectPoints.ref,
            imagePoints.ref,
            cameraMatrix.ref,
            distCoeffs.ref,
            rvec!.ref,
            tvec!.ref,
            useExtrinsicGuess,
            iterationsCount,
            reprojectionError,
            confidence,
            inliers!.ref,
            flags,
            prval,
            callback,
          ), (c) {
    final rval = prval.value;
    calloc.free(prval);
    return c.complete((rval, rvec!, tvec!, inliers!));
  });
}