24#if GTSAM_ENABLE_BOOST_SERIALIZATION
25#include <boost/serialization/nvp.hpp>
35template <
class CALIBRATION>
39 std::shared_ptr<CALIBRATION> k_;
63 inline const std::shared_ptr<CALIBRATION>&
calibration()
const {
return k_; }
66 void print(
const std::string& s =
"")
const {
68 k_.print(
"calibration");
79 double theta = pw(3), phi = pw(4);
80 gtsam::Point3 m(cos(theta)*cos(phi),sin(theta)*cos(phi),sin(phi));
81 return ray_base + m/rho;
93 OptionalJacobian<2,1> H3 = {})
const {
96 double theta = pw(3), phi = pw(4);
97 gtsam::Point3 m(cos(theta)*cos(phi),sin(theta)*cos(phi),sin(phi));
100 gtsam::PinholeCamera<CALIBRATION> camera(pose_, *k_);
102 if (!H1 && !H2 && !H3) {
113 double cos_theta = cos(theta);
114 double sin_theta = sin(theta);
115 double cos_phi = cos(phi);
116 double sin_phi = sin(phi);
117 double rho2 = rho * rho;
123 double H14 = -cos_phi*sin_theta/rho;
124 double H15 = -cos_theta*sin_phi/rho;
129 double H24 = cos_phi*cos_theta/rho;
130 double H25 = -sin_phi*sin_theta/rho;
136 double H35 = cos_phi/rho;
138 *H2 = J2 * Matrix{{H11, H12, H13, H14, H15},
139 {H21, H22, H23, H24, H25},
140 {H31, H32, H33, H34, H35}};
143 double H16 = -cos_phi*cos_theta/rho2;
144 double H26 = -cos_phi*sin_theta/rho2;
145 double H36 = -sin_phi/rho2;
146 *H3 = J2 * Matrix{{H16}, {H26}, {H36}};
164 double theta = atan2(ray.y(), ray.x());
165 double phi = atan2(ray.z(), sqrt(ray.x()*ray.x()+ray.y()*ray.y()));
166 return std::make_pair(Vector5{pt.x(), pt.y(), pt.z(), theta, phi},
176#if GTSAM_ENABLE_BOOST_SERIALIZATION
178 friend class boost::serialization::access;
179 template<
class Archive>
180 void serialize(Archive & ar,
const unsigned int ) {
181 ar & BOOST_SERIALIZATION_NVP(pose_);
182 ar & BOOST_SERIALIZATION_NVP(k_);
typedef and functions to augment Eigen's MatrixXd
Macros for Matrix constants to avoid excessive template instantiation.
typedef and functions to augment Eigen's VectorXd
Base class for all pinhole cameras.
3D Pose manifold SO(3) x R^3 and group SE(3)
Non-linear factor base classes.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
Vector3 Point3
As of GTSAM 4, in order to make GTSAM more lean, it is now possible to just typedef Point3 to Vector3...
Definition Point3.h:38
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:32
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition OptionalJacobian.h:40
A 3D pose (R,t) : (Rot3,Point3).
Definition Pose3.h:42
A pinhole camera class that has a Pose3 and a Calibration.
Definition InvDepthCamera3.h:36
std::pair< Vector5, double > backproject(const gtsam::Point2 &pi, const double depth) const
backproject a 2-dimensional point to an Inverse Depth landmark useful for point initialization
Definition InvDepthCamera3.h:157
Pose3 & pose()
return pose
Definition InvDepthCamera3.h:60
static gtsam::Point3 invDepthTo3D(const Vector5 &pw, double rho)
Convert an inverse depth landmark to cartesian Point3.
Definition InvDepthCamera3.h:77
gtsam::Point2 project(const Vector5 &pw, double rho, OptionalJacobian< 2, 6 > H1={}, OptionalJacobian< 2, 5 > H2={}, OptionalJacobian< 2, 1 > H3={}) const
project a point from world InvDepth parameterization to the image
Definition InvDepthCamera3.h:89
InvDepthCamera3(const Pose3 &pose, const std::shared_ptr< CALIBRATION > &k)
constructor with pose and calibration
Definition InvDepthCamera3.h:50
InvDepthCamera3()
default constructor
Definition InvDepthCamera3.h:47
const std::shared_ptr< CALIBRATION > & calibration() const
return calibration
Definition InvDepthCamera3.h:63
void print(const std::string &s="") const
print
Definition InvDepthCamera3.h:66