Public Types | Public Member Functions | Private Types | List of all members
gtsam::SmartStereoProjectionFactor Class Reference

#include <SmartStereoProjectionFactor.h>

Inheritance diagram for gtsam::SmartStereoProjectionFactor:
Inheritance graph
[legend]

Public Types

typedef CameraSet< StereoCameraCameras
 Vector of cameras. More...
 
typedef PinholeCamera< Cal3_S2MonoCamera
 Vector of monocular cameras (stereo treated as 2 monocular) More...
 
typedef CameraSet< MonoCameraMonoCameras
 
typedef MonoCamera::MeasurementVector MonoMeasurements
 
typedef std::shared_ptr< SmartStereoProjectionFactorshared_ptr
 shorthand for a smart pointer to a factor More...
 
- Public Types inherited from gtsam::SmartFactorBase< StereoCamera >
typedef CameraSet< StereoCameraCameras
 The CameraSet data structure is used to refer to a set of cameras. More...
 
typedef std::vector< MatrixZD, Eigen::aligned_allocator< MatrixZD > > FBlocks
 
typedef Eigen::Matrix< double, ZDim, DimMatrixZD
 
- Public Types inherited from gtsam::NonlinearFactor
typedef std::shared_ptr< Thisshared_ptr
 
- Public Types inherited from gtsam::Factor
typedef KeyVector::const_iterator const_iterator
 Const iterator over keys. More...
 
typedef KeyVector::iterator iterator
 Iterator over keys. More...
 

Public Member Functions

void computeJacobiansWithTriangulatedPoint (FBlocks &Fs, Matrix &E, Vector &b, const Cameras &cameras) const
 
void correctForMissingMeasurements (const Cameras &cameras, Vector &ue, typename Cameras::FBlocks *Fs=nullptr, Matrix *E=nullptr) const override
 
std::shared_ptr< RegularHessianFactor< Base::Dim > > createHessianFactor (const Cameras &cameras, const double lambda=0.0, bool diagonalDamping=false) const
 linearize returns a Hessianfactor that is an approximation of error(p) More...
 
std::shared_ptr< JacobianFactorcreateJacobianSVDFactor (const Cameras &cameras, double lambda) const
 different (faster) way to compute Jacobian factor More...
 
bool decideIfTriangulate (const Cameras &cameras) const
 Check if the new linearization point_ is the same as the one used for previous triangulation. More...
 
bool equals (const NonlinearFactor &p, double tol=1e-9) const override
 equals More...
 
double error (const Values &values) const override
 Calculate total reprojection error. More...
 
bool isDegenerate () const
 
bool isFarPoint () const
 
bool isOutlier () const
 
bool isPointBehindCamera () const
 
bool isValid () const
 Is result valid? More...
 
std::shared_ptr< GaussianFactorlinearize (const Values &values) const override
 linearize More...
 
std::shared_ptr< GaussianFactorlinearizeDamped (const Cameras &cameras, const double lambda=0.0) const
 
std::shared_ptr< GaussianFactorlinearizeDamped (const Values &values, const double lambda=0.0) const
 
TriangulationResult point () const
 
TriangulationResult point (const Values &values) const
 
void print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
 
Vector reprojectionErrorAfterTriangulation (const Values &values) const
 Calculate vector of re-projection errors, before applying noise model. More...
 
 SmartStereoProjectionFactor (const SharedNoiseModel &sharedNoiseModel, const SmartStereoProjectionParams &params=SmartStereoProjectionParams(), const std::optional< Pose3 > body_P_sensor={})
 
double totalReprojectionError (const Cameras &cameras, std::optional< Point3 > externalPoint={}) const
 
bool triangulateAndComputeE (Matrix &E, const Cameras &cameras) const
 
bool triangulateAndComputeE (Matrix &E, const Values &values) const
 
bool triangulateAndComputeJacobians (FBlocks &Fs, Matrix &E, Vector &b, const Values &values) const
 Version that takes values, and creates the point. More...
 
bool triangulateAndComputeJacobiansSVD (FBlocks &Fs, Matrix &Enull, Vector &b, const Values &values) const
 takes values More...
 
bool triangulateForLinearize (const Cameras &cameras) const
 triangulate More...
 
TriangulationResult triangulateSafe (const Cameras &cameras) const
 triangulateSafe More...
 
 ~SmartStereoProjectionFactor () override
 
