11 #include <gtsam/geometry/Unit3.h>
35 return Vector(3) << p.
x(), p.
y(), 1;
43 aTb_(1, 0, 0), E_(aTb_.skew()) {
48 aRb_(aRb), aTb_(aTb), E_(aTb_.skew() * aRb_.matrix()) {
53 boost::optional<Matrix&> H = boost::none);
56 template<
typename Engine>
67 void print(
const std::string& s =
"")
const;
71 return aRb_.equals(other.aRb_, tol) && aTb_.equals(other.aTb_, tol);
80 inline static size_t Dim() {
85 virtual size_t dim()
const {
122 return aRb_.unrotate(aTb_);
133 boost::optional<Matrix&> DE = boost::none,
134 boost::optional<Matrix&> Dpoint = boost::none)
const;
142 boost::none, boost::optional<Matrix&> HR = boost::none)
const;
154 double error(
const Vector& vA,
const Vector& vB,
155 boost::optional<Matrix&> H = boost::none)
const;
163 GTSAM_EXPORT
friend std::ostream& operator <<(std::ostream& os,
const EssentialMatrix& E);
176 friend class boost::serialization::access;
177 template<
class ARCHIVE>
178 void serialize(ARCHIVE & ar,
const unsigned int version) {
179 ar & boost::serialization::make_nvp(
"EssentialMatrix",
180 boost::serialization::base_object<Value>(*
this));
181 ar & BOOST_SERIALIZATION_NVP(aRb_);
182 ar & BOOST_SERIALIZATION_NVP(aTb_);
184 ar & boost::serialization::make_nvp(
"E11", E_(0,0));
185 ar & boost::serialization::make_nvp(
"E12", E_(0,1));
186 ar & boost::serialization::make_nvp(
"E13", E_(0,2));
187 ar & boost::serialization::make_nvp(
"E21", E_(1,0));
188 ar & boost::serialization::make_nvp(
"E22", E_(1,1));
189 ar & boost::serialization::make_nvp(
"E23", E_(1,2));
190 ar & boost::serialization::make_nvp(
"E31", E_(2,0));
191 ar & boost::serialization::make_nvp(
"E32", E_(2,1));
192 ar & boost::serialization::make_nvp(
"E33", E_(2,2));
Unit3 epipole_b() const
Return epipole in image_b, as Unit3 to allow for infinity.
Definition: EssentialMatrix.h:121
static size_t Dim()
Dimensionality of tangent space = 5 DOF.
Definition: EssentialMatrix.h:80
EssentialMatrix rotate(const Rot3 &cRb, boost::optional< Matrix & > HE=boost::none, boost::optional< Matrix & > HR=boost::none) const
Given essential matrix E in camera frame B, convert to body frame C.
Definition: EssentialMatrix.cpp:80
static Rot3 Random(boost::mt19937 &rng)
Random, generates a random axis, then random angle [-p,pi].
Definition: Rot3.cpp:48
friend EssentialMatrix operator*(const Rot3 &cRb, const EssentialMatrix &E)
Given essential matrix E in camera frame B, convert to body frame C.
Definition: EssentialMatrix.h:149
static Unit3 Random(boost::mt19937 &rng)
Random direction, using boost::uniform_on_sphere.
Definition: Unit3.cpp:56
const Unit3 & epipole_a() const
Return epipole in image_a , as Unit3 to allow for infinity.
Definition: EssentialMatrix.h:116
static Vector Homogeneous(const Point2 &p)
Static function to convert Point2 to homogeneous coordinates.
Definition: EssentialMatrix.h:34
void print(const Matrix &A, const string &s, ostream &stream)
print a matrix
Definition: Matrix.cpp:183
Represents a 3D point on a unit sphere.
Definition: Unit3.h:31
An essential matrix is like a Pose3, except with translation up to scale It is named after the 3*3 ma...
Definition: EssentialMatrix.h:23
bool equals(const EssentialMatrix &other, double tol=1e-8) const
assert equality up to a tolerance
Definition: EssentialMatrix.h:70
EssentialMatrix()
Default constructor.
Definition: EssentialMatrix.h:42
double y() const
get y
Definition: Point2.h:213
const Unit3 & direction() const
Direction.
Definition: EssentialMatrix.h:106
double x() const
get x
Definition: Point2.h:210
istream & operator>>(istream &inputStream, Matrix &destinationMatrix)
Read a matrix from an input stream, such as a file.
Definition: Matrix.cpp:209
const Matrix3 & matrix() const
Return 3*3 matrix representation.
Definition: EssentialMatrix.h:111
EssentialMatrix(const Rot3 &aRb, const Unit3 &aTb)
Construct from rotation and translation.
Definition: EssentialMatrix.h:47
Definition: DerivedValue.h:44
const Rot3 & rotation() const
Rotation.
Definition: EssentialMatrix.h:101
static EssentialMatrix Random(Engine &rng)
Random, using Rot3::Random and Unit3::Random.
Definition: EssentialMatrix.h:57
virtual size_t dim() const
Return the dimensionality of the tangent space.
Definition: EssentialMatrix.h:85