40 template <
class POSE =
Pose3,
class LANDMARK =
Point3,
48 std::shared_ptr<CALIBRATION>
K_;
85 Key poseKey,
Key pointKey,
const std::shared_ptr<CALIBRATION>& K,
103 Key poseKey,
Key pointKey,
const std::shared_ptr<CALIBRATION>& K,
113 gtsam::NonlinearFactor::shared_ptr
clone()
const override {
114 return std::static_pointer_cast<gtsam::NonlinearFactor>(
115 gtsam::NonlinearFactor::shared_ptr(
new This(*
this))); }
123 std::cout << s <<
"GenericProjectionFactor, z = ";
125 if(this->body_P_sensor_)
126 this->body_P_sensor_->print(
" sensor pose in body frame: ");
132 const This *e =
dynamic_cast<const This*
>(&p);
136 && this->K_->equals(*e->
K_, tol)
151 return reprojectionError;
161 if (H1) *H1 = Matrix::Zero(2,6);
162 if (H2) *H2 = Matrix::Zero(2,3);
169 return Vector2::Constant(2.0 *
K_->fx());
195#if GTSAM_ENABLE_BOOST_SERIALIZATION
197 friend class boost::serialization::access;
198 template<
class ARCHIVE>
199 void serialize(ARCHIVE & ar,
const unsigned int ) {
200 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
202 ar & BOOST_SERIALIZATION_NVP(
K_);
211 template<
class POSE,
class LANDMARK,
class CALIBRATION>
213 public Testable<GenericProjectionFactor<POSE, LANDMARK, CALIBRATION> > {
The most common 5DOF 3D->2D calibration.
Base class for all pinhole cameras.
3D Pose manifold SO(3) x R^3 and group SE(3)
Arbitrary-arity Jacobian factor with compile-time block dimensions.
Base class for noise model factors with N variables.
Non-linear factor base classes.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition Key.cpp:30
Matrix * OptionalMatrixType
This typedef will be used everywhere boost::optional<Matrix&> reference was used previously.
Definition NonlinearFactor.h:57
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
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition Key.h:35
noiseModel::Base::shared_ptr SharedNoiseModel
Aliases.
Definition NoiseModel.h:846
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
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:152
The most common 5DOF 3D->2D calibration.
Definition Cal3_S2.h:35
Definition CalibratedCamera.h:35
A pinhole camera class that has a Pose3 and a Calibration.
Definition PinholeCamera.h:34
Point2 project(const Point3 &pw, OptionalJacobian< 2, 6 > Dpose={}, OptionalJacobian< 2, 3 > Dpoint={}, OptionalJacobian< 2, DimK > Dcal={}) const
project a 3D point from world coordinates into the image
Definition PinholePose.h:112
A 3D pose (R,t) : (Rot3,Point3).
Definition Pose3.h:42
virtual void print(const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
print
Definition Factor.cpp:29
bool equals(const This &other, double tol=1e-9) const
check equality
Definition Factor.cpp:42
NoiseModelFactorT()
Definition NoiseModelFactorN.h:257
virtual Vector2 evaluateError(const ValueTypes &... x, OptionalMatrixTypeT< ValueTypes >... H) const=0
Nonlinear factor base class.
Definition NonlinearFactor.h:70
Non-linear factor for a constraint derived from a 2D measurement.
Definition ProjectionFactor.h:43
bool verboseCheirality() const
Definition ProjectionFactor.h:188
Vector2 evaluateError(const Pose3 &pose, const Point3 &point, OptionalMatrixType H1, OptionalMatrixType H2) const override
Evaluate error h(x)-z and optionally derivatives.
Definition ProjectionFactor.h:141
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
print
Definition ProjectionFactor.h:122
bool equals(const NonlinearFactor &p, double tol=1e-9) const override
equals
Definition ProjectionFactor.h:131
Point2 measured_
Definition ProjectionFactor.h:47
GenericProjectionFactor< POSE, LANDMARK, CALIBRATION > This
shorthand for this class
Definition ProjectionFactor.h:64
std::optional< POSE > body_P_sensor_
Definition ProjectionFactor.h:49
const Point2 & measured() const
Definition ProjectionFactor.h:173
std::shared_ptr< CALIBRATION > K_
Definition ProjectionFactor.h:48
GenericProjectionFactor(const Point2 &measured, const SharedNoiseModel &model, Key poseKey, Key pointKey, const std::shared_ptr< CALIBRATION > &K, std::optional< POSE > body_P_sensor={})
Constructor TODO: Mark argument order standard (keys, measurement, parameters).
Definition ProjectionFactor.h:84
NoiseModelFactorT< Vector2, POSE, LANDMARK > Base
shorthand for base class type
Definition ProjectionFactor.h:58
~GenericProjectionFactor() override
Virtual destructor.
Definition ProjectionFactor.h:110
GenericProjectionFactor(const Point2 &measured, const SharedNoiseModel &model, Key poseKey, Key pointKey, const std::shared_ptr< CALIBRATION > &K, bool throwCheirality, bool verboseCheirality, std::optional< POSE > body_P_sensor={})
Constructor with exception-handling flags TODO: Mark argument order standard (keys,...
Definition ProjectionFactor.h:102
GenericProjectionFactor()
Default constructor.
Definition ProjectionFactor.h:70
bool throwCheirality_
Definition ProjectionFactor.h:52
std::shared_ptr< This > shared_ptr
Definition ProjectionFactor.h:67
bool throwCheirality() const
Definition ProjectionFactor.h:191
gtsam::NonlinearFactor::shared_ptr clone() const override
Definition ProjectionFactor.h:113
const std::optional< POSE > & body_P_sensor() const
Definition ProjectionFactor.h:183
bool verboseCheirality_
Definition ProjectionFactor.h:53
const std::shared_ptr< CALIBRATION > calibration() const
return the calibration object
Definition ProjectionFactor.h:178