proj.h
Go to the documentation of this file.
1 #ifndef _PROJ_H_
2 #define _PROJ_H_
3 
4 #ifndef EIGEN_USE_NEW_STDVECTOR
5 #define EIGEN_USE_NEW_STDVECTOR
6 #endif // EIGEN_USE_NEW_STDVECTOR
7 
8 #include <Eigen/Core>
9 #include <Eigen/Geometry>
10 #include <Eigen/LU>
11 #include <Eigen/StdVector>
12 #include <map>
13 
15 
16 namespace sba
17 {
18  class JacobProds
19  {
20  public:
21  EIGEN_MAKE_ALIGNED_OPERATOR_NEW // needed for 16B alignment
22 
24  {
25  Hpp.setZero();
26  Hpc.setZero();
27  Hcc.setZero();
28  Bp.setZero();
29  JcTE.setZero();
30  }
31 
33  Eigen::Matrix<double,3,3> Hpp;
34 
36  Eigen::Matrix<double,3,6> Hpc;
37 
39  Eigen::Matrix<double,6,6> Hcc;
40 
42  Eigen::Matrix<double,3,1> Bp;
43 
45  Eigen::Matrix<double,6,1> JcTE;
46  };
47 
48  class Proj; // Forward reference.
49 
52  typedef std::map<const int, Proj, std::less<int>, Eigen::aligned_allocator<Proj> > ProjMap;
53 
57  class Proj
58  {
59  public:
60 
61  EIGEN_MAKE_ALIGNED_OPERATOR_NEW // needed for 16B alignment
62 
66  Proj(int ci, Eigen::Vector3d &q, bool stereo = true);
67 
71  Proj(int ci, Eigen::Vector2d &q);
72 
75  Proj();
76 
78  int ndi;
79 
81  Eigen::Vector3d kp;
82 
84  Eigen::Vector3d err;
85 
87  bool stereo;
88 
90  double calcErr(const Node &nd, const Point &pt, double huber = 0.0);
91 
94  double getErrSquaredNorm();
95 
98  double getErrNorm();
99 
101 
117  void setJacobians(const Node &nd, const Point &pt, JacobProds *jpp);
118 
121 
124  Eigen::Matrix<double,6,3> Tpc;
125 
127  bool isValid;
128 
131  static constexpr double qScale = 1.0;
132 
134  bool useCovar;
135 
137  Eigen::Matrix<double,3,3> covarmat;
138 
141 
143  Eigen::Vector3d plane_normal;
144 
146  Eigen::Vector3d plane_point;
147 
150 
153 
155  Eigen::Vector3d plane_local_normal;
156 
162  void setCovariance(const Eigen::Matrix3d &covar);
163 
165  void clearCovariance();
166 
167 
168  protected:
170  void setJacobiansMono_(const Node &nd, const Point &pt, JacobProds *jpp);
171 
173  void setJacobiansStereo_(const Node &nd, const Point &pt, JacobProds *jpp);
174 
176  double calcErrMono_(const Node &nd, const Point &pt, double huber);
177 
179  double calcErrStereo_(const Node &nd, const Point &pt, double huber);
180  };
181 
182  class Track
183  {
184  public:
186  Track(Point p);
187 
189  Track();
190 
194 
198  };
199 
200 
201 } // sba
202 
203 #endif // _PROJ_H
sba::Proj::covarmat
Eigen::Matrix< double, 3, 3 > covarmat
Covariance matrix for cost calculation.
Definition: proj.h:137
sba::Proj::plane_normal
Eigen::Vector3d plane_normal
Normal for point-plane projections.
Definition: proj.h:143
sba::Proj::setJacobiansMono_
void setJacobiansMono_(const Node &nd, const Point &pt, JacobProds *jpp)
Set monocular jacobians/hessians.
Definition: proj.cpp:60
sba::JacobProds::Hpc
Eigen::Matrix< double, 3, 6 > Hpc
Point-to-camera Hessian (JpT*Jc)
Definition: proj.h:36
sba::Proj::plane_local_normal
Eigen::Vector3d plane_local_normal
Original normal in plane_node_index coordinate's frame.
Definition: proj.h:155
sba::Point
Eigen::Vector4d Point
Point holds 3D points using in world coordinates. Currently we just represent these as 4-vectors,...
Definition: node.h:43
sba::Track::projections
ProjMap projections
A map of all the projections of the point with camera index as key, based off an STL map.
Definition: proj.h:193
sba::Proj::setCovariance
void setCovariance(const Eigen::Matrix3d &covar)
Set the covariance matrix to use for cost calculation. Without the covariance matrix,...
Definition: proj.cpp:49
sba::JacobProds::Hpp
Eigen::Matrix< double, 3, 3 > Hpp
Point-to-point Hessian (JpT*Jp).
Definition: proj.h:33
sba::Proj::setJacobiansStereo_
void setJacobiansStereo_(const Node &nd, const Point &pt, JacobProds *jpp)
Set stereo jacobians/hessians.
Definition: proj.cpp:190
sba::Proj::clearCovariance
void clearCovariance()
Clear the covariance matrix and no longer use it.
Definition: proj.cpp:55
sba::Proj::qScale
static constexpr double qScale
Definition: proj.h:131
sba::Proj::calcErr
double calcErr(const Node &nd, const Point &pt, double huber=0.0)
Calculates re-projection error and stores it in err.
Definition: proj.cpp:25
sba::JacobProds
Definition: proj.h:18
sba::Proj::err
Eigen::Vector3d err
Reprojection error.
Definition: proj.h:84
sba::Proj::Proj
Proj()
Default constructor. Initializes to default values, kp = <0 0 0> and ndi = <0>. Also sets the project...
Definition: proj.cpp:13
sba::Proj::plane_node_index
int plane_node_index
Point-plane node index in SBA.
Definition: proj.h:152
sba::Track
Definition: proj.h:182
sba::JacobProds::Hcc
Eigen::Matrix< double, 6, 6 > Hcc
Camera-to-camera Hessian (JcT*Jc)
Definition: proj.h:39
sba::Proj::Tpc
Eigen::Matrix< double, 6, 3 > Tpc
Definition: proj.h:124
sba::JacobProds::Bp
Eigen::Matrix< double, 3, 1 > Bp
The B matrix with respect to points (JpT*Err)
Definition: proj.h:42
sba::Proj::setJacobians
void setJacobians(const Node &nd, const Point &pt, JacobProds *jpp)
Sets the jacobians and hessians for the projection to use for SBA.
Definition: proj.cpp:17
sba::Proj::useCovar
bool useCovar
Use a covariance matrix?
Definition: proj.h:134
sba::JacobProds::JacobProds
EIGEN_MAKE_ALIGNED_OPERATOR_NEW JacobProds()
Definition: proj.h:23
sba::Proj::getErrNorm
double getErrNorm()
Get the correct norm of the error, depending on whether the projection is monocular or stereo.
Definition: proj.cpp:33
sba::Proj::plane_point_index
int plane_point_index
Point-plane match point index in SBA.
Definition: proj.h:149
sba
Definition: bpcg.h:60
sba::Proj::stereo
bool stereo
Whether the projection is Stereo (True) or Monocular (False).
Definition: proj.h:87
node.h
sba::Proj::plane_point
Eigen::Vector3d plane_point
Point for point-plane projections.
Definition: proj.h:146
sba::ProjMap
std::map< const int, Proj, std::less< int >, Eigen::aligned_allocator< Proj > > ProjMap
Definition: proj.h:48
sba::JacobProds::JcTE
Eigen::Matrix< double, 6, 1 > JcTE
Another matrix with respect to cameras (JcT*Err)
Definition: proj.h:45
sba::Proj::ndi
int ndi
Node index, the camera node for this projection.
Definition: proj.h:78
sba::Track::point
Point point
An Eigen 4-vector containing the <x, y, z, w> coordinates of the point associated with the track.
Definition: proj.h:197
sba::Proj::calcErrMono_
double calcErrMono_(const Node &nd, const Point &pt, double huber)
Calculate error function for stereo.
Definition: proj.cpp:143
sba::Proj::pointPlane
bool pointPlane
Whether this is a point-plane match (true) or a point-point match (false).
Definition: proj.h:140
sba::Proj::isValid
bool isValid
valid or not (could be out of bounds)
Definition: proj.h:127
sba::Proj::jp
JacobProds * jp
Jacobian products.
Definition: proj.h:120
sba::Proj::getErrSquaredNorm
double getErrSquaredNorm()
Get the correct squared norm of the error, depending on whether the projection is monocular or stereo...
Definition: proj.cpp:41
sba::Track::Track
Track()
Default constructor for Track.
Definition: proj.cpp:356
sba::Proj::calcErrStereo_
double calcErrStereo_(const Node &nd, const Point &pt, double huber)
Calculate error function for stereo.
Definition: proj.cpp:288
sba::Proj::kp
Eigen::Vector3d kp
Keypoint, u,v,u-d vector.
Definition: proj.h:81
sba::Node
NODE holds graph nodes corresponding to frames, for use in sparse bundle adjustment....
Definition: node.h:63
sba::Proj
Proj holds a projection measurement of a point onto a frame. They are a repository for the link betwe...
Definition: proj.h:57


sparse_bundle_adjustment
Author(s):
autogenerated on Wed Mar 2 2022 01:03:04