g2o
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
g2o::SBACam Class Reference

#include <sbacam.h>

Inheritance diagram for g2o::SBACam:
Inheritance graph
[legend]
Collaboration diagram for g2o::SBACam:
Collaboration graph
[legend]

Public Member Functions

 SBACam ()
 
 SBACam (const Quaternion &r_, const Vector3 &t_)
 
 SBACam (const SE3Quat &p)
 
void update (const Vector6 &update)
 
void setKcam (double fx, double fy, double cx, double cy, double tx)
 
void setTransform ()
 
void setProjection ()
 
void setDr ()
 
- Public Member Functions inherited from g2o::SE3Quat
 SE3Quat ()
 
 SE3Quat (const Matrix3 &R, const Vector3 &t)
 
 SE3Quat (const Quaternion &q, const Vector3 &t)
 
template<typename Derived >
 SE3Quat (const Eigen::MatrixBase< Derived > &v)
 
const Vector3translation () const
 
void setTranslation (const Vector3 &t_)
 
const Quaternionrotation () const
 
void setRotation (const Quaternion &r_)
 
SE3Quat operator* (const SE3Quat &tr2) const
 
SE3Quatoperator*= (const SE3Quat &tr2)
 
Vector3 operator* (const Vector3 &v) const
 
SE3Quat inverse () const
 
double operator[] (int i) const
 
Vector7 toVector () const
 
void fromVector (const Vector7 &v)
 
Vector6 toMinimalVector () const
 
void fromMinimalVector (const Vector6 &v)
 
Vector6 log () const
 
Vector3 map (const Vector3 &xyz) const
 
Eigen::Matrix< double, 6, 6, Eigen::ColMajor > adj () const
 
Eigen::Matrix< double, 4, 4, Eigen::ColMajor > to_homogeneous_matrix () const
 
void normalizeRotation ()
 
 operator Isometry3 () const
 

Static Public Member Functions

static void transformW2F (Eigen::Matrix< double, 3, 4 > &m, const Vector3 &trans, const Quaternion &qrot)
 
static void transformF2W (Eigen::Matrix< double, 3, 4 > &m, const Vector3 &trans, const Quaternion &qrot)
 
- Static Public Member Functions inherited from g2o::SE3Quat
static SE3Quat exp (const Vector6 &update)
 

Public Attributes

Matrix3 Kcam
 
double baseline
 
Eigen::Matrix< double, 3, 4 > w2n
 
Eigen::Matrix< double, 3, 4 > w2i
 
Matrix3 dRdx
 
Matrix3 dRdy
 
Matrix3 dRdz
 
- Public Attributes inherited from g2o::SE3Quat
 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
 

Additional Inherited Members

- Protected Attributes inherited from g2o::SE3Quat
Quaternion _r
 
Vector3 _t
 

Detailed Description

Definition at line 46 of file sbacam.h.

Constructor & Destructor Documentation

◆ SBACam() [1/3]

g2o::SBACam::SBACam ( )

Definition at line 38 of file sbacam.cpp.

38 {
39 setKcam(1, 1, cst(0.5), cst(0.5), 0); // unit image projection
40}
void setKcam(double fx, double fy, double cx, double cy, double tx)
Definition sbacam.cpp:92
constexpr double cst(long double v)
Definition misc.h:60

References g2o::cst(), and setKcam().

◆ SBACam() [2/3]

g2o::SBACam::SBACam ( const Quaternion r_,
const Vector3 t_ 
)

Definition at line 43 of file sbacam.cpp.

43 : SE3Quat(r_, t_) {
44 Kcam.setZero();
47 setDr();
48}
void setTransform()
Definition sbacam.h:85
Matrix3 Kcam
Definition sbacam.h:51
void setProjection()
Definition sbacam.h:89
void setDr()
Definition sbacam.cpp:106

References Kcam, setDr(), setProjection(), and setTransform().

◆ SBACam() [3/3]

g2o::SBACam::SBACam ( const SE3Quat p)

Definition at line 50 of file sbacam.cpp.

50 : SE3Quat(p) {
51 Kcam.setZero();
54 setDr();
55}

References Kcam, setDr(), setProjection(), and setTransform().

Member Function Documentation

◆ setDr()

void g2o::SBACam::setDr ( )

Definition at line 106 of file sbacam.cpp.

