Skip to content

Commit d54b1ad

Browse files
committed
Merge pull request opencv#8805 from catree:solvePnP_doc
2 parents 36918b3 + 542cdb2 commit d54b1ad

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

modules/calib3d/include/opencv2/calib3d.hpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,10 @@ where N is the number of points. vector\<Point2f\> can be also passed here.
534534
\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of
535535
4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are
536536
assumed.
537-
@param rvec Output rotation vector (see Rodrigues ) that, together with tvec , brings points from
537+
@param rvec Output rotation vector (see @ref Rodrigues ) that, together with tvec , brings points from
538538
the model coordinate system to the camera coordinate system.
539539
@param tvec Output translation vector.
540-
@param useExtrinsicGuess Parameter used for SOLVEPNP_ITERATIVE. If true (1), the function uses
540+
@param useExtrinsicGuess Parameter used for #SOLVEPNP_ITERATIVE. If true (1), the function uses
541541
the provided rvec and tvec values as initial approximations of the rotation and translation
542542
vectors, respectively, and further optimizes them.
543543
@param flags Method for solving a PnP problem:
@@ -546,15 +546,18 @@ this case the function finds such a pose that minimizes reprojection error, that
546546
of squared distances between the observed projections imagePoints and the projected (using
547547
projectPoints ) objectPoints .
548548
- **SOLVEPNP_P3P** Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
549-
"Complete Solution Classification for the Perspective-Three-Point Problem". In this case the
550-
function requires exactly four object and image points.
549+
"Complete Solution Classification for the Perspective-Three-Point Problem" (@cite gao2003complete).
550+
In this case the function requires exactly four object and image points.
551+
- **SOLVEPNP_AP3P** Method is based on the paper of T. Ke, S. Roumeliotis
552+
"An Efficient Algebraic Solution to the Perspective-Three-Point Problem" (@cite Ke17).
553+
In this case the function requires exactly four object and image points.
551554
- **SOLVEPNP_EPNP** Method has been introduced by F.Moreno-Noguer, V.Lepetit and P.Fua in the
552-
paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation".
555+
paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (@cite lepetit2009epnp).
553556
- **SOLVEPNP_DLS** Method is based on the paper of Joel A. Hesch and Stergios I. Roumeliotis.
554-
"A Direct Least-Squares (DLS) Method for PnP".
557+
"A Direct Least-Squares (DLS) Method for PnP" (@cite hesch2011direct).
555558
- **SOLVEPNP_UPNP** Method is based on the paper of A.Penate-Sanchez, J.Andrade-Cetto,
556559
F.Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
557-
Estimation". In this case the function also estimates the parameters \f$f_x\f$ and \f$f_y\f$
560+
Estimation" (@cite penate2013exhaustive). In this case the function also estimates the parameters \f$f_x\f$ and \f$f_y\f$
558561
assuming that both have the same value. Then the cameraMatrix is updated with the estimated
559562
focal length.
560563
@@ -575,8 +578,11 @@ projections, as well as the camera matrix and the distortion coefficients.
575578
it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
576579
np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
577580
- The methods **SOLVEPNP_DLS** and **SOLVEPNP_UPNP** cannot be used as the current implementations are
578-
unstable and sometimes give completly wrong results. If you pass one of these two flags,
579-
**SOLVEPNP_EPNP** method will be used instead.
581+
unstable and sometimes give completly wrong results. If you pass one of these two
582+
flags, **SOLVEPNP_EPNP** method will be used instead.
583+
- The minimum number of points is 4. In the case of **SOLVEPNP_P3P** and **SOLVEPNP_AP3P**
584+
methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
585+
of the P3P problem, the last one is used to retain the best solution that minimizes the reprojection error).
580586
*/
581587
CV_EXPORTS_W bool solvePnP( InputArray objectPoints, InputArray imagePoints,
582588
InputArray cameraMatrix, InputArray distCoeffs,

modules/calib3d/src/solvepnp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ bool solvePnP( InputArray _opoints, InputArray _ipoints,
6161

6262
Mat opoints = _opoints.getMat(), ipoints = _ipoints.getMat();
6363
int npoints = std::max(opoints.checkVector(3, CV_32F), opoints.checkVector(3, CV_64F));
64-
CV_Assert( npoints >= 0 && npoints == std::max(ipoints.checkVector(2, CV_32F), ipoints.checkVector(2, CV_64F)) );
64+
CV_Assert( npoints >= 4 && npoints == std::max(ipoints.checkVector(2, CV_32F), ipoints.checkVector(2, CV_64F)) );
6565

6666
Mat rvec, tvec;
6767
if( flags != SOLVEPNP_ITERATIVE )

modules/core/include/opencv2/core/types.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ template<> class DataType<Range>
572572

573573
/** @brief Template class for a 4-element vector derived from Vec.
574574
575-
Being derived from Vec\<_Tp, 4\> , Scalar_ and Scalar can be used just as typical 4-element
575+
Being derived from Vec\<_Tp, 4\> , Scalar\_ and Scalar can be used just as typical 4-element
576576
vectors. In addition, they can be converted to/from CvScalar . The type Scalar is widely used in
577577
OpenCV to pass pixel values.
578578
*/

0 commit comments

Comments
 (0)