Loading...
Searching...
No Matches
Cal3Bundler.h
Go to the documentation of this file.
/* ----------------------------------------------------------------------------
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
* See LICENSE for the license information
* -------------------------------------------------------------------------- */
#pragma once
#include <gtsam/geometry/Cal3.h>
#include <gtsam/geometry/Point2.h>
namespace gtsam {
class GTSAM_EXPORT Cal3Bundler : public Cal3 {
private:
double k1_ = 0.0f, k2_ = 0.0f;
double tol_ = 1e-5;
// NOTE: We use the base class fx to represent the common focal length.
// Also, image center parameters (u0, v0) are not optimized
// but are treated as constants.
public:
enum { dimension = 3 };
using shared_ptr = boost::shared_ptr<Cal3Bundler>;
Cal3Bundler() = default;
Cal3Bundler(double f, double k1, double k2, double u0 = 0, double v0 = 0,
double tol = 1e-5)
: Cal3(f, f, 0, u0, v0), k1_(k1), k2_(k2), tol_(tol) {}
~Cal3Bundler() override {}
GTSAM_EXPORT friend std::ostream& operator<<(std::ostream& os,
const Cal3Bundler& cal);
void print(const std::string& s = "") const override;
bool equals(const Cal3Bundler& K, double tol = 10e-9) const;
inline double k1() const { return k1_; }
inline double k2() const { return k2_; }
inline double px() const { return u0_; }
inline double py() const { return v0_; }
Matrix3 K() const override;
Vector4 k() const;
Vector3 vector() const;
#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V42
inline double GTSAM_DEPRECATED u0() const { return u0_; }
inline double GTSAM_DEPRECATED v0() const { return v0_; }
#endif
Point2 uncalibrate(const Point2& p, OptionalJacobian<2, 3> Dcal = boost::none,
OptionalJacobian<2, 2> Dp = boost::none) const;
Point2 calibrate(const Point2& pi, OptionalJacobian<2, 3> Dcal = boost::none,
OptionalJacobian<2, 2> Dp = boost::none) const;
Matrix2 D2d_intrinsic(const Point2& p) const;
Matrix23 D2d_calibration(const Point2& p) const;
Matrix25 D2d_intrinsic_calibration(const Point2& p) const;
size_t dim() const override { return Dim(); }
inline static size_t Dim() { return dimension; }
inline Cal3Bundler retract(const Vector& d) const {
return Cal3Bundler(fx_ + d(0), k1_ + d(1), k2_ + d(2), u0_, v0_);
}
Vector3 localCoordinates(const Cal3Bundler& T2) const {
return T2.vector() - vector();
}
private:
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int /*version*/) {
ar& boost::serialization::make_nvp(
"Cal3Bundler", boost::serialization::base_object<Cal3>(*this));
ar& BOOST_SERIALIZATION_NVP(k1_);
ar& BOOST_SERIALIZATION_NVP(k2_);
ar& BOOST_SERIALIZATION_NVP(tol_);
}
};
template <>
struct traits<Cal3Bundler> : public internal::Manifold<Cal3Bundler> {};
template <>
struct traits<const Cal3Bundler> : public internal::Manifold<Cal3Bundler> {};
} // namespace gtsam
Point2.h
2D Point
Cal3.h
Common code for all Calibration models.
gtsam
Global functions in a separate testing namespace.
Definition chartTesting.h:28
gtsam::Point2
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:27
gtsam::traits
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition concepts.h:30
gtsam::internal::Manifold
Both ManifoldTraits and Testable.
Definition Manifold.h:120
gtsam::Cal3::Cal3
Cal3()=default
Create a default calibration that leaves coordinates unchanged.
gtsam::Cal3::v0_
double v0_
principal point
Definition Cal3.h:73
gtsam::Cal3Bundler
Calibration used by Bundler.
Definition Cal3Bundler.h:32
gtsam::Cal3Bundler::k1
double k1() const
distorsion parameter k1
Definition Cal3Bundler.h:87
gtsam::Cal3Bundler::k2
double k2() const
distorsion parameter k2
Definition Cal3Bundler.h:90
gtsam::Cal3Bundler::Cal3Bundler
Cal3Bundler()=default
Default constructor.
gtsam::Cal3Bundler::retract
Cal3Bundler retract(const Vector &d) const
Update calibration with tangent space delta.
Definition Cal3Bundler.h:153
gtsam::Cal3Bundler::py
double py() const
image center in y
Definition Cal3Bundler.h:96
gtsam::Cal3Bundler::Cal3Bundler
Cal3Bundler(double f, double k1, double k2, double u0=0, double v0=0, double tol=1e-5)
Constructor.
Definition Cal3Bundler.h:62
gtsam::Cal3Bundler::localCoordinates
Vector3 localCoordinates(const Cal3Bundler &T2) const
Calculate local coordinates to another calibration.
Definition Cal3Bundler.h:158
gtsam::Cal3Bundler::px
double px() const
image center in x
Definition Cal3Bundler.h:93
gtsam::Cal3Bundler::dim
size_t dim() const override
return DOF, dimensionality of tangent space
Definition Cal3Bundler.h:147
gtsam::Cal3Bundler::Dim
static size_t Dim()
return DOF, dimensionality of tangent space
Definition Cal3Bundler.h:150