24#include <gtsam/base/concepts.h>
25#include <gtsam/dllexport.h>
29#if GTSAM_ENABLE_BOOST_SERIALIZATION
30#include <boost/serialization/nvp.hpp>
38 : CheiralityException(std::numeric_limits<Key>::max()) {}
40 CheiralityException(
Key j)
44 Key nearbyVariable()
const {
return j_;}
61 using Translation =
Point3;
68 using MeasurementVector = Point2Vector;
92 static Matrix23
Dpoint(
const Point2& pn,
double d,
const Matrix3& Rt);
148 virtual void print(
const std::string& s =
"PinholeBase")
const;
161 return pose_.rotation();
166 return pose_.translation();
189 static Point2 Project(
const Unit3& pc,
190 OptionalJacobian<2, 2> Dpoint = {});
193 std::pair<Point2, bool> projectSafe(
const Point3& pw)
const;
200 Point2 project2(
const Point3& point, OptionalJacobian<2, 6> Dpose =
201 {}, OptionalJacobian<2, 3> Dpoint = {})
const;
208 Point2 project2(
const Unit3& point,
209 OptionalJacobian<2, 6> Dpose = {},
210 OptionalJacobian<2, 2> Dpoint = {})
const;
213 static Point3 BackprojectFromCamera(
const Point2& p,
const double depth,
214 OptionalJacobian<3, 2> Dpoint = {},
215 OptionalJacobian<3, 1> Ddepth = {});
234#if GTSAM_ENABLE_BOOST_SERIALIZATION
236 friend class boost::serialization::access;
237 template<
class Archive>
238 void serialize(Archive & ar,
const unsigned int ) {
239 ar & BOOST_SERIALIZATION_NVP(pose_);
256 inline constexpr static auto dimension = 6;
283 return CalibratedCamera(pose);
292 static CalibratedCamera Level(
const Pose2& pose2,
double height);
302 static CalibratedCamera Lookat(
const Point3& eye,
const Point3& target,
303 const Point3& upVector);
325 void print(
const std::string& s =
"CalibratedCamera")
const override {
329 inline size_t dim()
const {
333 inline static size_t Dim() {
345 Point2 project(
const Point3& point, OptionalJacobian<2, 6> Dcamera =
346 {}, OptionalJacobian<2, 3> Dpoint = {})
const;
352 OptionalJacobian<3, 1> Dresult_ddepth = {})
const {
355 Matrix31 Dpoint_ddepth;
356 const Point3 point = BackprojectFromCamera(pn, depth,
357 Dresult_dp ? &Dpoint_dpn : 0,
358 Dresult_ddepth ? &Dpoint_ddepth : 0);
360 Matrix33 Dresult_dpoint;
363 Dresult_dp) ? &Dresult_dpoint : 0);
366 *Dresult_dp = Dresult_dpoint * Dpoint_dpn;
368 *Dresult_ddepth = Dresult_dpoint * Dpoint_ddepth;
381 return pose().
range(point, Dcamera, Dpoint);
391 return this->pose().
range(pose, Dcamera, Dpose);
402 return pose().
range(camera.
pose(), H1, H2);
412#if GTSAM_ENABLE_BOOST_SERIALIZATION
414 friend class boost::serialization::access;
415 template<
class Archive>
416 void serialize(Archive & ar,
const unsigned int ) {
418 & boost::serialization::make_nvp(
"PinholeBase",
419 boost::serialization::base_object<PinholeBase>(*
this));
Macros for Matrix constants to avoid excessive template instantiation.
Base exception type that uses tbb_allocator if GTSAM is compiled with TBB.
Base class and basic functions for Manifold types.
3D Pose manifold SO(3) x R^3 and group SE(3)
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
Point2_ project(const Point3_ &p_cam)
Expression version of PinholeBase::Project.
Definition expressions.h:134
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:43
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
Both ManifoldTraits and Testable.
Definition Manifold.h:156
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition OptionalJacobian.h:40
ThreadsafeException()
Definition ThreadsafeException.h:61
Definition BearingRange.h:42
Definition BearingRange.h:196
A pinhole camera class that has a Pose3, functions as base class for all pinhole cameras.
Definition CalibratedCamera.h:55
Point2 Measurement
Some classes template on either PinholeCamera or StereoCamera, and this typedef informs those classes...
Definition CalibratedCamera.h:67
PinholeBase()
Default constructor.
Definition CalibratedCamera.h:126
static Matrix26 Dpose(const Point2 &pn, double d)
Calculate Jacobian with respect to pose.
Definition CalibratedCamera.cpp:28
virtual void print(const std::string &s="PinholeBase") const
print
Definition CalibratedCamera.cpp:75
PinholeBase(const Pose3 &pose)
Constructor with pose.
Definition CalibratedCamera.h:129
const Point3 & translation() const
get translation
Definition CalibratedCamera.h:165
Rot3 Rotation
Pose Concept requirements.
Definition CalibratedCamera.h:60
const Rot3 & rotation() const
get rotation
Definition CalibratedCamera.h:160
const Pose3 & pose() const
return pose, constant version
Definition CalibratedCamera.h:155
static Pose3 LevelPose(const Pose2 &pose2, double height)
Create a level pose at the given 2D pose and height.
Definition CalibratedCamera.cpp:50
static std::pair< size_t, size_t > TranslationInterval()
Return the start and end indices (inclusive) of the translation component of the exponential map para...
Definition CalibratedCamera.h:226
bool equals(const PinholeBase &camera, double tol=1e-9) const
assert equality up to a tolerance
Definition CalibratedCamera.cpp:70
static Matrix23 Dpoint(const Point2 &pn, double d, const Matrix3 &Rt)
Calculate Jacobian with respect to point.
Definition CalibratedCamera.cpp:38
static Pose3 LookatPose(const Point3 &eye, const Point3 &target, const Point3 &upVector)
Create a camera pose at the given eye position looking at a target point in the scene with the specif...
Definition CalibratedCamera.cpp:59
virtual ~PinholeBase()=default
Default destructor.
A Calibrated camera class [R|-R't], calibration K=I.
Definition CalibratedCamera.h:252
bool equals(const CalibratedCamera &camera, double tol=1e-9) const
Compare with another calibrated camera.
Definition CalibratedCamera.h:259
CalibratedCamera()
default constructor
Definition CalibratedCamera.h:267
CalibratedCamera(const Vector &v)
construct from vector
Definition CalibratedCamera.h:310
double range(const Point3 &point, OptionalJacobian< 1, 6 > Dcamera={}, OptionalJacobian< 1, 3 > Dpoint={}) const
Calculate range to a landmark.
Definition CalibratedCamera.h:378
Point3 backproject(const Point2 &pn, double depth, OptionalJacobian< 3, 6 > Dresult_dpose={}, OptionalJacobian< 3, 2 > Dresult_dp={}, OptionalJacobian< 3, 1 > Dresult_ddepth={}) const
backproject a 2-dimensional point to a 3-dimensional point at given depth
Definition CalibratedCamera.h:349
double range(const Pose3 &pose, OptionalJacobian< 1, 6 > Dcamera={}, OptionalJacobian< 1, 6 > Dpose={}) const
Calculate range to another pose.
Definition CalibratedCamera.h:389
void print(const std::string &s="CalibratedCamera") const override
print
Definition CalibratedCamera.h:325
CalibratedCamera(const Pose3 &pose)
construct with pose
Definition CalibratedCamera.h:271
double range(const CalibratedCamera &camera, OptionalJacobian< 1, 6 > H1={}, OptionalJacobian< 1, 6 > H2={}) const
Calculate range to another camera.
Definition CalibratedCamera.h:399
A 2D pose (Point2,Rot2).
Definition Pose2.h:39
A 3D pose (R,t) : (Rot3,Point3).
Definition Pose3.h:42
Point3 transformFrom(const Point3 &point, OptionalJacobian< 3, 6 > Hself={}, OptionalJacobian< 3, 3 > Hpoint={}) const
takes point in Pose coordinates and transforms it to world coordinates
Definition Pose3.cpp:180
double range(const Point3 &point, OptionalJacobian< 1, 6 > Hself={}, OptionalJacobian< 1, 3 > Hpoint={}) const
Calculate range to a landmark.
Definition Pose3.cpp:232
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
Definition Rot3.h:65