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 
20 #pragma once
21 
22 #include <gtsam/geometry/Cal3.h>
23 #include <gtsam/geometry/Point2.h>
24 
25 namespace gtsam {
26 
32 class GTSAM_EXPORT Cal3Bundler : public Cal3 {
33  private:
34  double k1_ = 0.0f, k2_ = 0.0f;
35  double tol_ = 1e-5;
36 
37  // NOTE: We use the base class fx to represent the common focal length.
38  // Also, image center parameters (u0, v0) are not optimized
39  // but are treated as constants.
40 
41  public:
42  enum { dimension = 3 };
43 
46 
48  Cal3Bundler() = default;
49 
59  Cal3Bundler(double f, double k1, double k2, double u0 = 0, double v0 = 0,
60  double tol = 1e-5)
61  : Cal3(f, f, 0, u0, v0), k1_(k1), k2_(k2), tol_(tol) {}
62 
63  ~Cal3Bundler() override {}
64 
68 
70  GTSAM_EXPORT friend std::ostream& operator<<(std::ostream& os,
71  const Cal3Bundler& cal);
72 
74  void print(const std::string& s = "") const override;
75 
77  bool equals(const Cal3Bundler& K, double tol = 10e-9) const;
78 
82 
84  inline double k1() const { return k1_; }
85 
87  inline double k2() const { return k2_; }
88 
90  inline double px() const { return u0_; }
91 
93  inline double py() const { return v0_; }
94 
95  Matrix3 K() const override;
96  Vector4 k() const;
97 
98  Vector3 vector() const;
99 
100 #ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V41
101  inline double u0() const { return u0_; }
103 
105  inline double v0() const { return v0_; }
106 #endif
107 
116  Point2 uncalibrate(const Point2& p, OptionalJacobian<2, 3> Dcal = boost::none,
117  OptionalJacobian<2, 2> Dp = boost::none) const;
118 
127  Point2 calibrate(const Point2& pi, OptionalJacobian<2, 3> Dcal = boost::none,
128  OptionalJacobian<2, 2> Dp = boost::none) const;
129 
131  Matrix2 D2d_intrinsic(const Point2& p) const;
132 
134  Matrix23 D2d_calibration(const Point2& p) const;
135 
137  Matrix25 D2d_intrinsic_calibration(const Point2& p) const;
138 
142 
144  size_t dim() const override { return Dim(); }
145 
147  inline static size_t Dim() { return dimension; }
148 
150  inline Cal3Bundler retract(const Vector& d) const {
151  return Cal3Bundler(fx_ + d(0), k1_ + d(1), k2_ + d(2), u0_, v0_);
152  }
153 
156  return T2.vector() - vector();
157  }
158 
159  private:
163 
165  friend class boost::serialization::access;
166  template <class Archive>
167  void serialize(Archive& ar, const unsigned int /*version*/) {
168  ar& boost::serialization::make_nvp(
169  "Cal3Bundler", boost::serialization::base_object<Cal3>(*this));
170  ar& BOOST_SERIALIZATION_NVP(k1_);
171  ar& BOOST_SERIALIZATION_NVP(k2_);
172  ar& BOOST_SERIALIZATION_NVP(tol_);
173  }
174 
176 };
177 
178 template <>
179 struct traits<Cal3Bundler> : public internal::Manifold<Cal3Bundler> {};
180 
181 template <>
182 struct traits<const Cal3Bundler> : public internal::Manifold<Cal3Bundler> {};
183 
184 } // namespace gtsam
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:155
Both ManifoldTraits and Testable.
Definition: Manifold.h:120
Vector3 vector() const
Definition: Cal3Bundler.cpp:42
std::ostream & operator<<(std::ostream &os, const Dih6 &m)
Definition: testGroup.cpp:109
Eigen::Vector3d Vector3
Definition: Vector.h:43
double k1() const
distorsion parameter k1
Definition: Cal3Bundler.h:84
Vector2 Point2
Definition: Point2.h:27
static Cal3_S2 K(500, 500, 0.1, 640/2, 480/2)
Pose2 T2(M_PI/2.0, Point2(0.0, 2.0))
double k2() const
distorsion parameter k2
Definition: Cal3Bundler.h:87
Cal3Bundler retract(const Vector &d) const
Update calibration with tangent space delta.
Definition: Cal3Bundler.h:150
~Cal3Bundler() override
Definition: Cal3Bundler.h:63
Eigen::VectorXd Vector
Definition: Vector.h:38
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
RealScalar s
Common code for all Calibration models.
static const double u0
double px() const
image center in x
Definition: Cal3Bundler.h:90
size_t dim() const override
return DOF, dimensionality of tangent space
Definition: Cal3Bundler.h:144
traits
Definition: chartTesting.h:28
Cal3Bundler(double f, double k1, double k2, double u0=0, double v0=0, double tol=1e-5)
Definition: Cal3Bundler.h:59
ofstream os("timeSchurFactors.csv")
static const double v0
Vector3 localCoordinates(const Cal3Bundler &T2) const
Calculate local coordinates to another calibration.
Definition: Cal3Bundler.h:155
Point2_ uncalibrate(const Expression< CALIBRATION > &K, const Point2_ &xy_hat)
float * p
void serialize(Archive &ar, const unsigned int)
Definition: Cal3Bundler.h:167
const G double tol
Definition: Group.h:83
static size_t Dim()
return DOF, dimensionality of tangent space
Definition: Cal3Bundler.h:147
double py() const
image center in y
Definition: Cal3Bundler.h:93
2D Point


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:41:44