Main MRPT website > C++ reference for MRPT 1.9.9
posit.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 
10 #include <mrpt/math/types_math.h> // Eigen must be included first via MRPT to enable the plugin system
11 #include <Eigen/Dense>
12 #include <Eigen/SVD>
13 
14 #include <iostream>
15 
16 #define LOOP_MAX_COUNT 30
17 
18 namespace mrpt
19 {
20 namespace vision
21 {
22 namespace pnp
23 {
24 /** \addtogroup pnp Perspective-n-Point pose estimation
25  * \ingroup mrpt_vision_grp
26  * @{
27  */
28 
29 /**
30  * @class POSIT
31  * @author Chandra Mangipudi
32  * @date 10/08/16
33  * @file posit.h
34  * @brief Pose from Orthogonality and Scaling (POSIT) - Eigen Implementation
35  */
36 class posit
37 {
38  Eigen::MatrixXd obj_pts; //! Object Points in Camera Co-ordinate system
39  Eigen::MatrixXd img_pts; //! Image Points in pixels
40  Eigen::MatrixXd cam_intrinsic; //! Camera Intrinsic matrix
41  Eigen::MatrixXd obj_matrix; //! Pseudo-Inverse of Object Points matrix
42 
43  double f; //! Focal Length from camera intrinsic matrix
44  Eigen::VectorXd epsilons; //! Co-efficients used for scaling
45  int n; //! Number of 2d/3d correspondences
46 
47  Eigen::MatrixXd R; //! Rotation Matrix
48  Eigen::VectorXd t; //! Translation Vector
49 
50  Eigen::MatrixXd obj_vecs; //! Object Points relative to 1st object point
51  Eigen::MatrixXd img_vecs; //! Image Points relative to 1st image point
52  Eigen::MatrixXd
53  img_vecs_old; //! Used to store img_vecs from previous iteration
54 
55  public:
56  //! Constructor for P-PnP class
57  posit(
58  Eigen::MatrixXd obj_pts_, Eigen::MatrixXd img_pts_,
59  Eigen::MatrixXd camera_intrinsic_, int n);
60 
61  /**
62  * @brief Function used to compute pose from orthogonality
63  */
64  void POS();
65 
66  /**
67  * @brief Computes pose using iterative computation of @func POS()
68  * @param[out] R_
69  * @param[out] t_
70  * @return true on success
71  */
72  bool compute_pose(
73  Eigen::Ref<Eigen::Matrix3d> R_, Eigen::Ref<Eigen::Vector3d> t_);
74 
75  /**
76  * @brief Function to check for convergence
77  * @return Representative value of error
78  */
79  long get_img_diff();
80 };
81 
82 /** @} */ // end of grouping
83 }
84 }
85 }
n
GLenum GLsizei n
Definition: glext.h:5074
mrpt::vision::pnp::posit
Definition: posit.h:36
mrpt::vision::pnp::posit::get_img_diff
long get_img_diff()
Function to check for convergence.
Definition: posit.cpp:139
mrpt::vision::pnp::posit::posit
posit(Eigen::MatrixXd obj_pts_, Eigen::MatrixXd img_pts_, Eigen::MatrixXd camera_intrinsic_, int n)
Used to store img_vecs from previous iteration.
Definition: posit.cpp:18
mrpt::vision::pnp::posit::compute_pose
bool compute_pose(Eigen::Ref< Eigen::Matrix3d > R_, Eigen::Ref< Eigen::Vector3d > t_)
Computes pose using iterative computation of @func POS()
Definition: posit.cpp:84
mrpt::vision::pnp::posit::POS
void POS()
Function used to compute pose from orthogonality.
Definition: posit.cpp:45
mrpt::vision::pnp::posit::obj_matrix
Eigen::MatrixXd obj_matrix
Camera Intrinsic matrix.
Definition: posit.h:41
mrpt::vision::pnp::posit::img_vecs
Eigen::MatrixXd img_vecs
Object Points relative to 1st object point.
Definition: posit.h:51
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::vision::pnp::posit::cam_intrinsic
Eigen::MatrixXd cam_intrinsic
Image Points in pixels.
Definition: posit.h:40
mrpt::vision::pnp::posit::obj_vecs
Eigen::MatrixXd obj_vecs
Translation Vector.
Definition: posit.h:50
mrpt::vision::pnp::posit::n
int n
Co-efficients used for scaling.
Definition: posit.h:45
mrpt::vision::pnp::posit::img_pts
Eigen::MatrixXd img_pts
Object Points in Camera Co-ordinate system.
Definition: posit.h:39
mrpt::vision::pnp::posit::epsilons
Eigen::VectorXd epsilons
Focal Length from camera intrinsic matrix.
Definition: posit.h:44
mrpt::vision::pnp::posit::R
Eigen::MatrixXd R
Number of 2d/3d correspondences.
Definition: posit.h:47
mrpt::vision::pnp::posit::obj_pts
Eigen::MatrixXd obj_pts
Definition: posit.h:38
mrpt::vision::pnp::posit::t
Eigen::VectorXd t
Rotation Matrix.
Definition: posit.h:48
mrpt::vision::pnp::posit::img_vecs_old
Eigen::MatrixXd img_vecs_old
Image Points relative to 1st image point.
Definition: posit.h:53
types_math.h
mrpt::vision::pnp::posit::f
double f
Pseudo-Inverse of Object Points matrix.
Definition: posit.h:43



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