- Public Member Functions inherited from gtsam::SmartFactorBase< StereoCamera >
void add (const Z &measured, const Key &key)
 
void add (const ZVector &measurements, const KeyVector &cameraKeys)
 Add a bunch of measurements, together with the camera keys. More...
 
void add (const SFM_TRACK &trackToAdd)
 
Pose3 body_P_sensor () const
 
virtual Cameras cameras (const Values &values) const
 Collect all cameras: important that in key order. More...
 
void computeJacobians (FBlocks &Fs, Matrix &E, Vector &b, const Cameras &cameras, const POINT &point) const
 
void computeJacobiansSVD (FBlocks &Fs, Matrix &Enull, Vector &b, const Cameras &cameras, const POINT &point) const
 
void correctForMissingMeasurements (const Cameras &cameras, Vector &ue, OptArgs &&... optArgs) const
 
std::shared_ptr< RegularHessianFactor< Dim > > createHessianFactor (const Cameras &cameras, const Point3 &point, const double lambda=0.0, bool diagonalDamping=false) const
 Linearize to a Hessianfactor. More...
 
std::shared_ptr< JacobianFactorQ< Dim, ZDim > > createJacobianQFactor (const Cameras &cameras, const Point3 &point, double lambda=0.0, bool diagonalDamping=false) const
 Return Jacobians as JacobianFactorQ. More...
 
std::shared_ptr< JacobianFactorcreateJacobianSVDFactor (const Cameras &cameras, const Point3 &point, double lambda=0.0) const
 
std::shared_ptr< RegularImplicitSchurFactor< StereoCamera > > createRegularImplicitSchurFactor (const Cameras &cameras, const Point3 &point, double lambda=0.0, bool diagonalDamping=false) const
 Return Jacobians as RegularImplicitSchurFactor with raw access. More...
 
size_t dim () const override
 Return the dimension (number of rows!) of the factor. More...
 
bool equals (const NonlinearFactor &p, double tol=1e-9) const override
 equals More...
 
const ZVectormeasured () const
 Return the 2D measurements (ZDim, in general). More...
 
void print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
 
 SmartFactorBase ()
 Default Constructor, for serialization. More...
 
 SmartFactorBase (const SharedNoiseModel &sharedNoiseModel, std::optional< Pose3 > body_P_sensor={}, size_t expectedNumberCameras=10)
 Construct with given noise model and optional arguments. More...
 
double totalReprojectionError (const Cameras &cameras, const POINT &point) const
 
Vector unwhitenedError (const Cameras &cameras, const POINT &point, typename Cameras::FBlocks *Fs=nullptr, Matrix *E=nullptr) const
 
Vector unwhitenedError (const Cameras &cameras, const POINT &point, OptArgs &&... optArgs) const
 
void updateAugmentedHessian (const Cameras &cameras, const Point3 &point, const double lambda, bool diagonalDamping, SymmetricBlockMatrix &augmentedHessian, const KeyVector allKeys) const
 
Vector whitenedError (const Cameras &cameras, const POINT &point) const
 
void whitenJacobians (FBlocks &F, Matrix &E, Vector &b) const
 Whiten the Jacobians computed by computeJacobians using noiseModel_. More...
 
 ~SmartFactorBase () override
 Virtual destructor, subclasses from NonlinearFactor. More...
 
- Public Member Functions inherited from gtsam::NonlinearFactor
 NonlinearFactor ()
 
template<typename CONTAINER >
 NonlinearFactor (const CONTAINER &keys)
 
double error (const HybridValues &c) const override
 
virtual bool active (const Values &) const
 
virtual shared_ptr clone () const
 
virtual shared_ptr rekey (const std::map< Key, Key > &rekey_mapping) const
 
virtual shared_ptr rekey (const KeyVector &new_keys) const
 
virtual bool sendable () const
 
- Public Member Functions inherited from gtsam::Factor
virtual ~Factor ()=default
 Default destructor. More...
 
bool empty () const
 Whether the factor is empty (involves zero variables). More...
 
Key front () const
 First key. More...
 
Key back () const
 Last key. More...
 
const_iterator find (Key key) const
 find More...
 
const KeyVectorkeys () const
 Access the factor's involved variable keys. More...
 
const_iterator begin () const
 
