Go to the documentation of this file.
12 #include <mrpt/otherlibs/do_opencv_includes.h>
39 const cv::Mat& cameraMatrix,
const cv::Mat& opoints,
40 const cv::Mat& ipoints);
54 const double X,
const double Y,
const double Z,
const double u,
72 uc = cameraMatrix.at<T>(0, 2);
73 vc = cameraMatrix.at<T>(1, 2);
74 fu = cameraMatrix.at<T>(0, 0);
75 fv = cameraMatrix.at<T>(1, 1);
84 template <
typename Opo
intType,
typename Ipo
intType>
85 void init_points(
const cv::Mat& opoints,
const cv::Mat& ipoints)
89 pws[3 * i] = opoints.at<OpointType>(i, 0);
90 pws[3 * i + 1] = opoints.at<OpointType>(i, 1);
91 pws[3 * i + 2] = opoints.at<OpointType>(i, 2);
93 us[2 * i] = ipoints.at<IpointType>(i, 0) *
fu +
uc;
94 us[2 * i + 1] = ipoints.at<IpointType>(i, 1) *
fv +
vc;
126 CvMat* M,
const int row,
const double*
alphas,
const double u,
134 void compute_ccs(
const double* betas,
const double* ut);
153 const CvMat* L_6x10,
const CvMat* Rho,
double* betas);
162 const CvMat* L_6x10,
const CvMat* Rho,
double* betas);
171 const CvMat* L_6x10,
const CvMat* Rho,
double* betas);
179 void qr_solve(CvMat* A, CvMat*
b, CvMat* X);
187 double dot(
const double*
v1,
const double*
v2);
195 double dist2(
const double* p1,
const double* p2);
217 const CvMat* L_6x10,
const CvMat* Rho,
double current_betas[4]);
228 const double* l_6x10,
const double* rho,
const double cb[4], CvMat* A,
240 const double* ut,
const double* betas,
double R[3][3],
double t[3]);
257 const double R_dst[3][3],
const double t_dst[3],
double R_src[3][3],
void compute_pcs(void)
Internal function.
void find_betas_approx_1(const CvMat *L_6x10, const CvMat *Rho, double *betas)
Internal function.
void copy_R_and_t(const double R_dst[3][3], const double t_dst[3], double R_src[3][3], double t_src[3])
Copy function of output result.
double * A1
Internal member variable.
void choose_control_points(void)
Function to select 4 control points from n points.
void compute_rho(double *rho)
Get distances between all object points taken 2 at a time(nC2)
void compute_barycentric_coordinates(void)
Convert from object space to relative object space (Barycentric coordinates)
std::vector< double > pws
Focal length in y-direction.
std::vector< double > alphas
void compute_A_and_b_gauss_newton(const double *l_6x10, const double *rho, const double cb[4], CvMat *A, CvMat *b)
Internal function.
void init_camera_parameters(const cv::Mat &cameraMatrix)
Initialize Camera Matrix.
int max_nr
Internal member variable.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void solve_for_sign(void)
Internal function.
void add_correspondence(const double X, const double Y, const double Z, const double u, const double v)
Add a 2d/3d correspondence.
void qr_solve(CvMat *A, CvMat *b, CvMat *X)
QR optimization algorithm.
void find_betas_approx_2(const CvMat *L_6x10, const CvMat *Rho, double *betas)
Internal function.
void fill_M(CvMat *M, const int row, const double *alphas, const double u, const double v)
Generate the Matrix M.
void compute_L_6x10(const double *ut, double *l_6x10)
Internal function.
double cws[4][3]
Number of 2d/3d correspondences.
void compute_pose(cv::Mat &R, cv::Mat &t)
OpenCV wrapper to compute pose.
~epnp()
Destructor for EPnP class.
std::vector< double > pcs
double dist2(const double *p1, const double *p2)
Squared distance between two vectors.
GLfloat GLfloat GLfloat v2
double vc
Image center in x-direction.
double dot(const double *v1, const double *v2)
Dot product of two OpenCV vectors.
double fu
Image center in y-direction.
void compute_ccs(const double *betas, const double *ut)
Internal function.
double reprojection_error(const double R[3][3], const double t[3])
Function to compute reprojection error.
int number_of_correspondences
Internal member variables.
void estimate_R_and_t(double R[3][3], double t[3])
Helper function to @func compute_R_and_t()
double fv
Focal length in x-direction.
GLenum GLenum GLvoid * row
void find_betas_approx_3(const CvMat *L_6x10, const CvMat *Rho, double *betas)
Internal function.
double compute_R_and_t(const double *ut, const double *betas, double R[3][3], double t[3])
Function to compute pose.
double cws_determinant
Internal member variables.
void gauss_newton(const CvMat *L_6x10, const CvMat *Rho, double current_betas[4])
Gauss Newton iterative algorithm.
epnp(const cv::Mat &cameraMatrix, const cv::Mat &opoints, const cv::Mat &ipoints)
Constructor for EPnP class.
void init_points(const cv::Mat &opoints, const cv::Mat &ipoints)
Convert object points and image points from OpenCV format to STL matrices.
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |