Loading...
Searching...
No Matches
Cal3DS2_Base.h
/* ----------------------------------------------------------------------------
* 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>
#include <boost/shared_ptr.hpp>
namespace gtsam {
class GTSAM_EXPORT Cal3DS2_Base : public Cal3 {
protected:
double k1_ = 0.0f, k2_ = 0.0f;
double p1_ = 0.0f, p2_ = 0.0f;
double tol_ = 1e-5;
public:
enum { dimension = 9 };
using shared_ptr = boost::shared_ptr<Cal3DS2_Base>;
Cal3DS2_Base() = default;
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)
: Cal3(fx, fy, s, u0, v0),
k1_(k1),
k2_(k2),
p1_(p1),
p2_(p2),
tol_(tol) {}
~Cal3DS2_Base() override {}
Cal3DS2_Base(const Vector9& v)
: Cal3(v(0), v(1), v(2), v(3), v(4)),
k1_(v(5)),
k2_(v(6)),
p1_(v(7)),
p2_(v(8)) {}
GTSAM_EXPORT friend std::ostream& operator<<(std::ostream& os,
const Cal3DS2_Base& cal);
void print(const std::string& s = "") const override;
bool equals(const Cal3DS2_Base& K, double tol = 1e-8) const;
inline double k1() const { return k1_; }
inline double k2() const { return k2_; }
inline double p1() const { return p1_; }
inline double p2() const { return p2_; }
Vector4 k() const { return Vector4(k1_, k2_, p1_, p2_); }
Vector9 vector() const;
Point2 uncalibrate(const Point2& p, OptionalJacobian<2, 9> Dcal = boost::none,
OptionalJacobian<2, 2> Dp = boost::none) const;
Point2 calibrate(const Point2& p, OptionalJacobian<2, 9> Dcal = boost::none,
OptionalJacobian<2, 2> Dp = boost::none) const;
Matrix2 D2d_intrinsic(const Point2& p) const;
Matrix29 D2d_calibration(const Point2& p) const;
size_t dim() const override { return Dim(); }
inline static size_t Dim() { return dimension; }
virtual boost::shared_ptr<Cal3DS2_Base> clone() const {
return boost::shared_ptr<Cal3DS2_Base>(new Cal3DS2_Base(*this));
}
private:
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int /*version*/) {
ar& boost::serialization::make_nvp(
"Cal3DS2_Base", boost::serialization::base_object<Cal3>(*this));
ar& BOOST_SERIALIZATION_NVP(k1_);
ar& BOOST_SERIALIZATION_NVP(k2_);
ar& BOOST_SERIALIZATION_NVP(p1_);
ar& BOOST_SERIALIZATION_NVP(p2_);
ar& BOOST_SERIALIZATION_NVP(tol_);
}
};
}
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::print
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition Matrix.cpp:156
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::OptionalJacobian
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition OptionalJacobian.h:41
gtsam::Cal3::Cal3
Cal3()=default
Create a default calibration that leaves coordinates unchanged.
gtsam::Cal3::fx
double fx() const
focal length x
Definition Cal3.h:139
gtsam::Cal3::fy
double fy() const
focal length y
Definition Cal3.h:142
gtsam::Cal3DS2_Base
Calibration of a camera with radial distortion.
Definition Cal3DS2_Base.h:42
gtsam::Cal3DS2_Base::Cal3DS2_Base
Cal3DS2_Base()=default
Default Constructor with only unit focal length.
gtsam::Cal3DS2_Base::p2
double p2() const
Second tangential distortion coefficient.
Definition Cal3DS2_Base.h:110
gtsam::Cal3DS2_Base::Dim
static size_t Dim()
return DOF, dimensionality of tangent space
Definition Cal3DS2_Base.h:142
gtsam::Cal3DS2_Base::clone
virtual boost::shared_ptr< Cal3DS2_Base > clone() const
Definition Cal3DS2_Base.h:149
gtsam::Cal3DS2_Base::k2_
double k2_
radial 2nd-order and 4th-order
Definition Cal3DS2_Base.h:44
gtsam::Cal3DS2_Base::k2
double k2() const
Second distortion coefficient.
Definition Cal3DS2_Base.h:104
gtsam::Cal3DS2_Base::p2_
double p2_
tangential distortion
Definition Cal3DS2_Base.h:45
gtsam::Cal3DS2_Base::k1
double k1() const
First distortion coefficient.
Definition Cal3DS2_Base.h:101
gtsam::Cal3DS2_Base::dim
size_t dim() const override
return DOF, dimensionality of tangent space
Definition Cal3DS2_Base.h:139
gtsam::Cal3DS2_Base::tol_
double tol_
tolerance value when calibrating
Definition Cal3DS2_Base.h:46
gtsam::Cal3DS2_Base::p1
double p1() const
First tangential distortion coefficient.
Definition Cal3DS2_Base.h:107
gtsam::Cal3DS2_Base::k
Vector4 k() const
return distortion parameter vector
Definition Cal3DS2_Base.h:113