24 #include <gtsam_unstable/dllexport.h> 49 std::shared_ptr<Cal3_S2> K_;
56 bool verboseCheirality_;
62 typedef NoiseModelFactor3<Pose3, Pose3, Point3>
Base;
65 using Base::evaluateError;
78 throwCheirality_(false),
79 verboseCheirality_(false) {}
96 Key poseKey_a,
Key poseKey_b,
Key pointKey,
97 const std::shared_ptr<Cal3_S2>& K,
98 std::optional<Pose3> body_P_sensor = {})
99 : Base(model, poseKey_a, poseKey_b, pointKey),
103 body_P_sensor_(body_P_sensor),
104 throwCheirality_(
false),
105 verboseCheirality_(
false) {}
126 Key poseKey_a,
Key poseKey_b,
Key pointKey,
127 const std::shared_ptr<Cal3_S2>& K,
bool throwCheirality,
128 bool verboseCheirality,
129 std::optional<Pose3> body_P_sensor = {})
130 : Base(model, poseKey_a, poseKey_b, pointKey),
134 body_P_sensor_(body_P_sensor),
135 throwCheirality_(throwCheirality),
136 verboseCheirality_(verboseCheirality) {}
142 gtsam::NonlinearFactor::shared_ptr
clone()
const override {
144 gtsam::NonlinearFactor::shared_ptr(
new This(*
this)));
153 const std::string& s =
"",
154 const KeyFormatter& keyFormatter = DefaultKeyFormatter)
const override {
155 std::cout << s <<
"ProjectionFactorRollingShutter, z = ";
157 std::cout <<
" rolling shutter interpolation param = " << alpha_;
158 if (this->body_P_sensor_)
159 this->body_P_sensor_->print(
" sensor pose in body frame: ");
165 const This* e =
dynamic_cast<const This*
>(&p);
166 return e && Base::equals(p, tol) && (alpha_ == e->alpha()) &&
168 this->K_->equals(*e->K_, tol) &&
169 (this->throwCheirality_ == e->throwCheirality_) &&
170 (this->verboseCheirality_ == e->verboseCheirality_) &&
171 ((!body_P_sensor_ && !e->body_P_sensor_) ||
172 (body_P_sensor_ && e->body_P_sensor_ &&
173 body_P_sensor_->
equals(*e->body_P_sensor_)));
177 Vector evaluateError(
185 inline const std::shared_ptr<Cal3_S2>
calibration()
const {
return K_; }
188 inline double alpha()
const {
return alpha_; }
197 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 198 friend class boost::serialization::access; 200 template <
class ARCHIVE>
201 void serialize(ARCHIVE& ar,
const unsigned int ) {
202 ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
203 ar& BOOST_SERIALIZATION_NVP(measured_);
204 ar& BOOST_SERIALIZATION_NVP(alpha_);
205 ar& BOOST_SERIALIZATION_NVP(K_);
206 ar& BOOST_SERIALIZATION_NVP(body_P_sensor_);
207 ar& BOOST_SERIALIZATION_NVP(throwCheirality_);
208 ar& BOOST_SERIALIZATION_NVP(verboseCheirality_);
213 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
219 :
public Testable<ProjectionFactorRollingShutter> {};
const std::shared_ptr< Cal3_S2 > calibration() const
Definition: ProjectionFactorRollingShutter.h:185
bool verboseCheirality() const
Definition: ProjectionFactorRollingShutter.h:191
Definition: NonlinearFactor.h:431
std::string serialize(const T &input)
serializes to a string
Definition: serialization.h:113
double alpha() const
Definition: ProjectionFactorRollingShutter.h:188
ProjectionFactorRollingShutter(const Point2 &measured, double alpha, const SharedNoiseModel &model, Key poseKey_a, Key poseKey_b, Key pointKey, const std::shared_ptr< Cal3_S2 > &K, std::optional< Pose3 > body_P_sensor={})
Definition: ProjectionFactorRollingShutter.h:94
Definition: Testable.h:152
Vector2 Point2
Definition: Point2.h:32
Definition: NonlinearFactor.h:68
bool equals(const NonlinearFactor &p, double tol=1e-9) const override
equals
Definition: ProjectionFactorRollingShutter.h:164
std::shared_ptr< This > shared_ptr
shorthand for a smart pointer to a factor
Definition: ProjectionFactorRollingShutter.h:72
double alpha_
Definition: ProjectionFactorRollingShutter.h:48
bool throwCheirality_
Definition: ProjectionFactorRollingShutter.h:55
Base class for all pinhole cameras.
ProjectionFactorRollingShutter This
shorthand for this class
Definition: ProjectionFactorRollingShutter.h:69
Definition: ProjectionFactorRollingShutter.h:43
Matrix * OptionalMatrixType
Definition: NonlinearFactor.h:55
virtual ~ProjectionFactorRollingShutter()
Definition: ProjectionFactorRollingShutter.h:139
gtsam::NonlinearFactor::shared_ptr clone() const override
Definition: ProjectionFactorRollingShutter.h:142
GTSAM_EXPORT void print(const Matrix &A, const std::string &s, std::ostream &stream)
ProjectionFactorRollingShutter()
Default constructor.
Definition: ProjectionFactorRollingShutter.h:75
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
Point2 measured_
2D measurement
Definition: ProjectionFactorRollingShutter.h:47
Calibrated camera for which only pose is unknown.
NoiseModelFactor3< Pose3, Pose3, Point3 > Base
shorthand for base class type
Definition: ProjectionFactorRollingShutter.h:62
Definition: chartTesting.h:28
Non-linear factor base classes.
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
Definition: ProjectionFactorRollingShutter.h:152
std::optional< Pose3 > body_P_sensor_
The pose of the sensor in the body frame.
Definition: ProjectionFactorRollingShutter.h:52
bool throwCheirality() const
Definition: ProjectionFactorRollingShutter.h:194
Vector3 Point3
Definition: Point3.h:38
ProjectionFactorRollingShutter(const Point2 &measured, double alpha, const SharedNoiseModel &model, Key poseKey_a, Key poseKey_b, Key pointKey, const std::shared_ptr< Cal3_S2 > &K, bool throwCheirality, bool verboseCheirality, std::optional< Pose3 > body_P_sensor={})
Definition: ProjectionFactorRollingShutter.h:124
const Point2 & measured() const
Definition: ProjectionFactorRollingShutter.h:182
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:102
noiseModel::Base::shared_ptr SharedNoiseModel
Definition: NoiseModel.h:741
The most common 5DOF 3D->2D calibration.
bool equals(const This &other, double tol=1e-9) const
check equality