gtsam  3.2.1
gtsam
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Cal3_S2Stereo.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 
18 #pragma once
19 
20 #include <gtsam/geometry/Cal3_S2.h>
21 
22 namespace gtsam {
23 
29  class Cal3_S2Stereo {
30  private:
31 
32  Cal3_S2 K_;
33  double b_;
34 
35  public:
36 
37  typedef boost::shared_ptr<Cal3_S2Stereo> shared_ptr;
38 
41 
44  K_(1, 1, 0, 0, 0), b_(1.0) {
45  }
46 
48  Cal3_S2Stereo(double fx, double fy, double s, double u0, double v0, double b) :
49  K_(fx, fy, s, u0, v0), b_(b) {
50  }
51 
53  Cal3_S2Stereo(const Vector &d): K_(d(0), d(1), d(2), d(3), d(4)), b_(d(5)){}
54 
58 
59  void print(const std::string& s = "") const {
60  K_.print(s+"K: ");
61  std::cout << s << "Baseline: " << b_ << std::endl;
62  }
63 
65  bool equals(const Cal3_S2Stereo& other, double tol = 10e-9) const {
66  if (fabs(b_ - other.b_) > tol) return false;
67  return K_.equals(other.K_,tol);
68  }
69 
73 
75  const Cal3_S2& calibration() const { return K_;}
76 
78  Matrix matrix() const { return K_.matrix();}
79 
81  inline double fx() const { return K_.fx();}
82 
84  inline double fy() const { return K_.fy();}
85 
87  inline double skew() const { return K_.skew();}
88 
90  inline double px() const { return K_.px();}
91 
93  inline double py() const { return K_.py();}
94 
96  Point2 principalPoint() const { return K_.principalPoint();}
97 
99  inline double baseline() const { return b_; }
100 
104 
105  private:
108  template<class Archive>
109  void serialize(Archive & ar, const unsigned int version)
110  {
111  ar & BOOST_SERIALIZATION_NVP(K_);
112  ar & BOOST_SERIALIZATION_NVP(b_);
113  }
115 
116  };
117 } // \ namespace gtsam
Definition: Cal3_S2Stereo.h:29
Cal3_S2Stereo(double fx, double fy, double s, double u0, double v0, double b)
constructor from doubles
Definition: Cal3_S2Stereo.h:48
double py() const
image center in y
Definition: Cal3_S2.h:110
Matrix matrix() const
Definition: Cal3_S2.h:133
void print(const std::string &s="Cal3_S2") const
print with optional string
Definition: Cal3_S2.cpp:55
Matrix matrix() const
return calibration matrix K, same for left and right
Definition: Cal3_S2Stereo.h:78
boost::shared_ptr< Cal3_S2Stereo > shared_ptr
shared pointer to stereo calibration object
Definition: Cal3_S2Stereo.h:37
Definition: Cal3_S2.h:34
const Cal3_S2 & calibration() const
return calibration, same for left and right
Definition: Cal3_S2Stereo.h:75
double fx() const
focal length x
Definition: Cal3_S2Stereo.h:81
Definition: Point2.h:35
friend class boost::serialization::access
Serialization function.
Definition: Cal3_S2Stereo.h:107
double px() const
image center in x
Definition: Cal3_S2Stereo.h:90
double fx() const
focal length x
Definition: Cal3_S2.h:90
double skew() const
skew
Definition: Cal3_S2.h:100
bool equals(const Cal3_S2 &K, double tol=10e-9) const
Check if equal up to specified tolerance.
Definition: Cal3_S2.cpp:60
The most common 5DOF 3D->2D calibration.
bool equals(const Cal3_S2Stereo &other, double tol=10e-9) const
Check if equal up to specified tolerance.
Definition: Cal3_S2Stereo.h:65
Point2 principalPoint() const
return the principal point
Definition: Cal3_S2Stereo.h:96
double py() const
image center in y
Definition: Cal3_S2Stereo.h:93
double px() const
image center in x
Definition: Cal3_S2.h:105
Point2 principalPoint() const
return the principal point
Definition: Cal3_S2.h:115
Cal3_S2Stereo()
default calibration leaves coordinates unchanged
Definition: Cal3_S2Stereo.h:43
double baseline() const
return baseline
Definition: Cal3_S2Stereo.h:99
double fy() const
focal length y
Definition: Cal3_S2.h:95
Cal3_S2Stereo(const Vector &d)
constructor from vector
Definition: Cal3_S2Stereo.h:53
double skew() const
skew
Definition: Cal3_S2Stereo.h:87
double fy() const
focal length x
Definition: Cal3_S2Stereo.h:84