gtsam 4.1.1
gtsam
gtsam::SmartProjectionPoseFactorRollingShutter< CAMERA > Class Template Reference
+ Inheritance diagram for gtsam::SmartProjectionPoseFactorRollingShutter< CAMERA >:

Public Member Functions

 SmartProjectionPoseFactorRollingShutter ()
 Default constructor, only for serialization.
 
 SmartProjectionPoseFactorRollingShutter (const SharedNoiseModel &sharedNoiseModel, const boost::shared_ptr< Cameras > &cameraRig, const SmartProjectionParams &params=SmartProjectionParams())
 Constructor. More...
 
 ~SmartProjectionPoseFactorRollingShutter () override=default
 Virtual destructor.
 
void add (const Point2 &measured, const Key &world_P_body_key1, const Key &world_P_body_key2, const double &alpha, const size_t &cameraId=0)
 add a new measurement, with 2 pose keys, interpolation factor, and cameraId More...
 
void add (const Point2Vector &measurements, const std::vector< std::pair< Key, Key > > &world_P_body_key_pairs, const std::vector< double > &alphas, const FastVector< size_t > &cameraIds=FastVector< size_t >())
 Variant of the previous "add" function in which we include multiple measurements. More...
 
const std::vector< std::pair< Key, Key > > & world_P_body_key_pairs () const
 return (for each observation) the keys of the pair of poses from which we interpolate
 
const std::vector< double > & alphas () const
 return the interpolation factors alphas
 
const boost::shared_ptr< Cameras > & cameraRig () const
 return the calibration object
 
const FastVector< size_t > & cameraIds () const
 return the calibration object
 
void print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
 print More...
 
bool equals (const NonlinearFactor &p, double tol=1e-9) const override
 equals More...
 
Base::Cameras cameras (const Values &values) const override
 Collect all cameras involved in this factor. More...
 
double error (const Values &values) const override
 error calculates the error of the factor. More...
 
void computeJacobiansWithTriangulatedPoint (FBlocks &Fs, Matrix &E, Vector &b, const Values &values) const
 Compute jacobian F, E and error vector at a given linearization point. More...
 
boost::shared_ptr< RegularHessianFactor< DimPose > > createHessianFactor (const Values &values, const double &lambda=0.0, bool diagonalDamping=false) const
 linearize and return a Hessianfactor that is an approximation of error(p)
 
boost::shared_ptr< GaussianFactorlinearizeDamped (const Values &values, const double &lambda=0.0) const
 Linearize to Gaussian Factor (possibly adding a damping factor Lambda for LM) More...
 
boost::shared_ptr< GaussianFactorlinearize (const Values &values) const override
 linearize More...
 
- Public Member Functions inherited from gtsam::SmartProjectionFactor< CAMERA >
 SmartProjectionFactor ()
 Default constructor, only for serialization.
 
 SmartProjectionFactor (const SharedNoiseModel &sharedNoiseModel, const SmartProjectionParams &params=SmartProjectionParams())
 Constructor. More...
 
 ~SmartProjectionFactor () override
 Virtual destructor.
 
void print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
 print More...
 
bool equals (const NonlinearFactor &p, double tol=1e-9) const override
 equals More...
 
bool decideIfTriangulate (const Cameras &cameras) const
 Check if the new linearization point is the same as the one used for previous triangulation. More...
 
TriangulationResult triangulateSafe (const Cameras &cameras) const
 Call gtsam::triangulateSafe iff we need to re-triangulate. More...
 
bool triangulateForLinearize (const Cameras &cameras) const
 Possibly re-triangulate before calculating Jacobians. More...
 
boost::shared_ptr< RegularHessianFactor< Base::Dim > > createHessianFactor (const Cameras &cameras, const double lambda=0.0, bool diagonalDamping=false) const
 Create a Hessianfactor that is an approximation of error(p).
 
boost::shared_ptr< RegularImplicitSchurFactor< CAMERA > > createRegularImplicitSchurFactor (const Cameras &cameras, double lambda) const
 
