gtsam
Loading...
Searching...
No Matches
Cal3f.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/* ----------------------------------------------------------------------------
12
13 * GTSAM Copyright 2010
14 * See LICENSE for the license information
15
16 * -------------------------------------------------------------------------- */
17
23
24#pragma once
25
26#include <gtsam/geometry/Cal3.h>
27
28namespace gtsam {
29
35class GTSAM_EXPORT Cal3f : public Cal3 {
36 public:
37 constexpr static auto dimension = 1;
38 using shared_ptr = std::shared_ptr<Cal3f>;
39
42
44 Cal3f() = default;
45
52 Cal3f(double f, double u0, double v0);
53
54 ~Cal3f() override = default;
55
59
61 GTSAM_EXPORT friend std::ostream& operator<<(std::ostream& os, const Cal3f& cal);
62
64 void print(const std::string& s = "") const override;
65
67 bool equals(const Cal3f& K, double tol = 1e-9) const;
68
72
74 double f() const { return fx_; }
75
77 Vector1 vector() const;
78
87 Point2 uncalibrate(const Point2& p, OptionalJacobian<2, 1> Dcal = {},
88 OptionalJacobian<2, 2> Dp = {}) const;
89
97 Point2 calibrate(const Point2& pi, OptionalJacobian<2, 1> Dcal = {},
98 OptionalJacobian<2, 2> Dp = {}) const;
99
103
105 size_t dim() const { return Dim(); }
106
108 static size_t Dim() { return dimension; }
109
111 Cal3f retract(const Vector& d) const { return Cal3f(fx_ + d(0), u0_, v0_); }
112
114 Vector1 localCoordinates(const Cal3f& T2) const {
115 return Vector1(T2.fx_ - fx_);
116 }
117
119
120 private:
121#if GTSAM_ENABLE_BOOST_SERIALIZATION
123 friend class boost::serialization::access;
124 template <class Archive>
125 void serialize(Archive& ar, const unsigned int /*version*/) {
126 ar& BOOST_SERIALIZATION_NVP(fx_);
127 ar& BOOST_SERIALIZATION_NVP(u0_);
128 ar& BOOST_SERIALIZATION_NVP(v0_);
129 }
130#endif
131
133};
134
135template <>
136struct traits<Cal3f> : public internal::Manifold<Cal3f> {};
137
138template <>
139struct traits<const Cal3f> : public internal::Manifold<Cal3f> {};
140
141} // namespace gtsam
Common code for all Calibration models.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
Vector2 Point2
As of GTSAM 4, in order to make GTSAM more lean, it is now possible to just typedef Point2 to Vector2...
Definition Point2.h:32
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
Both ManifoldTraits and Testable.
Definition Manifold.h:156
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition OptionalJacobian.h:40
virtual Matrix3 K() const
return calibration matrix K
Definition Cal3.h:162
Cal3()=default
Create a default calibration that leaves coordinates unchanged.
double v0_
principal point
Definition Cal3.h:73
Calibration model with a single focal length and zero skew.
Definition Cal3f.h:35
double f() const
focal length
Definition Cal3f.h:74
size_t dim() const
Return DOF, dimensionality of tangent space.
Definition Cal3f.h:105
GTSAM_EXPORT friend std::ostream & operator<<(std::ostream &os, const Cal3f &cal)
Output stream operator.
Definition Cal3f.cpp:39
void print(const std::string &s="") const override
print with optional string
Definition Cal3f.cpp:45
Cal3f()=default
Default constructor.
Cal3f retract(const Vector &d) const
Update calibration with tangent space delta.
Definition Cal3f.h:111
static size_t Dim()
Return DOF, dimensionality of tangent space.
Definition Cal3f.h:108
bool equals(const Cal3f &K, double tol=1e-9) const
assert equality up to a tolerance
Definition Cal3f.cpp:51
Vector1 localCoordinates(const Cal3f &T2) const
Calculate local coordinates to another calibration.
Definition Cal3f.h:114