solvePnPGenericAsync function

Future<(int, VecMat, VecMat, Mat)> solvePnPGenericAsync(
  1. InputArray objectPoints,
  2. InputArray imagePoints,
  3. InputArray cameraMatrix,
  4. InputArray distCoeffs, {
  5. VecMat? rvecs,
  6. VecMat? tvecs,
  7. bool useExtrinsicGuess = false,
  8. int flags = SOLVEPNP_ITERATIVE,
  9. InputArray? rvec,
  10. InputArray? tvec,
  11. OutputArray? reprojectionError,
})

Implementation

Future<(int rval, VecMat rvecs, VecMat tvecs, Mat reprojectionError)> solvePnPGenericAsync(
  InputArray objectPoints,
  InputArray imagePoints,
  InputArray cameraMatrix,
  InputArray distCoeffs, {
  VecMat? rvecs,
  VecMat? tvecs,
  bool useExtrinsicGuess = false,
  int flags = SOLVEPNP_ITERATIVE,
  InputArray? rvec,
  InputArray? tvec,
  OutputArray? reprojectionError,
}) async {
  rvecs ??= VecMat();
  tvecs ??= VecMat();
  rvec ??= Mat.empty();
  tvec ??= Mat.empty();
  reprojectionError ??= Mat.empty();
  final prval = calloc<ffi.Int>();
  return cvRunAsync0(
    (callback) => ccalib3d.cv_solvePnPGeneric(
      objectPoints.ref,
      imagePoints.ref,
      cameraMatrix.ref,
      distCoeffs.ref,
      rvecs!.ptr,
      tvecs!.ptr,
      useExtrinsicGuess,
      flags,
      rvec!.ref,
      tvec!.ref,
      reprojectionError!.ref,
      prval,
      callback,
    ),
    (c) {
      final rval = prval.value;
      calloc.free(prval);
      return c.complete((rval, rvecs!, tvecs!, reprojectionError!));
    },
  );
}