boost::shared_ptr< JacobianFactorQ< Base::Dim, 2 > > createJacobianQFactor (const Cameras &cameras, double lambda) const
 Create JacobianFactorQ factor.
 
boost::shared_ptr< JacobianFactorQ< Base::Dim, 2 > > createJacobianQFactor (const Values &values, double lambda) const
 Create JacobianFactorQ factor, takes values.
 
boost::shared_ptr< JacobianFactorcreateJacobianSVDFactor (const Cameras &cameras, double lambda) const
 Different (faster) way to compute a JacobianFactorSVD factor.
 
virtual boost::shared_ptr< RegularHessianFactor< Base::Dim > > linearizeToHessian (const Values &values, double lambda=0.0) const
 Linearize to a Hessianfactor.
 
virtual boost::shared_ptr< RegularImplicitSchurFactor< CAMERA > > linearizeToImplicit (const Values &values, double lambda=0.0) const
 Linearize to an Implicit Schur factor.
 
virtual boost::shared_ptr< JacobianFactorQ< Base::Dim, 2 > > linearizeToJacobian (const Values &values, double lambda=0.0) const
 Linearize to a JacobianfactorQ.
 
boost::shared_ptr< GaussianFactorlinearizeDamped (const Cameras &cameras, const double lambda=0.0) const
 Linearize to Gaussian Factor. More...
 
boost::shared_ptr< GaussianFactorlinearizeDamped (const Values &values, const double lambda=0.0) const
 Linearize to Gaussian Factor. More...
 
boost::shared_ptr< GaussianFactorlinearize (const Values &values) const override
 linearize More...
 
bool triangulateAndComputeE (Matrix &E, const Cameras &cameras) const
 Triangulate and compute derivative of error with respect to point. More...
 
bool triangulateAndComputeE (Matrix &E, const Values &values) const
 Triangulate and compute derivative of error with respect to point. More...
 
void computeJacobiansWithTriangulatedPoint (typename Base::FBlocks &Fs, Matrix &E, Vector &b, const Cameras &cameras) const
 Compute F, E only (called below in both vanilla and SVD versions) Assumes the point has been computed Note E can be 2m*3 or 2m*2, in case point is degenerate.
 
bool triangulateAndComputeJacobians (typename Base::FBlocks &Fs, Matrix &E, Vector &b, const Values &values) const
 Version that takes values, and creates the point.
 
bool triangulateAndComputeJacobiansSVD (typename Base::FBlocks &Fs, Matrix &Enull, Vector &b, const Values &values) const
 takes values
 
Vector reprojectionErrorAfterTriangulation (const Values &values) const
 Calculate vector of re-projection errors, before applying noise model.
 
double totalReprojectionError (const Cameras &cameras, boost::optional< Point3 > externalPoint=boost::none) const
 Calculate the error of the factor. More...
 
double error (const Values &values) const override
 Calculate total reprojection error. More...
 
TriangulationResult point () const
 return the landmark
 
TriangulationResult point (const Values &values) const
 COMPUTE the landmark.
 
bool isValid () const
 Is result valid?
 
bool isDegenerate () const
 return the degenerate state
 
bool isPointBehindCamera () const
 return the cheirality status flag
 
bool isOutlier () const
 return the outlier state
 
bool isFarPoint () const
 return the farPoint state
 
- Public Member Functions inherited from gtsam::SmartFactorBase< CAMERA >
 SmartFactorBase ()
 Default Constructor, for serialization.
 
 SmartFactorBase (const SharedNoiseModel &sharedNoiseModel, boost::optional< Pose3 > body_P_sensor=boost::none, size_t expectedNumberCameras=10)
 Construct with given noise model and optional arguments.
 
 ~SmartFactorBase () override
 Virtual destructor, subclasses from NonlinearFactor.
 
void add (const Z &measured, const Key &key)
 Add a new measurement and pose/camera key. More...
 
