Commit fb67ab12 authored by edgarriba's avatar edgarriba

Initial DLS add

parent 9abcd884
...@@ -57,8 +57,9 @@ enum { LMEDS = 4, //!< least-median algorithm ...@@ -57,8 +57,9 @@ enum { LMEDS = 4, //!< least-median algorithm
enum { ITERATIVE = 0, enum { ITERATIVE = 0,
EPNP = 1, // F.Moreno-Noguer, V.Lepetit and P.Fua "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" EPNP = 1, // F.Moreno-Noguer, V.Lepetit and P.Fua "EPnP: Efficient Perspective-n-Point Camera Pose Estimation"
P3P = 2 // X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang; "Complete Solution Classification for the Perspective-Three-Point Problem" P3P = 2, // X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang; "Complete Solution Classification for the Perspective-Three-Point Problem"
}; DLS = 3 // Joel A. Hesch and Stergios I. Roumeliotis. "A Direct Least-Squares (DLS) Method for PnP"
};
enum { CALIB_CB_ADAPTIVE_THRESH = 1, enum { CALIB_CB_ADAPTIVE_THRESH = 1,
CALIB_CB_NORMALIZE_IMAGE = 2, CALIB_CB_NORMALIZE_IMAGE = 2,
......
#include <iostream>
#include "dls.h"
dls::dls()
{
// TODO Auto-generated constructor stub
}
dls::~dls()
{
// TODO Auto-generated destructor stub
}
#ifndef dls_h
#define dls_h
#include "opencv2/core/core_c.h"
class dls
{
public:
dls();
~dls();
private:
};
#endif
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "epnp.h" #include "epnp.h"
#include "p3p.h" #include "p3p.h"
#include "opencv2/calib3d/calib3d_c.h" #include "opencv2/calib3d/calib3d_c.h"
#include "dls.h"
#include <iostream> #include <iostream>
using namespace cv; using namespace cv;
...@@ -92,6 +93,19 @@ bool cv::solvePnP( InputArray _opoints, InputArray _ipoints, ...@@ -92,6 +93,19 @@ bool cv::solvePnP( InputArray _opoints, InputArray _ipoints,
c_distCoeffs.rows*c_distCoeffs.cols ? &c_distCoeffs : 0, c_distCoeffs.rows*c_distCoeffs.cols ? &c_distCoeffs : 0,
&c_rvec, &c_tvec, useExtrinsicGuess ); &c_rvec, &c_tvec, useExtrinsicGuess );
return true; return true;
}
else if (flags == DLS)
{
std::cout << "DLS" << std::endl;
cv::Mat undistortedPoints;
cv::undistortPoints(ipoints, undistortedPoints, cameraMatrix, distCoeffs);
//dls PnP;
// DO SOMETHING
cv::Mat R, rvec = _rvec.getMat(), tvec = _tvec.getMat();
} }
else else
CV_Error(CV_StsBadArg, "The flags argument must be one of CV_ITERATIVE, CV_P3P or CV_EPNP"); CV_Error(CV_StsBadArg, "The flags argument must be one of CV_ITERATIVE, CV_P3P or CV_EPNP");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment