37 typedef NoiseModelFactor2<Pose3, Vector3>
Base;
40 using Base::evaluateError;
50 measured_(0.0, 0.0), K_(new
Cal3_S2(444, 555, 666, 777, 888)) {
64 Base(model, poseKey, landmarkKey), measured_(measured), K_(K), referencePoint_(referencePoint) {}
74 void print(
const std::string&
s =
"InvDepthFactorVariant2",
82 const This *
e =
dynamic_cast<const This*
>(&
p);
84 && Base::equals(p,
tol)
86 && this->K_->equals(*e->K_,
tol)
103 return Vector::Ones(2) * 2.0 * K_->fx();
105 return (
Vector(1) << 0.0).finished();
113 (*H1) = numericalDerivative11<Vector, Pose3>(
115 std::placeholders::_1, landmark),
pose);
118 (*H2) = numericalDerivative11<Vector, Vector3>(
143 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 144 friend class boost::serialization::access; 146 template<
class ARCHIVE>
147 void serialize(ARCHIVE & ar,
const unsigned int ) {
148 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
149 ar & BOOST_SERIALIZATION_NVP(measured_);
150 ar & BOOST_SERIALIZATION_NVP(K_);
151 ar & BOOST_SERIALIZATION_NVP(referencePoint_);
~InvDepthFactorVariant2() override
Jet< T, N > cos(const Jet< T, N > &f)
bool equals(const NonlinearFactor &p, double tol=1e-9) const override
equals
const Cal3_S2::shared_ptr calibration() const
std::string serialize(const T &input)
serializes to a string
noiseModel::Diagonal::shared_ptr model
Jet< T, N > sin(const Jet< T, N > &f)
static Cal3_S2 K(500, 500, 0.1, 640/2, 480/2)
Some functions to compute numerical derivatives.
EIGEN_STRONG_INLINE Packet4f print(const Packet4f &a)
Cal3_S2::shared_ptr K_
shared pointer to calibration object
Vector evaluateError(const Pose3 &pose, const Vector3 &landmark, OptionalMatrixType H1, OptionalMatrixType H2) const override
Evaluate error h(x)-z and optionally derivatives.
static const KeyFormatter DefaultKeyFormatter
static Point3 landmark(0, 0, 5)
Base class for all pinhole cameras.
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
Matrix * OptionalMatrixType
std::shared_ptr< Cal3_S2 > shared_ptr
Vector inverseDepthError(const Pose3 &pose, const Vector3 &landmark) const
Point3 referencePoint_
the reference point/origin for this landmark
Array< double, 1, 3 > e(1./3., 0.5, 2.)
std::shared_ptr< This > shared_ptr
shorthand for a smart pointer to a factor
The most common 5DOF 3D->2D calibration.
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Point2 measured_
2D measurement
static const Pose3 pose(Rot3(Vector3(1, -1, -1).asDiagonal()), Point3(0, 0, 0.5))
Non-linear factor base classes.
InvDepthFactorVariant2()
Default constructor.
NoiseModelFactor2< Pose3, Vector3 > Base
shorthand for base class type
InvDepthFactorVariant2(const Key poseKey, const Key landmarkKey, const Point2 &measured, const Cal3_S2::shared_ptr &K, const Point3 referencePoint, const SharedNoiseModel &model)
InvDepthFactorVariant2 This
shorthand for this class
static const CalibratedCamera camera(kDefaultPose)
const Point3 & referencePoint() const
std::uint64_t Key
Integer nonlinear key type.
void Print(const CONTAINER &keys, const string &s, const KeyFormatter &keyFormatter)
const Point2 & imagePoint() const
void print(const std::string &s="InvDepthFactorVariant2", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
noiseModel::Base::shared_ptr SharedNoiseModel
The most common 5DOF 3D->2D calibration.
const char * what() const noexcept override