const_iterator end () const
 
size_t size () const
 
virtual void printKeys (const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
 print only keys More...
 
bool equals (const This &other, double tol=1e-9) const
 check equality More...
 
KeyVectorkeys ()
 
iterator begin ()
 
iterator end ()
 

Protected Attributes

Parameters
const SmartStereoProjectionParams params_
 
Caching triangulation
TriangulationResult result_
 result from triangulateSafe More...
 
std::vector< Pose3cameraPosesTriangulation_
 current triangulation poses More...
 
- Protected Attributes inherited from gtsam::SmartFactorBase< StereoCamera >
std::optional< Pose3body_P_sensor_
 Pose of the camera in the body frame. More...
 
FBlocks Fs
 
ZVector measured_
 
SharedIsotropic noiseModel_
 
- Protected Attributes inherited from gtsam::Factor
KeyVector keys_
 The keys involved in this factor. More...
 

Private Types

typedef SmartFactorBase< StereoCameraBase
 

Additional Inherited Members

- Static Public Member Functions inherited from gtsam::SmartFactorBase< StereoCamera >
static void FillDiagonalF (const FBlocks &Fs, Matrix &F)
 Create BIG block-diagonal matrix F from Fblocks. More...
 
static Matrix PointCov (const Matrix &E)
 Computes Point Covariance P from the "point Jacobian" E. More...
 
- Public Attributes inherited from gtsam::SmartFactorBase< StereoCamera >
GTSAM_MAKE_ALIGNED_OPERATOR_NEW typedef std::shared_ptr< Thisshared_ptr
 shorthand for a smart pointer to a factor. More...
 
- Static Public Attributes inherited from gtsam::SmartFactorBase< StereoCamera >
static const int Dim
 Camera dimension. More...
 
static const int ZDim
 Measurement dimension. More...
 
- Protected Types inherited from gtsam::NonlinearFactor
typedef Factor Base
 
typedef NonlinearFactor This
 
- Protected Member Functions inherited from gtsam::Factor
 Factor ()
 
template<typename CONTAINER >
 Factor (const CONTAINER &keys)
 
template<typename ITERATOR >
 Factor (ITERATOR first, ITERATOR last)
 
- Static Protected Member Functions inherited from gtsam::Factor
template<typename CONTAINER >
static Factor FromKeys (const CONTAINER &keys)
 
template<typename ITERATOR >
static Factor FromIterators (ITERATOR first, ITERATOR last)
 

Detailed Description

SmartStereoProjectionFactor: triangulates point and keeps an estimate of it around. This factor operates with StereoCamera. This factor requires that values contains the involved StereoCameras. Calibration is assumed to be fixed, as this is also assumed in StereoCamera. If you'd like to store poses in values instead of cameras, use SmartStereoProjectionPoseFactor instead

Definition at line 55 of file SmartStereoProjectionFactor.h.

Member Typedef Documentation

◆ Base

Definition at line 59 of file SmartStereoProjectionFactor.h.

◆ Cameras

Vector of cameras.

Definition at line 80 of file SmartStereoProjectionFactor.h.

◆ MonoCamera

Vector of monocular cameras (stereo treated as 2 monocular)

Definition at line 83 of file SmartStereoProjectionFactor.h.

◆ MonoCameras

Definition at line 84 of file SmartStereoProjectionFactor.h.

◆ MonoMeasurements

Definition at line 85 of file SmartStereoProjectionFactor.h.

◆ shared_ptr

shorthand for a smart pointer to a factor

Definition at line 77 of file SmartStereoProjectionFactor.h.

Constructor & Destructor Documentation

◆ SmartStereoProjectionFactor()

gtsam::SmartStereoProjectionFactor::SmartStereoProjectionFactor ( const SharedNoiseModel sharedNoiseModel,
const SmartStereoProjectionParams params = SmartStereoProjectionParams(),
const std::optional< Pose3 body_P_sensor = {} 
)
inline

Constructor

Parameters
paramsinternal parameters of the smart factors

Definition at line 91 of file SmartStereoProjectionFactor.h.

◆ ~SmartStereoProjectionFactor()

gtsam::SmartStereoProjectionFactor::~SmartStereoProjectionFactor ( )
inlineoverride

Virtual destructor

Definition at line 100 of file SmartStereoProjectionFactor.h.

Member Function Documentation

◆ computeJacobiansWithTriangulatedPoint()

void gtsam::SmartStereoProjectionFactor::computeJacobiansWithTriangulatedPoint ( FBlocks Fs,
Matrix E,
Vector b,
const Cameras cameras 
) const
inline

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

Definition at line 363 of file SmartStereoProjectionFactor.h.

◆ correctForMissingMeasurements()

void gtsam::SmartStereoProjectionFactor::correctForMissingMeasurements ( const Cameras cameras,
Vector ue,
typename Cameras::FBlocks Fs = nullptr,
Matrix E = nullptr 
) const
inlineoverridevirtual

This corrects the Jacobians and error vector for the case in which the right 2D measurement in the monocular camera is missing (nan).

Reimplemented from gtsam::SmartFactorBase< StereoCamera >.

Definition at line 457 of file SmartStereoProjectionFactor.h.

◆ createHessianFactor()

std::shared_ptr<RegularHessianFactor<Base::Dim> > gtsam::SmartStereoProjectionFactor::createHessianFactor ( const Cameras cameras,
const double  lambda = 0.0,
bool  diagonalDamping = false 
) const
inline

linearize returns a Hessianfactor that is an approximation of error(p)

Definition at line 203 of file SmartStereoProjectionFactor.h.

◆ createJacobianSVDFactor()

std::shared_ptr<JacobianFactor> gtsam::SmartStereoProjectionFactor::createJacobianSVDFactor ( const Cameras cameras,
double  lambda 
) const
inline

different (faster) way to compute Jacobian factor

Definition at line 273 of file SmartStereoProjectionFactor.h.

◆ decideIfTriangulate()

bool gtsam::SmartStereoProjectionFactor::decideIfTriangulate ( const Cameras cameras) const
inline

Check if the new linearization point_ is the same as the one used for previous triangulation.

Definition at line 126 of file SmartStereoProjectionFactor.h.

◆ equals()

bool gtsam::SmartStereoProjectionFactor::equals ( const NonlinearFactor p,
double  tol = 1e-9 
) const
inlineoverridevirtual

◆ error()

double gtsam::SmartStereoProjectionFactor::error ( const Values values) const
inlineoverridevirtual

Calculate total reprojection error.

Reimplemented from gtsam::NonlinearFactor.

Reimplemented in gtsam::SmartStereoProjectionFactorPP, and gtsam::SmartStereoProjectionPoseFactor.

Definition at line 445 of file SmartStereoProjectionFactor.h.

◆ isDegenerate()

bool gtsam::SmartStereoProjectionFactor::isDegenerate ( ) const
inline

return the degenerate state

Definition at line 494 of file SmartStereoProjectionFactor.h.

◆ isFarPoint()

bool gtsam::SmartStereoProjectionFactor::isFarPoint ( ) const
inline

return the farPoint state

Definition at line 503 of file SmartStereoProjectionFactor.h.

◆ isOutlier()

bool gtsam::SmartStereoProjectionFactor::isOutlier ( ) const
inline

return the outlier state

Definition at line 500 of file SmartStereoProjectionFactor.h.

◆ isPointBehindCamera()

bool gtsam::SmartStereoProjectionFactor::isPointBehindCamera ( ) const
inline

return the cheirality status flag

Definition at line 497 of file SmartStereoProjectionFactor.h.

◆ isValid()

bool gtsam::SmartStereoProjectionFactor::isValid ( ) const
inline

Is result valid?

Definition at line 491 of file SmartStereoProjectionFactor.h.

◆ linearize()

std::shared_ptr<GaussianFactor> gtsam::SmartStereoProjectionFactor::linearize ( const Values values) const
inlineoverridevirtual

linearize

Implements gtsam::NonlinearFactor.

Reimplemented in gtsam::SmartStereoProjectionFactorPP.

Definition at line 334 of file SmartStereoProjectionFactor.h.

◆ linearizeDamped() [1/2]

std::shared_ptr<GaussianFactor> gtsam::SmartStereoProjectionFactor::linearizeDamped ( const Cameras cameras,
const double  lambda = 0.0 
) const
inline

Linearize to Gaussian Factor

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

Definition at line 304 of file SmartStereoProjectionFactor.h.

◆ linearizeDamped() [2/2]

std::shared_ptr<GaussianFactor> gtsam::SmartStereoProjectionFactor::linearizeDamped ( const Values values,
const double  lambda = 0.0 
) const
inline

Linearize to Gaussian Factor

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

Definition at line 326 of file SmartStereoProjectionFactor.h.

◆ point() [1/2]

TriangulationResult gtsam::SmartStereoProjectionFactor::point ( ) const
inline

return the landmark

Definition at line 480 of file SmartStereoProjectionFactor.h.

◆ point() [2/2]

TriangulationResult gtsam::SmartStereoProjectionFactor::point ( const Values values) const
inline

COMPUTE the landmark

Definition at line 485 of file SmartStereoProjectionFactor.h.

◆ print()

void gtsam::SmartStereoProjectionFactor::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::NonlinearFactor.

Reimplemented in gtsam::SmartStereoProjectionFactorPP, and gtsam::SmartStereoProjectionPoseFactor.

Definition at line 108 of file SmartStereoProjectionFactor.h.

◆ reprojectionErrorAfterTriangulation()

Vector gtsam::SmartStereoProjectionFactor::reprojectionErrorAfterTriangulation ( const Values values) const
inline

Calculate vector of re-projection errors, before applying noise model.

Definition at line 405 of file SmartStereoProjectionFactor.h.

◆ totalReprojectionError()

double gtsam::SmartStereoProjectionFactor::totalReprojectionError ( const Cameras cameras,
std::optional< Point3 externalPoint = {} 
) const
inline

Calculate the error of the factor. This is the log-likelihood, e.g. $ 0.5(h(x)-z)^2/\sigma^2 $ in case of Gaussian. In this class, we take the raw prediction error $ h(x)-z $, ask the noise model to transform it to $ (h(x)-z)^2/\sigma^2 $, and then multiply by 0.5.

Definition at line 420 of file SmartStereoProjectionFactor.h.

◆ triangulateAndComputeE() [1/2]

bool gtsam::SmartStereoProjectionFactor::triangulateAndComputeE ( Matrix E,
const Cameras cameras 
) const
inline

Triangulate and compute derivative of error with respect to point

Returns
whether triangulation worked

Definition at line 343 of file SmartStereoProjectionFactor.h.

◆ triangulateAndComputeE() [2/2]

bool gtsam::SmartStereoProjectionFactor::triangulateAndComputeE ( Matrix E,
const Values values 
) const
inline

Triangulate and compute derivative of error with respect to point

Returns
whether triangulation worked

Definition at line 354 of file SmartStereoProjectionFactor.h.

◆ triangulateAndComputeJacobians()

bool gtsam::SmartStereoProjectionFactor::triangulateAndComputeJacobians ( FBlocks Fs,
Matrix E,
Vector b,
const Values values 
) const
inline

Version that takes values, and creates the point.

Definition at line 383 of file SmartStereoProjectionFactor.h.

◆ triangulateAndComputeJacobiansSVD()

bool gtsam::SmartStereoProjectionFactor::triangulateAndComputeJacobiansSVD ( FBlocks Fs,
Matrix Enull,
Vector b,
const Values values 
) const
inline

takes values

Definition at line 394 of file SmartStereoProjectionFactor.h.

◆ triangulateForLinearize()

bool gtsam::SmartStereoProjectionFactor::triangulateForLinearize ( const Cameras cameras) const
inline

triangulate

Definition at line 197 of file SmartStereoProjectionFactor.h.

◆ triangulateSafe()

TriangulationResult gtsam::SmartStereoProjectionFactor::triangulateSafe ( const Cameras cameras) const
inline

triangulateSafe

Definition at line 167 of file SmartStereoProjectionFactor.h.

Member Data Documentation

◆ cameraPosesTriangulation_

std::vector<Pose3> gtsam::SmartStereoProjectionFactor::cameraPosesTriangulation_
mutableprotected

current triangulation poses

Definition at line 71 of file SmartStereoProjectionFactor.h.

◆ params_

const SmartStereoProjectionParams gtsam::SmartStereoProjectionFactor::params_
protected

Definition at line 65 of file SmartStereoProjectionFactor.h.

◆ result_

TriangulationResult gtsam::SmartStereoProjectionFactor::result_
mutableprotected

result from triangulateSafe

Definition at line 70 of file SmartStereoProjectionFactor.h.


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


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:47:09