Main MRPT website > C++ reference for MRPT 1.5.9
pnp_algos.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-2017, 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 __pnp_algos_h
10 #define __pnp_algos_h
11 
12 #include <mrpt/config.h>
13 
15 #include <Eigen/Core>
16 #include <Eigen/Dense>
17 
18 namespace mrpt
19 {
20  namespace vision
21  {
22  /** Perspective n Point (PnP) Algorithms toolkit for MRPT \ingroup mrpt_vision_grp */
23  namespace pnp
24  {
25  /** \addtogroup pnp Perspective-n-Point pose estimation
26  * \ingroup mrpt_vision_grp
27  * @{
28  */
29 
30  /**
31  * @class CPnP
32  * @author Chandra Mangipudi
33  * @date 17/08/16
34  * @file pnp_algos.h
35  * @brief PnP Algorithms toolkit for MRPT
36  */
37 
38  /** This class is used for Pose estimation from a known landmark using a monocular camera.
39  * The toolkit comprises of state of the art PnP (Perspective n Point) algorithms
40  *
41  * The Python Bindings pnp_perf_comp.py can be used to generate performance comparison using
42  * standard tests between the different algorithms.
43  *
44  * <h2> <a href="pnp_perf_comp.html">Performance comparison Results </a> </h2>
45  *
46  */
48  {
49  public:
50 
51  /**
52  * @brief \cite hesch Direct Least Squares (DLS) - PnP : Algorithm formulates position as a function of rotation.
53  * Use Cayley's rotation theorem to represent the rotation using parameters ($s_1, s_2, s_3$).
54  * Solve the rotation using multi-variate polynomial expressions
55  *
56  * @param[in] obj_pts Object points in Camera Co-ordinate system {C} nX3 (only 4 points used) array [p_x, p_y, p_z]
57  * @param[in] img_pts Image points in pixels nX3 (only 4 points used) array containing pixel data from camera [u, v, 1]
58  * @param[in] n number of 2D-3D correspondences
59  * @param[in] cam_intrinsic Camera Intrinsic matrix
60  * @param[out] pose_mat Output pose vector 6X1, pose_mat[0:2]-> Translation, pose_mat[3:5] -> Quaternion vector component
61  * @return success flag
62  */
63  bool dls(const Eigen::Ref<Eigen::MatrixXd> obj_pts, const Eigen::Ref<Eigen::MatrixXd> img_pts, int n, const Eigen::Ref<Eigen::MatrixXd> cam_intrinsic, Eigen::Ref<Eigen::MatrixXd> pose_mat);
64 
65  /**
66  * @brief \cite lepetit Efficient-PnP (EPnP) - Algorithm takes 4 control points based on n points and uses the control points to compute the pose
67  *
68  * @param[in] obj_pts Object points in Camera Co-ordinate system {C} nX3 (only 4 points used) array [p_x, p_y, p_z]
69  * @param[in] img_pts Image points in pixels nX3 (only 4 points used) array containing pixel data from camera [u, v, 1]
70  * @param[in] n number of 2D-3D correspondences
71  * @param[in] cam_intrinsic Camera Intrinsic matrix
72  * @param[out] pose_mat Output pose vector 6X1, pose_mat[0:2]-> Translation, pose_mat[3:5] -> Quaternion vector component
73  * @return success flag
74  */
75  bool epnp(const Eigen::Ref<Eigen::MatrixXd> obj_pts, const Eigen::Ref<Eigen::MatrixXd> img_pts, int n, const Eigen::Ref<Eigen::MatrixXd> cam_intrinsic, Eigen::Ref<Eigen::MatrixXd> pose_mat);
76 
77  /**
78  * @brief \cite Kneip2014 Unified-PnP (UPnP) : Algorithm to compute pose from unknown camera intrinsic matrix
79  *
80  * @param[in] obj_pts Object points in Camera Co-ordinate system {C} nX3 (only 4 points used) array [p_x, p_y, p_z]
81  * @param[in] img_pts Image points in pixels nX3 (only 4 points used) array containing pixel data from camera [u, v, 1]
82  * @param[in] n number of 2D-3D correspondences
83  * @param[in] cam_intrinsic Camera Intrinsic matrix
84  * @param[out] pose_mat Output pose vector 6X1, pose_mat[0:2]-> Translation, pose_mat[3:5] -> Quaternion vector component
85  * @return success flag
86  */
87  bool upnp(const Eigen::Ref<Eigen::MatrixXd> obj_pts, const Eigen::Ref<Eigen::MatrixXd> img_pts, int n, const Eigen::Ref<Eigen::MatrixXd> cam_intrinsic, Eigen::Ref<Eigen::MatrixXd> pose_mat);
88 
89  /**
90  * @brief \cite kneip P3P - A closed form solution for n=3, 2D-3D correspondences
91  *
92  * @param[in] obj_pts Object points in Camera Co-ordinate system {C} nX3 (only 4 points used) array [p_x, p_y, p_z]
93  * @param[in] img_pts Image points in pixels nX3 (only 4 points used) array containing pixel data from camera [u, v, 1]
94  * @param[in] n number of 2D-3D correspondences
95  * @param[in] cam_intrinsic Camera Intrinsic matrix
96  * @param[out] pose_mat Output pose vector 6X1, pose_mat[0:2]-> Translation, pose_mat[3:5] -> Quaternion vector component
97  * @return success flag
98  */
99  bool p3p(const Eigen::Ref<Eigen::MatrixXd> obj_pts, const Eigen::Ref<Eigen::MatrixXd> img_pts, int n, const Eigen::Ref<Eigen::MatrixXd> cam_intrinsic, Eigen::Ref<Eigen::MatrixXd> pose_mat);
100 
101  /**
102  * @brief \cite xie Robust (R-PnP)- A closed form solution with intermediate P3P computations
103  *
104  * @param[in] obj_pts Object points in Camera Co-ordinate system {C} nX3 (only 4 points used) array [p_x, p_y, p_z]
105  * @param[in] img_pts Image points in pixels nX3 (only 4 points used) array containing pixel data from camera [u, v, 1]
106  * @param[in] n number of 2D-3D correspondences
107  * @param[in] cam_intrinsic Camera Intrinsic matrix
108  * @param[out] pose_mat Output pose vector 6X1, pose_mat[0:2]-> Translation, pose_mat[3:5] -> Quaternion vector component
109  * @return success flag
110  */
111  bool rpnp(const Eigen::Ref<Eigen::MatrixXd> obj_pts, const Eigen::Ref<Eigen::MatrixXd> img_pts, int n, const Eigen::Ref<Eigen::MatrixXd> cam_intrinsic, Eigen::Ref<Eigen::MatrixXd> pose_mat);
112 
113  /**
114  * @brief \cite garro Procrustes-PnP(PPnP) Algorithm : Iterative SVD based algorithm
115  * @param[in] obj_pts Object points in Camera Co-ordinate system {C} nX3 array [p_x, p_y, p_z]
116  * @param[in] img_pts Image points in pixels nX3 array containing pixel data from camera [u, v, 1]
117  * @param[in] n number of 2D-3D correspondences
118  * @param[in] cam_intrinsic Camera Intrinsic matrix
119  * @param[out] pose_mat Output pose vector 6X1, pose_mat[0:2]-> Translation, pose_mat[3:5] -> Quaternion vector component
120  * @return success flag
121  */
122  bool ppnp(const Eigen::Ref<Eigen::MatrixXd> obj_pts, const Eigen::Ref<Eigen::MatrixXd> img_pts, int n, const Eigen::Ref<Eigen::MatrixXd> cam_intrinsic, Eigen::Ref<Eigen::MatrixXd> pose_mat);
123 
124  /**
125  * @brief \cite dementhon Pose from Orthogoanlity and Scaling :Iterative (POSIT) - A Geometric algorithm to compute scale and orthogonality independently
126  * @param[in] obj_pts Object points in Camera Co-ordinate system {C} nX3 array [p_x, p_y, p_z]
127  * @param[in] img_pts Image points in pixels nX3 array containing pixel data from camera [u, v, 1]
128  * @param[in] n number of 2D-3D correspondences
129  * @param[in] cam_intrinsic Camera Intrinsic matrix
130  * @param[out] pose_mat Output pose vector 6X1, pose_mat[0:2]-> Translation, pose_mat[3:5] -> Quaternion vector component
131  * @return success flag
132  */
133  bool posit(const Eigen::Ref<Eigen::MatrixXd> obj_pts, const Eigen::Ref<Eigen::MatrixXd> img_pts, int n, const Eigen::Ref<Eigen::MatrixXd> cam_intrinsic, Eigen::Ref<Eigen::MatrixXd> pose_mat);
134 
135  /**@brief \cite lu Lu-Hager-Mjolsness(LHM)-PnP algorithm : Iterative algorithm to reduce object space error
136  * @param[in] obj_pts Object points in Camera Co-ordinate system {C} nX3 array [p_x p_y p_z]
137  * @param[in] img_pts Image points in pixels nX3 array containing pixel data from camera [u, v, 1]
138  * @param[in] n number of 2D-3D correspondences
139  * @param[in] cam_intrinsic Camera Intrinsic matrix
140  * @param[out] pose_mat Output pose vector 6X1, pose_mat[0:2]-> Translation, pose_mat[3:5] -> Quaternion vector component
141  * @return success flag
142  */
143  bool lhm(const Eigen::Ref<Eigen::MatrixXd> obj_pts, const Eigen::Ref<Eigen::MatrixXd> img_pts, int n, const Eigen::Ref<Eigen::MatrixXd> cam_intrinsic, Eigen::Ref<Eigen::MatrixXd> pose_mat);
144 
145  };
146 
147  /** @} */ // end of grouping
148  }
149  }
150 }
151 
152 #endif
This class is used for Pose estimation from a known landmark using a monocular camera.
Definition: pnp_algos.h:47
GLenum GLsizei n
Definition: glext.h:4618
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020