Skip to content

Commit dda1bf1

Browse files
committed
Add broken implementation note for DLS and UPnP.
Add CV_LOG_DEBUG.
1 parent f53ff0d commit dda1bf1

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.
@@ -808,7 +810,7 @@ vectors, respectively, and further optimizes them.
808810
- **SOLVEPNP_ITERATIVE** Iterative method is based on a Levenberg-Marquardt optimization. In
809811
this case the function finds such a pose that minimizes reprojection error, that is the sum
810812
of squared distances between the observed projections imagePoints and the projected (using
811-
projectPoints ) objectPoints .
813+
@ref projectPoints ) objectPoints .
812814
- **SOLVEPNP_P3P** Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
813815
"Complete Solution Classification for the Perspective-Three-Point Problem" (@cite gao2003complete).
814816
In this case the function requires exactly four object and image points.
@@ -817,9 +819,11 @@ In this case the function requires exactly four object and image points.
817819
In this case the function requires exactly four object and image points.
818820
- **SOLVEPNP_EPNP** Method has been introduced by F. Moreno-Noguer, V. Lepetit and P. Fua in the
819821
paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (@cite lepetit2009epnp).
820-
- **SOLVEPNP_DLS** Method is based on the paper of J. Hesch and S. Roumeliotis.
822+
- **SOLVEPNP_DLS** **Broken implementation. Using this flag will fallback to EPnP.** \n
823+
Method is based on the paper of J. Hesch and S. Roumeliotis.
821824
"A Direct Least-Squares (DLS) Method for PnP" (@cite hesch2011direct).
822-
- **SOLVEPNP_UPNP** Method is based on the paper of A. Penate-Sanchez, J. Andrade-Cetto,
825+
- **SOLVEPNP_UPNP** **Broken implementation. Using this flag will fallback to EPnP.** \n
826+
Method is based on the paper of A. Penate-Sanchez, J. Andrade-Cetto,
823827
F. Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
824828
Estimation" (@cite penate2013exhaustive). In this case the function also estimates the parameters \f$f_x\f$ and \f$f_y\f$
825829
assuming that both have the same value. Then the cameraMatrix is updated with the estimated
@@ -1143,9 +1147,11 @@ In this case the function requires exactly four object and image points.
11431147
In this case the function requires exactly four object and image points.
11441148
- **SOLVEPNP_EPNP** Method has been introduced by F.Moreno-Noguer, V.Lepetit and P.Fua in the
11451149
paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (@cite lepetit2009epnp).
1146-
- **SOLVEPNP_DLS** Method is based on the paper of Joel A. Hesch and Stergios I. Roumeliotis.
1150+
- **SOLVEPNP_DLS** **Broken implementation. Using this flag will fallback to EPnP.** \n
1151+
Method is based on the paper of Joel A. Hesch and Stergios I. Roumeliotis.
11471152
"A Direct Least-Squares (DLS) Method for PnP" (@cite hesch2011direct).
1148-
- **SOLVEPNP_UPNP** Method is based on the paper of A.Penate-Sanchez, J.Andrade-Cetto,
1153+
- **SOLVEPNP_UPNP** **Broken implementation. Using this flag will fallback to EPnP.** \n
1154+
Method is based on the paper of A.Penate-Sanchez, J.Andrade-Cetto,
11491155
F.Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
11501156
Estimation" (@cite penate2013exhaustive). In this case the function also estimates the parameters \f$f_x\f$ and \f$f_y\f$
11511157
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)