20 #include <boost/tuple/tuple.hpp>
22 #include <gtsam/base/DerivedValue.h>
63 void print(
const std::string& s =
"")
const {
64 leftCamPose_.print(s +
".camera.");
65 K_->print(s +
".calibration.");
69 return leftCamPose_.equals(camera.leftCamPose_, tol) && K_->equals(
78 inline size_t dim()
const {
83 static inline size_t Dim() {
94 return Vector(leftCamPose_.localCoordinates(t2.leftCamPose_));
98 boost::optional<Matrix&> H1=boost::none,
99 boost::optional<Matrix&> H2=boost::none)
const {
100 return leftCamPose_.between(camera.pose(), H1, H2);
107 const Pose3& pose()
const {
111 double baseline()
const {
112 return K_->baseline();
118 StereoPoint2 project(
const Point3& point,
119 boost::optional<Matrix&> H1 = boost::none,
120 boost::optional<Matrix&> H2 = boost::none)
const;
125 StereoPoint2 project(
const Point3& point,
126 boost::optional<Matrix&> H1,
127 boost::optional<Matrix&> H1_k,
128 boost::optional<Matrix&> H2)
const {
129 return project(point, H1, H2);
132 Point3 backproject(
const StereoPoint2& z)
const {
133 Vector measured = z.vector();
134 double Z = K_->baseline()*K_->fx()/(measured[0]-measured[1]);
135 double X = Z *(measured[0]- K_->px()) / K_->fx();
136 double Y = Z *(measured[2]- K_->py()) / K_->fy();
137 Point3 world_point = leftCamPose_.transform_from(Point3(X, Y, Z));
145 Matrix Dproject_to_stereo_camera1(
const Point3& P)
const;
147 friend class boost::serialization::access;
148 template<
class Archive>
149 void serialize(Archive & ar,
const unsigned int version) {
150 ar & boost::serialization::make_nvp(
"StereoCamera",
151 boost::serialization::base_object<Value>(*
this));
152 ar & BOOST_SERIALIZATION_NVP(leftCamPose_);
153 ar & BOOST_SERIALIZATION_NVP(K_);
The most common 5DOF 3D->2D calibration + Stereo baseline.
boost::shared_ptr< Cal3_S2Stereo > shared_ptr
shared pointer to stereo calibration object
Definition: Cal3_S2Stereo.h:37
Vector localCoordinates(const StereoCamera &t2) const
Local coordinates of manifold neighborhood around current value.
Definition: StereoCamera.h:93
StereoCamera retract(const Vector &v) const
Updates a with tangent space delta.
Definition: StereoCamera.h:88
A 2D stereo point (uL,uR,v)
Definition: StereoCamera.h:29
Template to create a binary predicate.
Definition: Testable.h:102
static size_t Dim()
Dimensionality of the tangent space.
Definition: StereoCamera.h:83
size_t dim() const
Dimensionality of the tangent space.
Definition: StereoCamera.h:78
void print(const std::string &s="") const
Print this value, for debugging and unit tests.
Definition: StereoCamera.h:63
Definition: StereoCamera.h:39
Definition: DerivedValue.h:44