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



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