Loading...
Searching...
No Matches
Cal3Fisheye.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>
#include <boost/shared_ptr.hpp>
#include <string>
namespace gtsam {
class GTSAM_EXPORT Cal3Fisheye : public Cal3 {
private:
double k1_ = 0.0f, k2_ = 0.0f;
double k3_ = 0.0f, k4_ = 0.0f;
double tol_ = 1e-5;
public:
enum { dimension = 9 };
using shared_ptr = boost::shared_ptr<Cal3Fisheye>;
Cal3Fisheye() = default;
Cal3Fisheye(const double fx, const double fy, const double s, const double u0,
const double v0, const double k1, const double k2,
const double k3, const double k4, double tol = 1e-5)
: Cal3(fx, fy, s, u0, v0),
k1_(k1),
k2_(k2),
k3_(k3),
k4_(k4),
tol_(tol) {}
~Cal3Fisheye() override {}
explicit Cal3Fisheye(const Vector9& v)
: Cal3(v(0), v(1), v(2), v(3), v(4)),
k1_(v(5)),
k2_(v(6)),
k3_(v(7)),
k4_(v(8)) {}
inline double k1() const { return k1_; }
inline double k2() const { return k2_; }
inline double k3() const { return k3_; }
inline double k4() const { return k4_; }
Vector4 k() const { return Vector4(k1_, k2_, k3_, k4_); }
Vector9 vector() const;
static double Scaling(double r);
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;
GTSAM_EXPORT friend std::ostream& operator<<(std::ostream& os,
const Cal3Fisheye& cal);
void print(const std::string& s = "") const override;
bool equals(const Cal3Fisheye& K, double tol = 10e-9) const;
size_t dim() const override { return Dim(); }
inline static size_t Dim() { return dimension; }
inline Cal3Fisheye retract(const Vector& d) const {
return Cal3Fisheye(vector() + d);
}
Vector localCoordinates(const Cal3Fisheye& T2) const {
return T2.vector() - vector();
}
virtual boost::shared_ptr<Cal3Fisheye> clone() const {
return boost::shared_ptr<Cal3Fisheye>(new Cal3Fisheye(*this));
}
private:
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int /*version*/) {
ar& boost::serialization::make_nvp(
"Cal3Fisheye", boost::serialization::base_object<Cal3>(*this));
ar& BOOST_SERIALIZATION_NVP(k1_);
ar& BOOST_SERIALIZATION_NVP(k2_);
ar& BOOST_SERIALIZATION_NVP(k3_);
ar& BOOST_SERIALIZATION_NVP(k4_);
}
};
template <>
struct traits<Cal3Fisheye> : public internal::Manifold<Cal3Fisheye> {};
template <>
struct traits<const Cal3Fisheye> : public internal::Manifold<Cal3Fisheye> {};
} // 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::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::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::OptionalJacobian
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition OptionalJacobian.h:41
gtsam::equals
Template to create a binary predicate.
Definition Testable.h:111
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::Cal3Fisheye
Calibration of a fisheye camera.
Definition Cal3Fisheye.h:51
gtsam::Cal3Fisheye::k4
double k4() const
Second tangential distortion coefficient.
Definition Cal3Fisheye.h:105
gtsam::Cal3Fisheye::k1
double k1() const
First distortion coefficient.
Definition Cal3Fisheye.h:96
gtsam::Cal3Fisheye::k3
double k3() const
First tangential distortion coefficient.
Definition Cal3Fisheye.h:102
gtsam::Cal3Fisheye::localCoordinates
Vector localCoordinates(const Cal3Fisheye &T2) const
Given a different calibration, calculate update to obtain it.
Definition Cal3Fisheye.h:168
gtsam::Cal3Fisheye::Dim
static size_t Dim()
Return dimensions of calibration manifold object.
Definition Cal3Fisheye.h:160
gtsam::Cal3Fisheye::k2
double k2() const
Second distortion coefficient.
Definition Cal3Fisheye.h:99
gtsam::Cal3Fisheye::dim
size_t dim() const override
Return dimensions of calibration manifold object.
Definition Cal3Fisheye.h:157
gtsam::Cal3Fisheye::vector
Vector9 vector() const
Return all parameters as a vector.
Definition Cal3Fisheye.cpp:28
gtsam::Cal3Fisheye::clone
virtual boost::shared_ptr< Cal3Fisheye > clone() const
Definition Cal3Fisheye.h:177
gtsam::Cal3Fisheye::k
Vector4 k() const
return distortion parameter vector
Definition Cal3Fisheye.h:108
gtsam::Cal3Fisheye::Cal3Fisheye
Cal3Fisheye()=default
Default Constructor with only unit focal length.
gtsam::Cal3Fisheye::retract
Cal3Fisheye retract(const Vector &d) const
Given delta vector, update calibration.
Definition Cal3Fisheye.h:163