void add (const ZVector &measurements, const KeyVector &cameraKeys)
 Add a bunch of measurements, together with the camera keys.
 
template<class SFM_TRACK >
void add (const SFM_TRACK &trackToAdd)
 Add an entire SfM_track (collection of cameras observing a single point). More...
 
size_t dim () const override
 Return the dimension (number of rows!) of the factor. More...
 
const ZVector & measured () const
 Return the 2D measurements (ZDim, in general).
 
virtual Cameras cameras (const Values &values) const
 Collect all cameras: important that in key order. More...
 
void print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
 print More...
 
bool equals (const NonlinearFactor &p, double tol=1e-9) const override
 equals More...
 
template<class POINT >
Vector unwhitenedError (const Cameras &cameras, const POINT &point, boost::optional< typename Cameras::FBlocks & > Fs=boost::none, boost::optional< Matrix & > E=boost::none) const
 Compute reprojection errors [h(x)-z] = [cameras.project(p)-z] and derivatives. More...
 
virtual void correctForMissingMeasurements (const Cameras &cameras, Vector &ue, boost::optional< typename Cameras::FBlocks & > Fs=boost::none, boost::optional< Matrix & > E=boost::none) const
 This corrects the Jacobians for the case in which some 2D measurement is missing (nan). More...
 
template<class POINT >
Vector whitenedError (const Cameras &cameras, const POINT &point) const
 Calculate vector of re-projection errors [h(x)-z] = [cameras.project(p) - z], with the noise model applied.
 
template<class POINT >
double totalReprojectionError (const Cameras &cameras, const POINT &point) const
 Calculate the error of the factor. More...
 
template<class POINT >
void computeJacobians (FBlocks &Fs, Matrix &E, Vector &b, const Cameras &cameras, const POINT &point) const
 Compute F, E, and b (called below in both vanilla and SVD versions), where F is a vector of derivatives wrpt the cameras, and E the stacked derivatives with respect to the point. More...
 
template<class POINT >
void computeJacobiansSVD (FBlocks &Fs, Matrix &Enull, Vector &b, const Cameras &cameras, const POINT &point) const
 SVD version that produces smaller Jacobian matrices by doing an SVD decomposition on E, and returning the left nulkl-space of E. More...
 
boost::shared_ptr< RegularHessianFactor< Dim > > createHessianFactor (const Cameras &cameras, const Point3 &point, const double lambda=0.0, bool diagonalDamping=false) const
 Linearize to a Hessianfactor.
 
void updateAugmentedHessian (const Cameras &cameras, const Point3 &point, const double lambda, bool diagonalDamping, SymmetricBlockMatrix &augmentedHessian, const KeyVector allKeys) const
 Add the contribution of the smart factor to a pre-allocated Hessian, using sparse linear algebra. More...
 
void whitenJacobians (FBlocks &F, Matrix &E, Vector &b) const
 Whiten the Jacobians computed by computeJacobians using noiseModel_.
 
boost::shared_ptr< RegularImplicitSchurFactor< CAMERA > > createRegularImplicitSchurFactor (const Cameras &cameras, const Point3 &point, double lambda=0.0, bool diagonalDamping=false) const
 Return Jacobians as RegularImplicitSchurFactor with raw access.
 
boost::shared_ptr< JacobianFactorQ< Dim, ZDim > > createJacobianQFactor (const Cameras &cameras, const Point3 &point, double lambda=0.0, bool diagonalDamping=false) const
 Return Jacobians as JacobianFactorQ.
 
boost::shared_ptr< JacobianFactorcreateJacobianSVDFactor (const Cameras &cameras, const Point3 &point, double lambda=0.0) const
 Return Jacobians as JacobianFactorSVD. More...
 
Pose3 body_P_sensor () const
 
- Public Member Functions inherited from gtsam::NonlinearFactor
 NonlinearFactor ()
 Default constructor for I/O only.
 
template<typename CONTAINER >
 NonlinearFactor (const CONTAINER &keys)
 Constructor from a collection of the keys involved in this factor.
 
