[][src]Function opencv::calib3d::solve_p3p

pub fn solve_p3p(
    object_points: &dyn ToInputArray,
    image_points: &dyn ToInputArray,
    camera_matrix: &dyn ToInputArray,
    dist_coeffs: &dyn ToInputArray,
    rvecs: &mut dyn ToOutputArray,
    tvecs: &mut dyn ToOutputArray,
    flags: i32
) -> Result<i32>

Finds an object pose from 3 3D-2D point correspondences.

Parameters

  • objectPoints: Array of object points in the object coordinate space, 3x3 1-channel or 1x3/3x1 3-channel. vector<Point3f> can be also passed here.
  • imagePoints: Array of corresponding image points, 3x2 1-channel or 1x3/3x1 2-channel. vector<Point2f> can be also passed here.
  • cameraMatrix: Input camera matrix inline formula .
  • distCoeffs: Input vector of distortion coefficients inline formula of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
  • rvecs: Output rotation vectors (see @ref Rodrigues ) that, together with tvecs, brings points from the model coordinate system to the camera coordinate system. A P3P problem has up to 4 solutions.
  • tvecs: Output translation vectors.
  • flags: Method for solving a P3P problem:
  • SOLVEPNP_P3P Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang "Complete Solution Classification for the Perspective-Three-Point Problem" (gao2003complete).
  • SOLVEPNP_AP3P Method is based on the paper of T. Ke and S. Roumeliotis. "An Efficient Algebraic Solution to the Perspective-Three-Point Problem" (Ke17).

The function estimates the object pose given 3 object points, their corresponding image projections, as well as the camera matrix and the distortion coefficients.

Note: The solutions are sorted by reprojection errors (lowest to highest).