gtsam  4.0.0
gtsam
Cal3Bundler.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
19 #pragma once
20 
21 #include <gtsam/geometry/Point2.h>
22 
23 namespace gtsam {
24 
30 class GTSAM_EXPORT Cal3Bundler {
31 
32 private:
33  double f_;
34  double k1_, k2_;
35  double u0_, v0_;
36 
37 public:
38 
39  enum { dimension = 3 };
40 
43 
45  Cal3Bundler();
46 
55  Cal3Bundler(double f, double k1, double k2, double u0 = 0, double v0 = 0);
56 
57  virtual ~Cal3Bundler() {}
58 
62 
64  void print(const std::string& s = "") const;
65 
67  bool equals(const Cal3Bundler& K, double tol = 10e-9) const;
68 
72 
73  Matrix3 K() const;
74  Vector4 k() const;
75 
76  Vector3 vector() const;
77 
79  inline double fx() const {
80  return f_;
81  }
82 
84  inline double fy() const {
85  return f_;
86  }
87 
89  inline double k1() const {
90  return k1_;
91  }
92 
94  inline double k2() const {
95  return k2_;
96  }
97 
99  inline double u0() const {
100  return u0_;
101  }
102 
104  inline double v0() const {
105  return v0_;
106  }
107 
108 
117  Point2 uncalibrate(const Point2& p, OptionalJacobian<2, 3> Dcal = boost::none,
118  OptionalJacobian<2, 2> Dp = boost::none) const;
119 
121  Point2 calibrate(const Point2& pi, const double tol = 1e-5) const;
122 
124  Matrix2 D2d_intrinsic(const Point2& p) const;
125 
127  Matrix23 D2d_calibration(const Point2& p) const;
128 
130  Matrix25 D2d_intrinsic_calibration(const Point2& p) const;
131 
135 
137  Cal3Bundler retract(const Vector& d) const;
138 
140  Vector3 localCoordinates(const Cal3Bundler& T2) const;
141 
143  virtual size_t dim() const {
144  return 3;
145  }
146 
148  static size_t Dim() {
149  return 3;
150  }
151 
152 private:
153 
157 
159  friend class boost::serialization::access;
160  template<class Archive>
161  void serialize(Archive & ar, const unsigned int /*version*/) {
162  ar & BOOST_SERIALIZATION_NVP(f_);
163  ar & BOOST_SERIALIZATION_NVP(k1_);
164  ar & BOOST_SERIALIZATION_NVP(k2_);
165  ar & BOOST_SERIALIZATION_NVP(u0_);
166  ar & BOOST_SERIALIZATION_NVP(v0_);
167  }
168 
170 
171 };
172 
173 template<>
174 struct traits<Cal3Bundler> : public internal::Manifold<Cal3Bundler> {};
175 
176 template<>
177 struct traits<const Cal3Bundler> : public internal::Manifold<Cal3Bundler> {};
178 
179 } // namespace gtsam
static size_t Dim()
dimensionality
Definition: Cal3Bundler.h:148
Both ManifoldTraits and Testable.
Definition: Manifold.h:120
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:141
Definition: Cal3Bundler.h:30
double k2() const
distorsion parameter k2
Definition: Cal3Bundler.h:94
double fx() const
focal length x
Definition: Cal3Bundler.h:79
double k1() const
distorsion parameter k1
Definition: Cal3Bundler.h:89
Template to create a binary predicate.
Definition: Testable.h:110
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition: OptionalJacobian.h:39
2D Point
double v0() const
get parameter v0
Definition: Cal3Bundler.h:104
double u0() const
get parameter u0
Definition: Cal3Bundler.h:99
double fy() const
focal length y
Definition: Cal3Bundler.h:84
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
Definition: Point2.h:40
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
virtual size_t dim() const
dimensionality
Definition: Cal3Bundler.h:143