106 {
107 // inefficient, just for testing
108 // use simple multiplications and additions for production code in calculating
109 // dRdx,y,z
110 Matrix3 dRidx, dRidy, dRidz;
111 dRidx << cst(0.0), cst(0.0), cst(0.0), cst(0.0), cst(0.0), cst(2.0), cst(0.0),
112 cst(-2.0), cst(0.0);
113 dRidy << cst(0.0), cst(0.0), cst(-2.0), cst(0.0), cst(0.0), cst(0.0),
114 cst(2.0), cst(0.0), cst(0.0);
115 dRidz << cst(0.0), cst(2.0), cst(0.0), cst(-2.0), cst(0.0), cst(0.0),
116 cst(0.0), cst(0.0), cst(0.0);
117
118 // for dS'*R', with dS the incremental change
119 dRdx = dRidx * w2n.block<3, 3>(0, 0);
120 dRdy = dRidy * w2n.block<3, 3>(0, 0);
121 dRdz = dRidz * w2n.block<3, 3>(0, 0);
122}
Matrix3 dRdx
Definition sbacam.h:60
Eigen::Matrix< double, 3, 4 > w2n
Definition sbacam.h:55
Matrix3 dRdy
Definition sbacam.h:60
Matrix3 dRdz
Definition sbacam.h:60
MatrixN< 3 > Matrix3
Definition eigen_types.h:72

References g2o::cst(), dRdx, dRdy, dRdz, and w2n.

Referenced by SBACam(), SBACam(), setKcam(), and update().

◆ setKcam()

void g2o::SBACam::setKcam ( double  fx,
double  fy,
double  cx,
double  cy,
double  tx 
)

Definition at line 92 of file sbacam.cpp.

92 {
93 Kcam.setZero();
94 Kcam(0, 0) = fx;
95 Kcam(1, 1) = fy;
96 Kcam(0, 2) = cx;
97 Kcam(1, 2) = cy;
98 Kcam(2, 2) = cst(1.0);
99 baseline = tx;
100 setTransform();
102 setDr();
103}
double baseline
Definition sbacam.h:52

References baseline, g2o::cst(), Kcam, setDr(), setProjection(), and setTransform().

Referenced by g2o::VertexCam::read(), and SBACam().

◆ setProjection()

void g2o::SBACam::setProjection ( )
inline

Definition at line 89 of file sbacam.h.

89{ w2i = Kcam * w2n; }
Eigen::Matrix< double, 3, 4 > w2i
Definition sbacam.h:56

Referenced by SBACam(), SBACam(), setKcam(), and update().

◆ setTransform()

void g2o::SBACam::setTransform ( )
inline

Definition at line 85 of file sbacam.h.

85{ transformW2F(w2n, _t, _r); }
static void transformW2F(Eigen::Matrix< double, 3, 4 > &m, const Vector3 &trans, const Quaternion &qrot)
Definition sbacam.cpp:75
Quaternion _r
Definition se3quat.h:44
Vector3 _t
Definition se3quat.h:45

Referenced by SBACam(), SBACam(), setKcam(), and update().

◆ transformF2W()

void g2o::SBACam::transformF2W ( Eigen::Matrix< double, 3, 4 > &  m,
const Vector3 trans,
const Quaternion qrot 
)
static

Definition at line 85 of file sbacam.cpp.

86 {
87 m.block<3, 3>(0, 0) = qrot.toRotationMatrix();
88 m.col(3) = trans;
89}

◆ transformW2F()

void g2o::SBACam::transformW2F ( Eigen::Matrix< double, 3, 4 > &  m,
const Vector3 trans,
const Quaternion qrot 
)
static

Definition at line 75 of file sbacam.cpp.

76 {
77 m.block<3, 3>(0, 0) = qrot.toRotationMatrix().transpose();
78 m.col(3).setZero(); // make sure there's no translation
79 Vector4 tt;
80 tt.head(3) = trans;
81 tt[3] = 1.0;
82 m.col(3) = -m * tt;
83}
VectorN< 4 > Vector4
Definition eigen_types.h:52

◆ update()

void g2o::SBACam::update ( const Vector6 update)

Definition at line 59 of file sbacam.cpp.

59 {
60 // position update
61 _t += update.head(3);
62 // small quaternion update
63 Quaternion qr;
64 qr.vec() = update.segment<3>(3);
65 qr.w() =
66 sqrt(cst(1.0) - qr.vec().squaredNorm()); // should always be positive
67 _r *= qr; // post-multiply
68 _r.normalize();
71 setDr();
72}
void update(const Vector6 &update)
Definition sbacam.cpp:59
Jet< T, N > sqrt(const Jet< T, N > &f)
Definition jet.h:444
Eigen::Quaternion< double > Quaternion
Definition eigen_types.h:81

References g2o::SE3Quat::_r, g2o::SE3Quat::_t, g2o::cst(), setDr(), setProjection(), setTransform(), and update().

Referenced by update().

Member Data Documentation

◆ baseline

double g2o::SBACam::baseline

◆ dRdx

Matrix3 g2o::SBACam::dRdx

◆ dRdy

Matrix3 g2o::SBACam::dRdy

◆ dRdz

Matrix3 g2o::SBACam::dRdz

◆ Kcam

Matrix3 g2o::SBACam::Kcam

◆ w2i

Eigen::Matrix<double, 3, 4> g2o::SBACam::w2i

◆ w2n

Eigen::Matrix<double, 3, 4> g2o::SBACam::w2n

The documentation for this class was generated from the following files: