cv.solvePnPRansac - MATLAB File Help |
Finds an object pose from 3D-2D point correspondences using the RANSAC scheme
[rvec, tvec, success, inliers] = cv.solvePnPRansac(objectPoints, imagePoints, cameraMatrix)
[...] = cv.solvePnPRansac(..., 'OptionName', optionValue, ...)
N
is the number of points, or cell
array of length N
of 3-element vectors can be also passed here
{[x,y,z], ...}
.N
is the number of points, or cell array of length N
of
2-element vectors can be also passed here {[x,y], ...}
.A = [fx 0 cx; 0 fy cy; 0 0 1]
.tvec
, brings points from the model coordinate system to the camera
coordinate system.objectPoints
and imagePoints
.[k1,k2,p1,p2,k3,k4,k5,k6,s1,s2,s3,s4,taux,tauy]
of 4, 5, 8, 12 or 14
elements. If the vector is empty, the zero distortion coefficients are
assumed. default empty.rvec
. Not set by default.tvec
. Not set by default.Method='Iterative'
. 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. default false.The function estimates an object pose given a set of object points, their
corresponding image projections, as well as the camera matrix and the
distortion coefficients. This function finds such a pose that minimizes
reprojection error, that is, the sum of squared distances between the
observed projections imagePoints
and the projected (using cv.projectPoints)
objectPoints
. The use of RANSAC makes the function resistant to outliers.
Note: The default method used to estimate the camera pose for the Minimal
Sample Sets step is EPnP
. Exceptions: if you choose P3P
or AP3P
, these
methods will be used; if the number of input points is equal to 4, P3P
is
used.
The method used to estimate the camera pose using all the inliers is defined
by the flags parameters unless it is equal to P3P
or AP3P
. In this case,
the method EPnP
will be used instead.