Cv2SolvePnP Method (InputArray, InputArray, InputArray, InputArray, OutputArray, OutputArray, Boolean, SolvePnPFlag) OpenCvSharp Class Library
Finds an object pose from 3D-2D point correspondences.

Namespace:  OpenCvSharp.CPlusPlus
Assembly:  OpenCvSharp.CPlusPlus (in OpenCvSharp.CPlusPlus.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax

public static void SolvePnP(
	InputArray objectPoints,
	InputArray imagePoints,
	InputArray cameraMatrix,
	InputArray distCoeffs,
	OutputArray rvec,
	OutputArray tvec,
	bool useExtrinsicGuess = false,
	SolvePnPFlag flags = SolvePnPFlag.Iterative
)

Parameters

objectPoints
Type: OpenCvSharp.CPlusPlusInputArray
Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, where N is the number of points. vector<Point3f> can be also passed here.
imagePoints
Type: OpenCvSharp.CPlusPlusInputArray
Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points. vector<Point2f> can be also passed here.
cameraMatrix
Type: OpenCvSharp.CPlusPlusInputArray
Input camera matrix
distCoeffs
Type: OpenCvSharp.CPlusPlusInputArray
Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is null, the zero distortion coefficients are assumed.
rvec
Type: OpenCvSharp.CPlusPlusOutputArray
Output rotation vector that, together with tvec , brings points from the model coordinate system to the camera coordinate system.
tvec
Type: OpenCvSharp.CPlusPlusOutputArray
Output translation vector.
useExtrinsicGuess (Optional)
Type: SystemBoolean
If true, the function uses the provided rvec and tvec values as initial approximations of the rotation and translation vectors, respectively, and further optimizes them.
flags (Optional)
Type: OpenCvSharp.CPlusPlusSolvePnPFlag
Method for solving a PnP problem:
See Also

Reference