virtual ~NonlinearFactor ()
 Destructor.
 
virtual bool active (const Values &) const
 Checks whether a factor should be used based on a set of values. More...
 
virtual shared_ptr clone () const
 Creates a shared_ptr clone of the factor - needs to be specialized to allow for subclasses. More...
 
virtual shared_ptr rekey (const std::map< Key, Key > &rekey_mapping) const
 Creates a shared_ptr clone of the factor with different keys using a map from old->new keys. More...
 
virtual shared_ptr rekey (const KeyVector &new_keys) const
 Clones a factor and fully replaces its keys. More...
 
virtual bool sendable () const
 Should the factor be evaluated in the same thread as the caller This is to enable factors that has shared states (like the Python GIL lock) More...
 
- Public Member Functions inherited from gtsam::Factor
virtual ~Factor ()=default
 Default destructor.
 
KeyVectorkeys ()
 
iterator begin ()
 Iterator at beginning of involved variable keys.
 
iterator end ()
 Iterator at end of involved variable keys.
 
virtual void printKeys (const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
 print only keys More...
 
Key front () const
 First key.
 
Key back () const
 Last key.
 
const_iterator find (Key key) const
 find
 
const KeyVectorkeys () const
 Access the factor's involved variable keys.
 
const_iterator begin () const
 Iterator at beginning of involved variable keys.
 
const_iterator end () const
 Iterator at end of involved variable keys.
 
size_t size () const
 

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef CAMERA Camera
 
- Public Attributes inherited from gtsam::SmartFactorBase< CAMERA >
GTSAM_MAKE_ALIGNED_OPERATOR_NEW typedef boost::shared_ptr< Thisshared_ptr
 shorthand for a smart pointer to a factor.
 

Static Public Attributes

static const int DimBlock
 size of the variable stacking 2 poses from which the observation pose is interpolated More...
 
static const int DimPose = 6
 Pose3 dimension.
 
static const int ZDim = 2
 Measurement dimension (Point2)
 
- Static Public Attributes inherited from gtsam::SmartFactorBase< CAMERA >
static const int Dim = traits<CAMERA>::dimension
 Camera dimension.
 
static const int ZDim = traits<Z>::dimension
 Measurement dimension.
 

Public Types

typedef CameraSet< CAMERA > Cameras
 
typedef boost::shared_ptr< Thisshared_ptr
 shorthand for a smart pointer to a factor
 
typedef Eigen::Matrix< double, ZDim, DimBlockMatrixZD
 
typedef std::vector< MatrixZD, Eigen::aligned_allocator< MatrixZD > > FBlocks
 
- Public Types inherited from gtsam::SmartProjectionFactor< CAMERA >
typedef boost::shared_ptr< Thisshared_ptr
 shorthand for a smart pointer to a factor
 
typedef CAMERA Camera
 shorthand for a set of cameras
 
typedef CameraSet< CAMERA > Cameras
 
- Public Types inherited from gtsam::SmartFactorBase< CAMERA >
typedef Eigen::Matrix< double, ZDim, DimMatrixZD
 
typedef std::vector< MatrixZD, Eigen::aligned_allocator< MatrixZD > > FBlocks
 
typedef CameraSet< CAMERA > Cameras
 The CameraSet data structure is used to refer to a set of cameras.
 
- Public Types inherited from gtsam::NonlinearFactor
typedef boost::shared_ptr< Thisshared_ptr
 
- Public Types inherited from gtsam::Factor
typedef KeyVector::iterator iterator
 Iterator over keys.
 
typedef KeyVector::const_iterator const_iterator
 Const iterator over keys.
 

Protected Attributes

std::vector< std::pair< Key, Key > > world_P_body_key_pairs_
 The keys of the pose of the body (with respect to an external world frame): two consecutive poses for each observation.
 
std::vector< double > alphas_
 interpolation factor (one for each observation) to interpolate between pair of consecutive poses
 
boost::shared_ptr< typename Base::Cameras > cameraRig_
 one or more cameras taking observations (fixed poses wrt body + fixed intrinsics)
 
FastVector< size_t > cameraIds_
 vector of camera Ids (one for each observation, in the same order), identifying which camera took the measurement
 
- Protected Attributes inherited from gtsam::SmartProjectionFactor< CAMERA >
SmartProjectionParams params_
 
TriangulationResult result_
 result from triangulateSafe
 
std::vector< Pose3, Eigen::aligned_allocator< Pose3 > > cameraPosesTriangulation_
 current triangulation poses
 
- Protected Attributes inherited from gtsam::SmartFactorBase< CAMERA >
SharedIsotropic noiseModel_
 As of Feb 22, 2015, the noise model is the same for all measurements and is isotropic. More...
 
ZVector measured_
 Measurements for each of the m views. More...
 
boost::optional< Pose3body_P_sensor_
 Pose of the camera in the body frame.
 
FBlocks Fs
 
- Protected Attributes inherited from gtsam::Factor
KeyVector keys_
 The keys involved in this factor.
 

Friends

class boost::serialization::access
 Serialization function.
 

Additional Inherited Members

- Static Public Member Functions inherited from gtsam::SmartFactorBase< CAMERA >
static Matrix PointCov (const Matrix &E)
 Computes Point Covariance P from the "point Jacobian" E.
 
static void FillDiagonalF (const FBlocks &Fs, Matrix &F)
 Create BIG block-diagonal matrix F from Fblocks.
 
- Protected Types inherited from gtsam::NonlinearFactor
typedef Factor Base
 
typedef NonlinearFactor This
 
- Protected Member Functions inherited from gtsam::Factor
 Factor ()
 Default constructor for I/O.
 
template<typename CONTAINER >
 Factor (const CONTAINER &keys)
 Construct factor from container of keys. More...
 
template<typename ITERATOR >
 Factor (ITERATOR first, ITERATOR last)
 Construct factor from iterator keys. More...
 
bool equals (const This &other, double tol=1e-9) const
 check equality
 
- Static Protected Member Functions inherited from gtsam::Factor
template<typename CONTAINER >
static Factor FromKeys (const CONTAINER &keys)
 Construct factor from container of keys. More...
 
template<typename ITERATOR >
static Factor FromIterators (ITERATOR first, ITERATOR last)
 Construct factor from iterator keys. More...
 

Constructor & Destructor Documentation

◆ SmartProjectionPoseFactorRollingShutter()

template<class CAMERA >
gtsam::SmartProjectionPoseFactorRollingShutter< CAMERA >::SmartProjectionPoseFactorRollingShutter ( const SharedNoiseModel sharedNoiseModel,
const boost::shared_ptr< Cameras > &  cameraRig,
const SmartProjectionParams params = SmartProjectionParams() 
)
inline

Constructor.

Parameters
Isotropicmeasurement noise
cameraRigset of cameras (fixed poses wrt body and intrinsics) taking the measurements
paramsinternal parameters of the smart factors

Member Function Documentation

◆ add() [1/2]

template<class CAMERA >
void gtsam::SmartProjectionPoseFactorRollingShutter< CAMERA >::add ( const Point2 measured,
const Key world_P_body_key1,
const Key world_P_body_key2,
const double &  alpha,
const size_t &  cameraId = 0 
)
inline

add a new measurement, with 2 pose keys, interpolation factor, and cameraId

Parameters
measured2-dimensional location of the projection of a single landmark in a single view (the measurement), interpolated from the 2 poses
world_P_body_key1key corresponding to the first body poses (time <= time pixel is acquired)
world_P_body_key2key corresponding to the second body poses (time >= time pixel is acquired)
alphainterpolation factor in [0,1], such that if alpha = 0 the interpolated pose is the same as world_P_body_key1
cameraIdID of the camera taking the measurement (default 0)

◆ add() [2/2]

template<class CAMERA >
void gtsam::SmartProjectionPoseFactorRollingShutter< CAMERA >::add ( const Point2Vector &  measurements,
const std::vector< std::pair< Key, Key > > &  world_P_body_key_pairs,
const std::vector< double > &  alphas,
const FastVector< size_t > &  cameraIds = FastVector<size_t>() 
)
inline

Variant of the previous "add" function in which we include multiple measurements.

Parameters
measurementsvector of the 2m dimensional location of the projection of a single landmark in the m views (the measurements)
world_P_body_key_pairsvector where the i-th element contains a pair of keys corresponding to the pair of poses from which the observation pose for the i0-th measurement can be interpolated
alphasvector of interpolation params (in [0,1]), one for each measurement (in the same order)
cameraIdsIDs of the cameras taking each measurement (same order as the measurements)

◆ cameras()

template<class CAMERA >
Base::Cameras gtsam::SmartProjectionPoseFactorRollingShutter< CAMERA >::cameras ( const Values values) const
inlineoverridevirtual

Collect all cameras involved in this factor.

Parameters
valuesValues structure which must contain camera poses corresponding to keys involved in this factor
Returns
Cameras

Reimplemented from gtsam::SmartFactorBase< CAMERA >.

◆ computeJacobiansWithTriangulatedPoint()

template<class CAMERA >
void gtsam::SmartProjectionPoseFactorRollingShutter< CAMERA >::computeJacobiansWithTriangulatedPoint ( FBlocks &  Fs,
Matrix &  E,
Vector &  b,
const Values values 
) const
inline

Compute jacobian F, E and error vector at a given linearization point.

Parameters
valuesValues structure which must contain camera poses corresponding to keys involved in this factor
Returns
Return arguments are the camera jacobians Fs (including the jacobian with respect to both body poses we interpolate from), the point Jacobian E, and the error vector b. Note that the jacobians are computed for a given point.

◆ equals()

template<class CAMERA >
bool gtsam::SmartProjectionPoseFactorRollingShutter< CAMERA >::equals ( const NonlinearFactor p,
double  tol = 1e-9 
) const
inlineoverridevirtual

equals

Reimplemented from gtsam::SmartProjectionFactor< CAMERA >.

◆ error()

template<class CAMERA >
double gtsam::SmartProjectionPoseFactorRollingShutter< CAMERA >::error ( const Values values) const
inlineoverridevirtual

error calculates the error of the factor.

Reimplemented from gtsam::SmartProjectionFactor< CAMERA >.

◆ linearize()

template<class CAMERA >
boost::shared_ptr< GaussianFactor > gtsam::SmartProjectionPoseFactorRollingShutter< CAMERA >::linearize ( const Values values) const
inlineoverridevirtual

linearize

Reimplemented from gtsam::SmartProjectionFactor< CAMERA >.

◆ linearizeDamped()

template<class CAMERA >
boost::shared_ptr< GaussianFactor > gtsam::SmartProjectionPoseFactorRollingShutter< CAMERA >::linearizeDamped ( const Values values,
const double &  lambda = 0.0 
) const
inline

Linearize to Gaussian Factor (possibly adding a damping factor Lambda for LM)

Parameters
valuesValues structure which must contain camera poses and extrinsic pose for this factor
Returns
a Gaussian factor

◆ print()

template<class CAMERA >
void gtsam::SmartProjectionPoseFactorRollingShutter< CAMERA >::print ( const std::string &  s = "",
const KeyFormatter keyFormatter = DefaultKeyFormatter 
) const
inlineoverridevirtual

print

Parameters
soptional string naming the factor
keyFormatteroptional formatter useful for printing Symbols

Reimplemented from gtsam::SmartProjectionFactor< CAMERA >.

Member Data Documentation

◆ DimBlock

template<class CAMERA >
const int gtsam::SmartProjectionPoseFactorRollingShutter< CAMERA >::DimBlock
static
Initial value:
=
12

size of the variable stacking 2 poses from which the observation pose is interpolated


The documentation for this class was generated from the following file: