| Cv2SolvePnPRansac Method (InputArray, InputArray, InputArray, InputArray, OutputArray, OutputArray, Boolean, Int32, Single, Double, OutputArray, SolvePnPFlags) |
computes the camera pose from a few 3D points and the corresponding projections. The outliers are possible.
Namespace:
OpenCvSharp
Assembly:
OpenCvSharp (in OpenCvSharp.dll) Version: 1.0.0
Syntax public static void SolvePnPRansac(
InputArray objectPoints,
InputArray imagePoints,
InputArray cameraMatrix,
InputArray distCoeffs,
OutputArray rvec,
OutputArray tvec,
bool useExtrinsicGuess = false,
int iterationsCount = 100,
float reprojectionError = 8f,
double confidence = 0.99,
OutputArray inliers = null,
SolvePnPFlags flags = SolvePnPFlags.Iterative
)
Public Shared Sub SolvePnPRansac (
objectPoints As InputArray,
imagePoints As InputArray,
cameraMatrix As InputArray,
distCoeffs As InputArray,
rvec As OutputArray,
tvec As OutputArray,
Optional useExtrinsicGuess As Boolean = false,
Optional iterationsCount As Integer = 100,
Optional reprojectionError As Single = 8F,
Optional confidence As Double = 0.99,
Optional inliers As OutputArray = Nothing,
Optional flags As SolvePnPFlags = SolvePnPFlags.Iterative
)
public:
static void SolvePnPRansac(
InputArray^ objectPoints,
InputArray^ imagePoints,
InputArray^ cameraMatrix,
InputArray^ distCoeffs,
OutputArray^ rvec,
OutputArray^ tvec,
bool useExtrinsicGuess = false,
int iterationsCount = 100,
float reprojectionError = 8f,
double confidence = 0.99,
OutputArray^ inliers = nullptr,
SolvePnPFlags flags = SolvePnPFlags::Iterative
)
static member SolvePnPRansac :
objectPoints : InputArray *
imagePoints : InputArray *
cameraMatrix : InputArray *
distCoeffs : InputArray *
rvec : OutputArray *
tvec : OutputArray *
?useExtrinsicGuess : bool *
?iterationsCount : int *
?reprojectionError : float32 *
?confidence : float *
?inliers : OutputArray *
?flags : SolvePnPFlags
(* Defaults:
let _useExtrinsicGuess = defaultArg useExtrinsicGuess false
let _iterationsCount = defaultArg iterationsCount 100
let _reprojectionError = defaultArg reprojectionError 8f
let _confidence = defaultArg confidence 0.99
let _inliers = defaultArg inliers null
let _flags = defaultArg flags SolvePnPFlags.Iterative
*)
-> unit
Parameters
- objectPoints
- Type: OpenCvSharpInputArray
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. List<Point3f> can be also passed here. - imagePoints
- Type: OpenCvSharpInputArray
Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points.
List<Point2f> can be also passed here. - cameraMatrix
- Type: OpenCvSharpInputArray
Input 3x3 camera matrix - distCoeffs
- Type: OpenCvSharpInputArray
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: OpenCvSharpOutputArray
Output rotation vector that, together with tvec , brings points from the model coordinate system
to the camera coordinate system. - tvec
- Type: OpenCvSharpOutputArray
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. - iterationsCount (Optional)
- Type: SystemInt32
Number of iterations. - reprojectionError (Optional)
- Type: SystemSingle
Inlier threshold value used by the RANSAC procedure.
The parameter value is the maximum allowed distance between the observed and computed point projections to consider it an inlier. - confidence (Optional)
- Type: SystemDouble
The probability that the algorithm produces a useful result. - inliers (Optional)
- Type: OpenCvSharpOutputArray
Output vector that contains indices of inliers in objectPoints and imagePoints . - flags (Optional)
- Type: OpenCvSharpSolvePnPFlags
Method for solving a PnP problem
See Also