Main MRPT website > C++ reference for MRPT 1.5.5
rpnp.h
Go to the documentation of this file.
1 #ifndef rpnp_h
2 #define rpnp_h
3 
4 #include <mrpt/utils/types_math.h> // Eigen must be included first via MRPT to enable the plugin system
5 
6 namespace mrpt
7 {
8  namespace vision
9  {
10  namespace pnp
11  {
12  /** \addtogroup pnp Perspective-n-Point pose estimation
13  * \ingroup mrpt_vision_grp
14  * @{
15  */
16  /**
17  * @class rpnp
18  * @author Chandra Mangipudi
19  * @date 10/08/16
20  * @file rpnp.h
21  * @brief Robust - PnP class definition for computing pose
22  */
23  class rpnp
24  {
25  Eigen::MatrixXd obj_pts; //! Object Points (n X 3) in Camera Co-ordinate system
26  Eigen::MatrixXd img_pts; //! Image Points (n X 3) in Camera Co-ordinate system
27  Eigen::MatrixXd cam_intrinsic; //! Camera Intrinsic Matrix
28  Eigen::MatrixXd P; //! Transposed Object Points (3 X n) for computations
29  Eigen::MatrixXd Q; //! Transposed Image Points (3 X n) for computations
30 
31  Eigen::Matrix3d R; //! Rotation matrix
32  Eigen::Vector3d t; //! Translation vector
33  int n; //! Number of 2D/3D correspondences
34 
35  public:
36  //! Constructor for rpnp class
37  rpnp(Eigen::MatrixXd obj_pts_, Eigen::MatrixXd img_pts_, Eigen::MatrixXd cam_, int n0);
38 
39  /**
40  * @brief Function to compute pose
41  * @param[out] R_ Rotaiton matrix
42  * @param[out] t_ Translation vector
43  * @return Success flag
44  */
45  bool compute_pose(Eigen::Ref<Eigen::Matrix3d> R_, Eigen::Ref<Eigen::Vector3d> t_);
46 
47  /**
48  * @brief Function to compute pose using P3P
49  * @param[in] l1 Internal parameter for P3P computation
50  * @param[in] l2 Internal parameter for P3P computation
51  * @param[in] A5 Internal parameter for P3P computation
52  * @param[in] C1 Internal parameter for P3P computation
53  * @param[in] C2 Internal parameter for P3P computation
54  * @param[in] D1 Internal parameter for P3P computation
55  * @param[in] D2 Internal parameter for P3P computation
56  * @param[in] D3 Internal parameter for P3P computation
57  * @return Output vector
58  */
59  Eigen::VectorXd getp3p(double l1, double l2, double A5, double C1, double C2, double D1, double D2, double D3);
60 
61  /**
62  * @brief Get Polynomial from input vector
63  * @param vin Input vector
64  * @return Output Polynomial co-efficients
65  */
66  Eigen::VectorXd getpoly7(const Eigen::VectorXd& vin);
67 
68  /**
69  * @brief Function to calculate final pose
70  * @param XXc Object points
71  * @param XXw Image Points
72  * @param R2 Final Rotation matrix
73  * @param t2 Final Translation vector
74  */
75  void calcampose(Eigen::MatrixXd& XXc, Eigen::MatrixXd& XXw, Eigen::Matrix3d& R2, Eigen::Vector3d& t2);
76  };
77 
78  /** @} */ // end of grouping
79  }
80  }
81 
82 }
83 
84 #endif
Eigen::MatrixXd P
Camera Intrinsic Matrix.
Definition: rpnp.h:28
void calcampose(Eigen::MatrixXd &XXc, Eigen::MatrixXd &XXw, Eigen::Matrix3d &R2, Eigen::Vector3d &t2)
Function to calculate final pose.
Definition: rpnp.cpp:306
Eigen::MatrixXd cam_intrinsic
Image Points (n X 3) in Camera Co-ordinate system.
Definition: rpnp.h:27
Eigen::Vector3d t
Rotation matrix.
Definition: rpnp.h:32
rpnp(Eigen::MatrixXd obj_pts_, Eigen::MatrixXd img_pts_, Eigen::MatrixXd cam_, int n0)
Number of 2D/3D correspondences.
Definition: rpnp.cpp:24
Eigen::VectorXd getp3p(double l1, double l2, double A5, double C1, double C2, double D1, double D2, double D3)
Function to compute pose using P3P.
Definition: rpnp.cpp:354
Eigen::MatrixXd img_pts
Object Points (n X 3) in Camera Co-ordinate system.
Definition: rpnp.h:26
bool compute_pose(Eigen::Ref< Eigen::Matrix3d > R_, Eigen::Ref< Eigen::Vector3d > t_)
Function to compute pose.
Definition: rpnp.cpp:42
int n
Translation vector.
Definition: rpnp.h:33
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Eigen::MatrixXd obj_pts
Definition: rpnp.h:25
Eigen::MatrixXd Q
Transposed Object Points (3 X n) for computations.
Definition: rpnp.h:29
Eigen::Matrix3d R
Transposed Image Points (3 X n) for computations.
Definition: rpnp.h:31
Eigen::VectorXd getpoly7(const Eigen::VectorXd &vin)
Get Polynomial from input vector.
Definition: rpnp.cpp:340



Page generated by Doxygen 1.8.14 for MRPT 1.5.5 Git: e06b63dbf Fri Dec 1 14:41:11 2017 +0100 at lun oct 28 01:31:35 CET 2019