Skip to content

Commit c7422e4

Browse files
committed
Merge pull request opencv#18171 from catree:fix_pnp_doc
2 parents 485d2b5 + dda1bf1 commit c7422e4

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

modules/calib3d/include/opencv2/calib3d.hpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,10 @@ enum SolvePnPMethod {
450450
SOLVEPNP_ITERATIVE = 0,
451451
SOLVEPNP_EPNP = 1, //!< EPnP: Efficient Perspective-n-Point Camera Pose Estimation @cite lepetit2009epnp
452452
SOLVEPNP_P3P = 2, //!< Complete Solution Classification for the Perspective-Three-Point Problem @cite gao2003complete
453-
SOLVEPNP_DLS = 3, //!< A Direct Least-Squares (DLS) Method for PnP @cite hesch2011direct
454-
SOLVEPNP_UPNP = 4, //!< Exhaustive Linearization for Robust Camera Pose and Focal Length Estimation @cite penate2013exhaustive
453+
SOLVEPNP_DLS = 3, //!< **Broken implementation. Using this flag will fallback to EPnP.** \n
454+
//!< A Direct Least-Squares (DLS) Method for PnP @cite hesch2011direct
455+
SOLVEPNP_UPNP = 4, //!< **Broken implementation. Using this flag will fallback to EPnP.** \n
456+
//!< Exhaustive Linearization for Robust Camera Pose and Focal Length Estimation @cite penate2013exhaustive
455457
SOLVEPNP_AP3P = 5, //!< An Efficient Algebraic Solution to the Perspective-Three-Point Problem @cite Ke17
456458
SOLVEPNP_IPPE = 6, //!< Infinitesimal Plane-Based Pose Estimation @cite Collins14 \n
457459
//!< Object points must be coplanar.
@@ -806,7 +808,7 @@ vectors, respectively, and further optimizes them.
806808
- **SOLVEPNP_ITERATIVE** Iterative method is based on a Levenberg-Marquardt optimization. In
807809
this case the function finds such a pose that minimizes reprojection error, that is the sum
808810
of squared distances between the observed projections imagePoints and the projected (using
809-
projectPoints ) objectPoints .
811+
@ref projectPoints ) objectPoints .
810812
- **SOLVEPNP_P3P** Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
811813
"Complete Solution Classification for the Perspective-Three-Point Problem" (@cite gao2003complete).
812814
In this case the function requires exactly four object and image points.
@@ -815,9 +817,11 @@ In this case the function requires exactly four object and image points.
815817
In this case the function requires exactly four object and image points.
816818
- **SOLVEPNP_EPNP** Method has been introduced by F. Moreno-Noguer, V. Lepetit and P. Fua in the
817819
paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (@cite lepetit2009epnp).
818-
- **SOLVEPNP_DLS** Method is based on the paper of J. Hesch and S. Roumeliotis.
820+
- **SOLVEPNP_DLS** **Broken implementation. Using this flag will fallback to EPnP.** \n
821+
Method is based on the paper of J. Hesch and S. Roumeliotis.
819822
"A Direct Least-Squares (DLS) Method for PnP" (@cite hesch2011direct).
820-
- **SOLVEPNP_UPNP** Method is based on the paper of A. Penate-Sanchez, J. Andrade-Cetto,
823+
- **SOLVEPNP_UPNP** **Broken implementation. Using this flag will fallback to EPnP.** \n
824+
Method is based on the paper of A. Penate-Sanchez, J. Andrade-Cetto,
821825
F. Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
822826
Estimation" (@cite penate2013exhaustive). In this case the function also estimates the parameters \f$f_x\f$ and \f$f_y\f$
823827
assuming that both have the same value. Then the cameraMatrix is updated with the estimated
@@ -1136,9 +1140,11 @@ In this case the function requires exactly four object and image points.
11361140
In this case the function requires exactly four object and image points.
11371141
- **SOLVEPNP_EPNP** Method has been introduced by F.Moreno-Noguer, V.Lepetit and P.Fua in the
11381142
paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (@cite lepetit2009epnp).
1139-
- **SOLVEPNP_DLS** Method is based on the paper of Joel A. Hesch and Stergios I. Roumeliotis.
1143+
- **SOLVEPNP_DLS** **Broken implementation. Using this flag will fallback to EPnP.** \n
1144+
Method is based on the paper of Joel A. Hesch and Stergios I. Roumeliotis.
11401145
"A Direct Least-Squares (DLS) Method for PnP" (@cite hesch2011direct).
1141-
- **SOLVEPNP_UPNP** Method is based on the paper of A.Penate-Sanchez, J.Andrade-Cetto,
1146+
- **SOLVEPNP_UPNP** **Broken implementation. Using this flag will fallback to EPnP.** \n
1147+
Method is based on the paper of A.Penate-Sanchez, J.Andrade-Cetto,
11421148
F.Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
11431149
Estimation" (@cite penate2013exhaustive). In this case the function also estimates the parameters \f$f_x\f$ and \f$f_y\f$
11441150
assuming that both have the same value. Then the cameraMatrix is updated with the estimated

modules/calib3d/src/solvepnp.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#include "ap3p.h"
4949
#include "ippe.hpp"
5050
#include "opencv2/calib3d/calib3d_c.h"
51+
#include <opencv2/core/utils/logger.hpp>
5152

5253
namespace cv
5354
{
@@ -780,6 +781,15 @@ int solvePnPGeneric( InputArray _opoints, InputArray _ipoints,
780781
vector<Mat> vec_rvecs, vec_tvecs;
781782
if (flags == SOLVEPNP_EPNP || flags == SOLVEPNP_DLS || flags == SOLVEPNP_UPNP)
782783
{
784+
if (flags == SOLVEPNP_DLS)
785+
{
786+
CV_LOG_DEBUG(NULL, "Broken implementation for SOLVEPNP_DLS. Fallback to EPnP.");
787+
}
788+
else if (flags == SOLVEPNP_UPNP)
789+
{
790+
CV_LOG_DEBUG(NULL, "Broken implementation for SOLVEPNP_UPNP. Fallback to EPnP.");
791+
}
792+
783793
Mat undistortedPoints;
784794
undistortPoints(ipoints, undistortedPoints, cameraMatrix, distCoeffs);
785795
epnp PnP(cameraMatrix, opoints, undistortedPoints);

0 commit comments

Comments
 (0)