Loading...
Searching...
No Matches
StereoPoint2.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/Point2.h>
#include <gtsam/base/VectorSpace.h>
#include <boost/serialization/nvp.hpp>
namespace gtsam {
class GTSAM_EXPORT StereoPoint2 {
private:
double uL_, uR_, v_;
public:
enum { dimension = 3 };
StereoPoint2() :
uL_(0), uR_(0), v_(0) {
}
StereoPoint2(double uL, double uR, double v) :
uL_(uL), uR_(uR), v_(v) {
}
explicit StereoPoint2(const Vector3& v) :
uL_(v(0)), uR_(v(1)), v_(v(2)) {}
void print(const std::string& s = "") const;
bool equals(const StereoPoint2& q, double tol = 1e-9) const {
return (std::abs(uL_ - q.uL_) < tol && std::abs(uR_ - q.uR_) < tol
&& std::abs(v_ - q.v_) < tol);
}
inline static StereoPoint2 Identity() {
return StereoPoint2();
}
StereoPoint2 operator-() const {
return StereoPoint2(-uL_, -uR_, -v_);
}
inline StereoPoint2 operator +(const Vector3& v) const {
return StereoPoint2(uL_ + v[0], uR_ + v[1], v_ + v[2]);
}
inline StereoPoint2 operator +(const StereoPoint2& b) const {
return StereoPoint2(uL_ + b.uL_, uR_ + b.uR_, v_ + b.v_);
}
inline StereoPoint2 operator -(const StereoPoint2& b) const {
return StereoPoint2(uL_ - b.uL_, uR_ - b.uR_, v_ - b.v_);
}
inline bool operator ==(const StereoPoint2& q) const {return uL_== q.uL_ && uR_==q.uR_ && v_ == q.v_;}
inline double uL() const {return uL_;}
inline double uR() const {return uR_;}
inline double v() const {return v_;}
Vector3 vector() const {
return Vector3(uL_, uR_, v_);
}
Point2 point2() const {
return Point2(uL_, v_);
}
Point2 right() const {
return Point2(uR_, v_);
}
inline StereoPoint2 inverse() const { return StereoPoint2()- (*this);}
inline StereoPoint2 compose(const StereoPoint2& p1) const { return *this + p1;}
inline StereoPoint2 between(const StereoPoint2& p2) const { return p2 - *this; }
inline Vector localCoordinates(const StereoPoint2& t2) const { return Logmap(between(t2)); }
inline StereoPoint2 retract(const Vector& v) const { return compose(Expmap(v)); }
static inline Vector Logmap(const StereoPoint2& p) { return p.vector(); }
static inline StereoPoint2 Expmap(const Vector& d) { return StereoPoint2(d(0), d(1), d(2)); }
GTSAM_EXPORT friend std::ostream &operator<<(std::ostream &os, const StereoPoint2& p);
private:
friend class boost::serialization::access;
template<class ARCHIVE>
void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
ar & BOOST_SERIALIZATION_NVP(uL_);
ar & BOOST_SERIALIZATION_NVP(uR_);
ar & BOOST_SERIALIZATION_NVP(v_);
}
};
typedef std::vector<StereoPoint2> StereoPoint2Vector;
template<>
struct traits<StereoPoint2> : public internal::VectorSpace<StereoPoint2> {};
template<>
struct traits<const StereoPoint2> : public internal::VectorSpace<StereoPoint2> {};
}
gtsam::testing::between
T between(const T &t1, const T &t2)
binary functions
Definition lieProxies.h:36
Point2.h
2D Point
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::VectorSpace
VectorSpace provides both Testable and VectorSpaceTraits.
Definition VectorSpace.h:207
gtsam::StereoPoint2
A 2D stereo point, v will be same for rectified images.
Definition StereoPoint2.h:32
gtsam::StereoPoint2::uR
double uR() const
get uR
Definition StereoPoint2.h:109
gtsam::StereoPoint2::StereoPoint2
StereoPoint2(const Vector3 &v)
construct from 3D vector
Definition StereoPoint2.h:53
gtsam::StereoPoint2::right
Point2 right() const
convenient function to get a Point2 from the right image
Definition StereoPoint2.h:125
gtsam::StereoPoint2::vector
Vector3 vector() const
convert to vector
Definition StereoPoint2.h:115
gtsam::StereoPoint2::uL
double uL() const
get uL
Definition StereoPoint2.h:106
gtsam::StereoPoint2::StereoPoint2
StereoPoint2(double uL, double uR, double v)
constructor
Definition StereoPoint2.h:48
gtsam::StereoPoint2::equals
bool equals(const StereoPoint2 &q, double tol=1e-9) const
equals
Definition StereoPoint2.h:64
gtsam::StereoPoint2::operator-
StereoPoint2 operator-() const
inverse
Definition StereoPoint2.h:79
gtsam::StereoPoint2::v
double v() const
get v
Definition StereoPoint2.h:112
gtsam::StereoPoint2::point2
Point2 point2() const
convenient function to get a Point2 from the left image
Definition StereoPoint2.h:120
gtsam::StereoPoint2::Identity
static StereoPoint2 Identity()
identity
Definition StereoPoint2.h:74
gtsam::StereoPoint2::StereoPoint2
StereoPoint2()
default constructor
Definition StereoPoint2.h:43