g2o
Loading...
Searching...
No Matches
sbacam.h
Go to the documentation of this file.
1// g2o - General Graph Optimization
2// Copyright (C) 2011 Kurt Konolige
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions are
7// met:
8//
9// * Redistributions of source code must retain the above copyright notice,
10// this list of conditions and the following disclaimer.
11// * Redistributions in binary form must reproduce the above copyright
12// notice, this list of conditions and the following disclaimer in the
13// documentation and/or other materials provided with the distribution.
14//
15// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
16// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
18// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
21// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
37
38#ifndef G2O_SBACam_H
39#define G2O_SBACam_H
40
42#include "g2o_types_sba_api.h"
43
44namespace g2o {
45
47 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
48
49 public:
50 // camera matrix and stereo baseline
52 double baseline;
53
54 // transformations
55 Eigen::Matrix<double, 3, 4> w2n; // transform from world to node coordinates
56 Eigen::Matrix<double, 3, 4> w2i; // transform from world to image coordinates
57
58 // Derivatives of the rotation matrix transpose wrt quaternion xyz, used for
59 // calculating Jacobian wrt pose of a projection.
60 Matrix3 dRdx, dRdy, dRdz;
61
62 // initialize an object
63 SBACam();
64
65 // set the object pose
66 SBACam(const Quaternion& r_, const Vector3& t_);
67
68 SBACam(const SE3Quat& p);
69
70 // update from the linear solution
71 // defined in se3quat
72 void update(const Vector6& update);
73
74 // transforms
75 static void transformW2F(Eigen::Matrix<double, 3, 4>& m, const Vector3& trans,
76 const Quaternion& qrot);
77
78 static void transformF2W(Eigen::Matrix<double, 3, 4>& m, const Vector3& trans,
79 const Quaternion& qrot);
80
81 // set up camera matrix
82 void setKcam(double fx, double fy, double cx, double cy, double tx);
83
84 // set transform from world to cam coords
85 void setTransform() { transformW2F(w2n, _t, _r); }
86
87 // Set up world-to-image projection matrix (w2i), assumes camera parameters
88 // are filled.
89 void setProjection() { w2i = Kcam * w2n; }
90
91 // sets angle derivatives
92 void setDr();
93};
94
95// human-readable SBACam object
96std::ostream& operator<<(std::ostream& out_str, const SBACam& cam);
97
98} // namespace g2o
99
100#endif // SBACam
void setTransform()
Definition sbacam.h:85
Matrix3 Kcam
Definition sbacam.h:51
void setProjection()
Definition sbacam.h:89
Eigen::Matrix< double, 3, 4 > w2i
Definition sbacam.h:56
double baseline
Definition sbacam.h:52
Matrix3 dRdx
Definition sbacam.h:60
Eigen::Matrix< double, 3, 4 > w2n
Definition sbacam.h:55
#define G2O_TYPES_SBA_API
VectorN< 3 > Vector3
Definition eigen_types.h:51
MatrixN< 3 > Matrix3
Definition eigen_types.h:72
VectorN< 6 > Vector6
Definition eigen_types.h:53
std::ostream & operator<<(std::ostream &os, const G2OBatchStatistics &st)
Eigen::Quaternion< double > Quaternion
Definition eigen_types.h:81