24 #include <gtsam/base/DerivedValue.h>
36 double fx_, fy_, s_, u0_, v0_;
47 fx_(1), fy_(1), s_(0), u0_(0), v0_(0) {
51 Cal3_S2(
double fx,
double fy,
double s,
double u0,
double v0) :
52 fx_(fx), fy_(fy), s_(s), u0_(u0), v0_(v0) {
57 fx_(d(0)), fy_(d(1)), s_(d(2)), u0_(d(3)), v0_(d(4)) {
66 Cal3_S2(
double fov,
int w,
int h);
73 Cal3_S2(
const std::string &path);
80 void print(
const std::string& s =
"Cal3_S2")
const;
90 inline double fx()
const {
95 inline double fy()
const {
105 inline double px()
const {
110 inline double py()
const {
121 double r[] = { fx_, fy_, s_, u0_, v0_ };
123 std::copy(r, r + 5, v.data());
129 return (Matrix(3, 3) << fx_, s_, u0_, 0.0, fy_, v0_, 0.0, 0.0, 1.0);
139 const double fxy = fx_ * fy_, sv0 = s_ * v0_, fyu0 = fy_ * u0_;
140 return (Matrix(3, 3) << 1.0 / fx_, -s_ / fxy, (sv0 - fyu0) / fxy, 0.0,
141 1.0 / fy_, -v0_ / fy_, 0.0, 0.0, 1.0);
151 Point2 uncalibrate(
const Point2& p, boost::optional<Matrix&> Dcal =
152 boost::none, boost::optional<Matrix&> Dp = boost::none)
const;
166 Vector3 calibrate(
const Vector3& p)
const;
170 boost::optional<Matrix&> H1=boost::none,
171 boost::optional<Matrix&> H2=boost::none)
const {
172 if(H1) *H1 = -
eye(5);
174 return Cal3_S2(q.fx_-fx_, q.fy_-fy_, q.s_-s_, q.u0_-u0_, q.v0_-v0_);
183 inline size_t dim()
const {
194 return Cal3_S2(fx_ + d(0), fy_ + d(1), s_ + d(2), u0_ + d(3), v0_ + d(4));
199 return T2.
vector() - vector();
209 friend class boost::serialization::access;
210 template<
class Archive>
211 void serialize(Archive & ar,
const unsigned int version) {
213 & boost::serialization::make_nvp(
"Cal3_S2",
214 boost::serialization::base_object<Value>(*
this));
215 ar & BOOST_SERIALIZATION_NVP(fx_);
216 ar & BOOST_SERIALIZATION_NVP(fy_);
217 ar & BOOST_SERIALIZATION_NVP(s_);
218 ar & BOOST_SERIALIZATION_NVP(u0_);
219 ar & BOOST_SERIALIZATION_NVP(v0_);
Vector localCoordinates(const Cal3_S2 &T2) const
Unretraction for the calibration.
Definition: Cal3_S2.h:198
double py() const
image center in y
Definition: Cal3_S2.h:110
Matrix matrix() const
Definition: Cal3_S2.h:133
Cal3_S2(const Vector &d)
constructor from vector
Definition: Cal3_S2.h:56
size_t dim() const
return DOF, dimensionality of tangent space
Definition: Cal3_S2.h:183
Matrix eye(size_t m, size_t n)
Creates an identity matrix, with matlab-like syntax.
Definition: Matrix.cpp:50
Matrix K() const
return calibration matrix K
Definition: Cal3_S2.h:128
static size_t Dim()
return DOF, dimensionality of tangent space
Definition: Cal3_S2.h:188
Cal3_S2()
Create a default calibration that leaves coordinates unchanged.
Definition: Cal3_S2.h:46
double fx() const
focal length x
Definition: Cal3_S2.h:90
double skew() const
skew
Definition: Cal3_S2.h:100
boost::shared_ptr< Cal3_S2 > shared_ptr
shared pointer to calibration object
Definition: Cal3_S2.h:40
Cal3_S2 between(const Cal3_S2 &q, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none) const
"Between", subtracts calibrations. between(p,q) == compose(inverse(p),q)
Definition: Cal3_S2.h:169
void print(const Matrix &A, const string &s, ostream &stream)
print a matrix
Definition: Matrix.cpp:183
Cal3_S2 retract(const Vector &d) const
Given 5-dim tangent vector, create new calibration.
Definition: Cal3_S2.h:193
Matrix matrix_inverse() const
return inverted calibration matrix inv(K)
Definition: Cal3_S2.h:138
Template to create a binary predicate.
Definition: Testable.h:102
double px() const
image center in x
Definition: Cal3_S2.h:105
Point2 principalPoint() const
return the principal point
Definition: Cal3_S2.h:115
double fy() const
focal length y
Definition: Cal3_S2.h:95
Cal3_S2(double fx, double fy, double s, double u0, double v0)
constructor from doubles
Definition: Cal3_S2.h:51
Vector vector() const
vectorized form (column-wise)
Definition: Cal3_S2.h:120
Definition: DerivedValue.h:44