Cal3DS2_Base.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 
41 class GTSAM_EXPORT Cal3DS2_Base : public Cal3 {
42  protected:
43  double k1_ = 0.0f, k2_ = 0.0f;
44  double p1_ = 0.0f, p2_ = 0.0f;
45  double tol_ = 1e-5;
46 
47  public:
48  enum { dimension = 9 };
49 
52 
54  Cal3DS2_Base() = default;
55 
56  Cal3DS2_Base(double fx, double fy, double s, double u0, double v0, double k1,
57  double k2, double p1 = 0.0, double p2 = 0.0, double tol = 1e-5)
58  : Cal3(fx, fy, s, u0, v0),
59  k1_(k1),
60  k2_(k2),
61  p1_(p1),
62  p2_(p2),
63  tol_(tol) {}
64 
65  ~Cal3DS2_Base() override {}
66 
70 
71  Cal3DS2_Base(const Vector9& v)
72  : Cal3(v(0), v(1), v(2), v(3), v(4)),
73  k1_(v(5)),
74  k2_(v(6)),
75  p1_(v(7)),
76  p2_(v(8)) {}
77 
81 
83  GTSAM_EXPORT friend std::ostream& operator<<(std::ostream& os,
84  const Cal3DS2_Base& cal);
85 
87  void print(const std::string& s = "") const override;
88 
90  bool equals(const Cal3DS2_Base& K, double tol = 1e-8) const;
91 
95 
97  inline double k1() const { return k1_; }
98 
100  inline double k2() const { return k2_; }
101 
103  inline double p1() const { return p1_; }
104 
106  inline double p2() const { return p2_; }
107 
109  Vector4 k() const { return Vector4(k1_, k2_, p1_, p2_); }
110 
112  Vector9 vector() const;
113 
121  Point2 uncalibrate(const Point2& p, OptionalJacobian<2, 9> Dcal = boost::none,
122  OptionalJacobian<2, 2> Dp = boost::none) const;
123 
125  Point2 calibrate(const Point2& p, OptionalJacobian<2, 9> Dcal = boost::none,
126  OptionalJacobian<2, 2> Dp = boost::none) const;
127 
129  Matrix2 D2d_intrinsic(const Point2& p) const;
130 
132  Matrix29 D2d_calibration(const Point2& p) const;
133 
135  size_t dim() const override { return Dim(); }
136 
138  inline static size_t Dim() { return dimension; }
139 
143 
145  virtual boost::shared_ptr<Cal3DS2_Base> clone() const {
146  return boost::shared_ptr<Cal3DS2_Base>(new Cal3DS2_Base(*this));
147  }
148 
150 
151  private:
154 
156  friend class boost::serialization::access;
157  template <class Archive>
158  void serialize(Archive& ar, const unsigned int /*version*/) {
159  ar& boost::serialization::make_nvp(
160  "Cal3DS2_Base", boost::serialization::base_object<Cal3>(*this));
161  ar& BOOST_SERIALIZATION_NVP(k1_);
162  ar& BOOST_SERIALIZATION_NVP(k2_);
163  ar& BOOST_SERIALIZATION_NVP(p1_);
164  ar& BOOST_SERIALIZATION_NVP(p2_);
165  ar& BOOST_SERIALIZATION_NVP(tol_);
166  }
167 
169 };
170 }
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:155
double p2() const
Second tangential distortion coefficient.
Definition: Cal3DS2_Base.h:106
std::ostream & operator<<(std::ostream &os, const Dih6 &m)
Definition: testGroup.cpp:109
static size_t Dim()
return DOF, dimensionality of tangent space
Definition: Cal3DS2_Base.h:138
Vector3f p1
Vector4 k() const
return distortion parameter vector
Definition: Cal3DS2_Base.h:109
Vector2 Point2
Definition: Point2.h:27
ArrayXcf v
Definition: Cwise_arg.cpp:1
static Cal3_S2 K(500, 500, 0.1, 640/2, 480/2)
Cal3DS2_Base(double fx, double fy, double s, double u0, double v0, double k1, double k2, double p1=0.0, double p2=0.0, double tol=1e-5)
Definition: Cal3DS2_Base.h:56
double p1() const
First tangential distortion coefficient.
Definition: Cal3DS2_Base.h:103
size_t dim() const override
return DOF, dimensionality of tangent space
Definition: Cal3DS2_Base.h:135
~Cal3DS2_Base() override
Definition: Cal3DS2_Base.h:65
const double fy
Array< double, 1, 3 > e(1./3., 0.5, 2.)
RealScalar s
Common code for all Calibration models.
static const double u0
virtual boost::shared_ptr< Cal3DS2_Base > clone() const
Definition: Cal3DS2_Base.h:145
traits
Definition: chartTesting.h:28
double k1() const
First distortion coefficient.
Definition: Cal3DS2_Base.h:97
ofstream os("timeSchurFactors.csv")
static const double v0
double k2() const
Second distortion coefficient.
Definition: Cal3DS2_Base.h:100
void serialize(Archive &ar, const unsigned int)
Definition: Cal3DS2_Base.h:158
Point2_ uncalibrate(const Expression< CALIBRATION > &K, const Point2_ &xy_hat)
float * p
static Point3 p2
const G double tol
Definition: Group.h:83
const double fx
2D Point
Cal3DS2_Base(const Vector9 &v)
Definition: Cal3DS2_Base.h:71


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