gtsam  3.2.1
gtsam
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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/base/DerivedValue.h>
22 #include <gtsam/geometry/Point2.h>
23 
24 namespace gtsam {
25 
31 class GTSAM_EXPORT Cal3Bundler: public DerivedValue<Cal3Bundler> {
32 
33 private:
34  double f_;
35  double k1_, k2_;
36  double u0_, v0_;
37 
38 public:
39 
42 
44  Cal3Bundler();
45 
54  Cal3Bundler(double f, double k1, double k2, double u0 = 0, double v0 = 0);
55 
56  virtual ~Cal3Bundler() {}
57 
61 
63  void print(const std::string& s = "") const;
64 
66  bool equals(const Cal3Bundler& K, double tol = 10e-9) const;
67 
71 
72  Matrix K() const;
73  Vector k() const;
74 
75  Vector vector() const;
76 
78  inline double fx() const {
79  return f_;
80  }
81 
83  inline double fy() const {
84  return f_;
85  }
86 
88  inline double k1() const {
89  return k1_;
90  }
91 
93  inline double k2() const {
94  return k2_;
95  }
96 
98  inline double u0() const {
99  return u0_;
100  }
101 
103  inline double v0() const {
104  return v0_;
105  }
106 
107 
115  Point2 uncalibrate(const Point2& p, boost::optional<Matrix&> Dcal =
116  boost::none, boost::optional<Matrix&> Dp = boost::none) const;
117 
119  Point2 calibrate(const Point2& pi, const double tol = 1e-5) const;
120 
122  Matrix D2d_intrinsic(const Point2& p) const;
123 
125  Matrix D2d_calibration(const Point2& p) const;
126 
128  Matrix D2d_intrinsic_calibration(const Point2& p) const;
129 
133 
135  Cal3Bundler retract(const Vector& d) const;
136 
138  Vector localCoordinates(const Cal3Bundler& T2) const;
139 
141  virtual size_t dim() const {
142  return 3;
143  }
144 
146  static size_t Dim() {
147  return 3;
148  }
149 
150 private:
151 
155 
157  friend class boost::serialization::access;
158  template<class Archive>
159  void serialize(Archive & ar, const unsigned int version) {
160  ar
161  & boost::serialization::make_nvp("Cal3Bundler",
162  boost::serialization::base_object<Value>(*this));
163  ar & BOOST_SERIALIZATION_NVP(f_);
164  ar & BOOST_SERIALIZATION_NVP(k1_);
165  ar & BOOST_SERIALIZATION_NVP(k2_);
166  ar & BOOST_SERIALIZATION_NVP(u0_);
167  ar & BOOST_SERIALIZATION_NVP(v0_);
168  }
169 
171 
172  };
173 
174  } // namespace gtsam
double fy() const
focal length y
Definition: Cal3Bundler.h:83
double u0() const
get parameter u0
Definition: Cal3Bundler.h:98
double k1() const
distorsion parameter k1
Definition: Cal3Bundler.h:88
virtual size_t dim() const
dimensionality
Definition: Cal3Bundler.h:141
Definition: Point2.h:35
static size_t Dim()
dimensionality
Definition: Cal3Bundler.h:146
2D Point
double k2() const
distorsion parameter k2
Definition: Cal3Bundler.h:93
void print(const Matrix &A, const string &s, ostream &stream)
print a matrix
Definition: Matrix.cpp:183
Template to create a binary predicate.
Definition: Testable.h:102
Definition: Cal3Bundler.h:31
double v0() const
get parameter v0
Definition: Cal3Bundler.h:103
Definition: DerivedValue.h:44
double fx() const
focal length x
Definition: Cal3Bundler.h:78