epnp.h
Go to the documentation of this file.
00001 #ifndef epnp_h
00002 #define epnp_h
00003 
00004 #include <cv.h>
00005 
00006 class epnp {
00007  public:
00008   epnp(void);
00009   ~epnp();
00010 
00011   void set_internal_parameters(const double uc, const double vc,
00012                                const double fu, const double fv);
00013 
00014   void set_maximum_number_of_correspondences(const int n);
00015   void reset_correspondences(void);
00016   void add_correspondence(const double X, const double Y, const double Z,
00017                           const double u, const double v);
00018 
00019   double compute_pose(double R[3][3], double T[3]);
00020 
00021   void relative_error(double & rot_err, double & transl_err,
00022                       const double Rtrue[3][3], const double ttrue[3],
00023                       const double Rest[3][3],  const double test[3]);
00024 
00025   void print_pose(const double R[3][3], const double t[3]);
00026   double reprojection_error(const double R[3][3], const double t[3]);
00027 
00028  private:
00029   void choose_control_points(void);
00030   void compute_barycentric_coordinates(void);
00031   void fill_M(CvMat * M, const int row, const double * alphas, const double u, const double v);
00032   void compute_ccs(const double * betas, const double * ut);
00033   void compute_pcs(void);
00034 
00035   void solve_for_sign(void);
00036 
00037   void find_betas_approx_1(const CvMat * L_6x10, const CvMat * Rho, double * betas);
00038   void find_betas_approx_2(const CvMat * L_6x10, const CvMat * Rho, double * betas);
00039   void find_betas_approx_3(const CvMat * L_6x10, const CvMat * Rho, double * betas);
00040   void qr_solve(CvMat * A, CvMat * b, CvMat * X);
00041 
00042   double dot(const double * v1, const double * v2);
00043   double dist2(const double * p1, const double * p2);
00044 
00045   void compute_rho(double * rho);
00046   void compute_L_6x10(const double * ut, double * l_6x10);
00047 
00048   void gauss_newton(const CvMat * L_6x10, const CvMat * Rho, double current_betas[4]);
00049   void compute_A_and_b_gauss_newton(const double * l_6x10, const double * rho,
00050                                     double cb[4], CvMat * A, CvMat * b);
00051 
00052   double compute_R_and_t(const double * ut, const double * betas,
00053                          double R[3][3], double t[3]);
00054 
00055   void estimate_R_and_t(double R[3][3], double t[3]);
00056 
00057   void copy_R_and_t(const double R_dst[3][3], const double t_dst[3],
00058                     double R_src[3][3], double t_src[3]);
00059 
00060   void mat_to_quat(const double R[3][3], double q[4]);
00061 
00062 
00063   double uc, vc, fu, fv;
00064 
00065   double * pws, * us, * alphas, * pcs;
00066   int maximum_number_of_correspondences;
00067   int number_of_correspondences;
00068 
00069   double cws[4][3], ccs[4][3];
00070   double cws_determinant;
00071 };
00072 
00073 #endif


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:31:08