gtsam  3.2.1
gtsam
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Cal3Unified.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 
23 #pragma once
24 
25 #include <gtsam/geometry/Cal3DS2_Base.h>
26 #include <gtsam/base/DerivedValue.h>
27 
28 namespace gtsam {
29 
43 class GTSAM_EXPORT Cal3Unified : public Cal3DS2_Base, public DerivedValue<Cal3Unified> {
44 
45  typedef Cal3Unified This;
46  typedef Cal3DS2_Base Base;
47 
48 private:
49 
50  double xi_; // mirror parameter
51 
52 public:
53  //Matrix K() const ;
54  //Eigen::Vector4d k() const { return Base::k(); }
55  Vector vector() const ;
56 
59 
61  Cal3Unified() : Base(), xi_(0) {}
62 
63  Cal3Unified(double fx, double fy, double s, double u0, double v0,
64  double k1, double k2, double p1 = 0.0, double p2 = 0.0, double xi = 0.0) :
65  Base(fx, fy, s, u0, v0, k1, k2, p1, p2), xi_(xi) {}
66 
70 
71  Cal3Unified(const Vector &v) ;
72 
76 
78  void print(const std::string& s = "") const ;
79 
81  bool equals(const Cal3Unified& K, double tol = 10e-9) const;
82 
86 
88  inline double xi() const { return xi_;}
89 
97  Point2 uncalibrate(const Point2& p,
98  boost::optional<Matrix&> Dcal = boost::none,
99  boost::optional<Matrix&> Dp = boost::none) const ;
100 
102  Point2 calibrate(const Point2& p, const double tol=1e-5) const;
103 
105  Point2 spaceToNPlane(const Point2& p) const;
106 
108  Point2 nPlaneToSpace(const Point2& p) const;
109 
113 
115  Cal3Unified retract(const Vector& d) const ;
116 
118  Vector localCoordinates(const Cal3Unified& T2) const ;
119 
121  virtual size_t dim() const { return 10 ; } //TODO: make a final dimension variable (also, usually size_t in other classes e.g. Pose2)
122 
124  static size_t Dim() { return 10; } //TODO: make a final dimension variable
125 
126 private:
127 
131 
133  friend class boost::serialization::access;
134  template<class Archive>
135  void serialize(Archive & ar, const unsigned int version)
136  {
137  ar & boost::serialization::make_nvp("Cal3Unified",
138  boost::serialization::base_object<Value>(*this));
139  ar & boost::serialization::make_nvp("Cal3Unified",
140  boost::serialization::base_object<Cal3DS2_Base>(*this));
141  ar & BOOST_SERIALIZATION_NVP(xi_);
142  }
143 
145 
146 };
147 
148 }
149 
Definition: Cal3DS2_Base.h:40
double xi() const
mirror parameter
Definition: Cal3Unified.h:88
Definition: Point2.h:35
Cal3Unified()
Default Constructor with only unit focal length.
Definition: Cal3Unified.h:61
virtual size_t dim() const
Return dimensions of calibration manifold object.
Definition: Cal3Unified.h:121
void print(const Matrix &A, const string &s, ostream &stream)
print a matrix
Definition: Matrix.cpp:183
Definition: Cal3Unified.h:43
Definition: DerivedValue.h:44
static size_t Dim()
Return dimensions of calibration manifold object.
Definition: Cal3Unified.h:124