mirror of
https://github.com/opencv/opencv.git
synced 2025-08-06 14:36:36 +08:00
Merge pull request #18171 from catree:fix_pnp_doc
This commit is contained in:
commit
c7422e4d90
@ -450,8 +450,10 @@ enum SolvePnPMethod {
|
|||||||
SOLVEPNP_ITERATIVE = 0,
|
SOLVEPNP_ITERATIVE = 0,
|
||||||
SOLVEPNP_EPNP = 1, //!< EPnP: Efficient Perspective-n-Point Camera Pose Estimation @cite lepetit2009epnp
|
SOLVEPNP_EPNP = 1, //!< EPnP: Efficient Perspective-n-Point Camera Pose Estimation @cite lepetit2009epnp
|
||||||
SOLVEPNP_P3P = 2, //!< Complete Solution Classification for the Perspective-Three-Point Problem @cite gao2003complete
|
SOLVEPNP_P3P = 2, //!< Complete Solution Classification for the Perspective-Three-Point Problem @cite gao2003complete
|
||||||
SOLVEPNP_DLS = 3, //!< A Direct Least-Squares (DLS) Method for PnP @cite hesch2011direct
|
SOLVEPNP_DLS = 3, //!< **Broken implementation. Using this flag will fallback to EPnP.** \n
|
||||||
SOLVEPNP_UPNP = 4, //!< Exhaustive Linearization for Robust Camera Pose and Focal Length Estimation @cite penate2013exhaustive
|
//!< A Direct Least-Squares (DLS) Method for PnP @cite hesch2011direct
|
||||||
|
SOLVEPNP_UPNP = 4, //!< **Broken implementation. Using this flag will fallback to EPnP.** \n
|
||||||
|
//!< Exhaustive Linearization for Robust Camera Pose and Focal Length Estimation @cite penate2013exhaustive
|
||||||
SOLVEPNP_AP3P = 5, //!< An Efficient Algebraic Solution to the Perspective-Three-Point Problem @cite Ke17
|
SOLVEPNP_AP3P = 5, //!< An Efficient Algebraic Solution to the Perspective-Three-Point Problem @cite Ke17
|
||||||
SOLVEPNP_IPPE = 6, //!< Infinitesimal Plane-Based Pose Estimation @cite Collins14 \n
|
SOLVEPNP_IPPE = 6, //!< Infinitesimal Plane-Based Pose Estimation @cite Collins14 \n
|
||||||
//!< Object points must be coplanar.
|
//!< Object points must be coplanar.
|
||||||
@ -806,7 +808,7 @@ vectors, respectively, and further optimizes them.
|
|||||||
- **SOLVEPNP_ITERATIVE** Iterative method is based on a Levenberg-Marquardt optimization. In
|
- **SOLVEPNP_ITERATIVE** Iterative method is based on a Levenberg-Marquardt optimization. In
|
||||||
this case the function finds such a pose that minimizes reprojection error, that is the sum
|
this case the 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
|
of squared distances between the observed projections imagePoints and the projected (using
|
||||||
projectPoints ) objectPoints .
|
@ref projectPoints ) objectPoints .
|
||||||
- **SOLVEPNP_P3P** Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
|
- **SOLVEPNP_P3P** Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
|
||||||
"Complete Solution Classification for the Perspective-Three-Point Problem" (@cite gao2003complete).
|
"Complete Solution Classification for the Perspective-Three-Point Problem" (@cite gao2003complete).
|
||||||
In this case the function requires exactly four object and image points.
|
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.
|
|||||||
In this case the function requires exactly four object and image points.
|
In this case the function requires exactly four object and image points.
|
||||||
- **SOLVEPNP_EPNP** Method has been introduced by F. Moreno-Noguer, V. Lepetit and P. Fua in the
|
- **SOLVEPNP_EPNP** Method has been introduced by F. Moreno-Noguer, V. Lepetit and P. Fua in the
|
||||||
paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (@cite lepetit2009epnp).
|
paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (@cite lepetit2009epnp).
|
||||||
- **SOLVEPNP_DLS** Method is based on the paper of J. Hesch and S. Roumeliotis.
|
- **SOLVEPNP_DLS** **Broken implementation. Using this flag will fallback to EPnP.** \n
|
||||||
|
Method is based on the paper of J. Hesch and S. Roumeliotis.
|
||||||
"A Direct Least-Squares (DLS) Method for PnP" (@cite hesch2011direct).
|
"A Direct Least-Squares (DLS) Method for PnP" (@cite hesch2011direct).
|
||||||
- **SOLVEPNP_UPNP** Method is based on the paper of A. Penate-Sanchez, J. Andrade-Cetto,
|
- **SOLVEPNP_UPNP** **Broken implementation. Using this flag will fallback to EPnP.** \n
|
||||||
|
Method is based on the paper of A. Penate-Sanchez, J. Andrade-Cetto,
|
||||||
F. Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
|
F. Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
|
||||||
Estimation" (@cite penate2013exhaustive). In this case the function also estimates the parameters \f$f_x\f$ and \f$f_y\f$
|
Estimation" (@cite penate2013exhaustive). In this case the function also estimates the parameters \f$f_x\f$ and \f$f_y\f$
|
||||||
assuming that both have the same value. Then the cameraMatrix is updated with the estimated
|
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.
|
|||||||
In this case the function requires exactly four object and image points.
|
In this case the function requires exactly four object and image points.
|
||||||
- **SOLVEPNP_EPNP** Method has been introduced by F.Moreno-Noguer, V.Lepetit and P.Fua in the
|
- **SOLVEPNP_EPNP** Method has been introduced by F.Moreno-Noguer, V.Lepetit and P.Fua in the
|
||||||
paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (@cite lepetit2009epnp).
|
paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" (@cite lepetit2009epnp).
|
||||||
- **SOLVEPNP_DLS** Method is based on the paper of Joel A. Hesch and Stergios I. Roumeliotis.
|
- **SOLVEPNP_DLS** **Broken implementation. Using this flag will fallback to EPnP.** \n
|
||||||
|
Method is based on the paper of Joel A. Hesch and Stergios I. Roumeliotis.
|
||||||
"A Direct Least-Squares (DLS) Method for PnP" (@cite hesch2011direct).
|
"A Direct Least-Squares (DLS) Method for PnP" (@cite hesch2011direct).
|
||||||
- **SOLVEPNP_UPNP** Method is based on the paper of A.Penate-Sanchez, J.Andrade-Cetto,
|
- **SOLVEPNP_UPNP** **Broken implementation. Using this flag will fallback to EPnP.** \n
|
||||||
|
Method is based on the paper of A.Penate-Sanchez, J.Andrade-Cetto,
|
||||||
F.Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
|
F.Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
|
||||||
Estimation" (@cite penate2013exhaustive). In this case the function also estimates the parameters \f$f_x\f$ and \f$f_y\f$
|
Estimation" (@cite penate2013exhaustive). In this case the function also estimates the parameters \f$f_x\f$ and \f$f_y\f$
|
||||||
assuming that both have the same value. Then the cameraMatrix is updated with the estimated
|
assuming that both have the same value. Then the cameraMatrix is updated with the estimated
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include "ap3p.h"
|
#include "ap3p.h"
|
||||||
#include "ippe.hpp"
|
#include "ippe.hpp"
|
||||||
#include "opencv2/calib3d/calib3d_c.h"
|
#include "opencv2/calib3d/calib3d_c.h"
|
||||||
|
#include <opencv2/core/utils/logger.hpp>
|
||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
@ -780,6 +781,15 @@ int solvePnPGeneric( InputArray _opoints, InputArray _ipoints,
|
|||||||
vector<Mat> vec_rvecs, vec_tvecs;
|
vector<Mat> vec_rvecs, vec_tvecs;
|
||||||
if (flags == SOLVEPNP_EPNP || flags == SOLVEPNP_DLS || flags == SOLVEPNP_UPNP)
|
if (flags == SOLVEPNP_EPNP || flags == SOLVEPNP_DLS || flags == SOLVEPNP_UPNP)
|
||||||
{
|
{
|
||||||
|
if (flags == SOLVEPNP_DLS)
|
||||||
|
{
|
||||||
|
CV_LOG_DEBUG(NULL, "Broken implementation for SOLVEPNP_DLS. Fallback to EPnP.");
|
||||||
|
}
|
||||||
|
else if (flags == SOLVEPNP_UPNP)
|
||||||
|
{
|
||||||
|
CV_LOG_DEBUG(NULL, "Broken implementation for SOLVEPNP_UPNP. Fallback to EPnP.");
|
||||||
|
}
|
||||||
|
|
||||||
Mat undistortedPoints;
|
Mat undistortedPoints;
|
||||||
undistortPoints(ipoints, undistortedPoints, cameraMatrix, distCoeffs);
|
undistortPoints(ipoints, undistortedPoints, cameraMatrix, distCoeffs);
|
||||||
epnp PnP(cameraMatrix, opoints, undistortedPoints);
|
epnp PnP(cameraMatrix, opoints, undistortedPoints);
|
||||||
|
Loading…
Reference in New Issue
Block a user