GTSAM  4.0.2
C++ library for smoothing and mapping (SAM)
Public Types | List of all members
gtsam::PinholeCamera< Calibration > Class Template Reference

#include <PinholeCamera.h>

Inheritance diagram for gtsam::PinholeCamera< Calibration >:
Inheritance graph
[legend]
Collaboration diagram for gtsam::PinholeCamera< Calibration >:
Collaboration graph
[legend]

Public Types

enum  { dimension = 6 + DimK }
 
typedef Point2 Measurement
 
typedef Point2Vector MeasurementVector
 
typedef Calibration CalibrationType
 
typedef Rot3 Rotation
 
typedef Point3 Translation
 

Derivatives

static Matrix26 Dpose (const Point2 &pn, double d)
 
static Matrix23 Dpoint (const Point2 &pn, double d, const Matrix3 &Rt)
 

Static functions

static Pose3 LevelPose (const Pose2 &pose2, double height)
 
static Pose3 LookatPose (const Point3 &eye, const Point3 &target, const Point3 &upVector)
 

Testable

bool equals (const PinholeBase &camera, double tol=1e-9) const
 assert equality up to a tolerance
 

Standard Interface

const Rot3rotation () const
 get rotation
 
const Point3translation () const
 get translation
 
const Pose3getPose (OptionalJacobian< 6, 6 > H) const
 return pose, with derivative
 

Transformations and measurement functions

Point2 project2 (const Point3 &point, OptionalJacobian< 2, 6 > Dpose={}, OptionalJacobian< 2, 3 > Dpoint={}) const
 
Point2 project2 (const Unit3 &point, OptionalJacobian< 2, 6 > Dpose={}, OptionalJacobian< 2, 2 > Dpoint={}) const
 
static Point2 Project (const Point3 &pc, OptionalJacobian< 2, 3 > Dpoint={})
 
static Point2 Project (const Unit3 &pc, OptionalJacobian< 2, 2 > Dpoint={})
 
static Point3 BackprojectFromCamera (const Point2 &p, const double depth, OptionalJacobian< 3, 2 > Dpoint={}, OptionalJacobian< 3, 1 > Ddepth={})
 backproject a 2-dimensional point to a 3-dimensional point at given depth
 

Advanced interface

static std::pair< size_t, size_t > translationInterval ()
 

Standard Constructors

 PinholeCamera ()
 
 PinholeCamera (const Pose3 &pose)
 
 PinholeCamera (const Pose3 &pose, const Calibration &K)
 

Named Constructors

static PinholeCamera Level (const Calibration &K, const Pose2 &pose2, double height)
 
static PinholeCamera Level (const Pose2 &pose2, double height)
 PinholeCamera::level with default calibration.
 
static PinholeCamera Lookat (const Point3 &eye, const Point3 &target, const Point3 &upVector, const Calibration &K=Calibration())
 
static PinholeCamera Create (const Pose3 &pose, const Calibration &K, OptionalJacobian< dimension, 6 > H1={}, OptionalJacobian< dimension, DimK > H2={})
 

Advanced Constructors

 PinholeCamera (const Vector &v)
 Init from vector, can be 6D (default calibration) or dim.
 
 PinholeCamera (const Vector &v, const Vector &K)
 Init from Vector and calibration.
 

Testable

bool equals (const Base &camera, double tol=1e-9) const
 assert equality up to a tolerance
 
void print (const std::string &s="PinholeCamera") const override
 print
 

Standard Interface

 ~PinholeCamera () override
 
const Pose3pose () const
 return pose
 
const Pose3getPose (OptionalJacobian< 6, dimension > H) const
 return pose, with derivative
 
const Calibration & calibration () const override
 return calibration
 

Manifold

typedef Eigen::Matrix< double, dimension, 1 > VectorK6
 
size_t dim () const
 
PinholeCamera retract (const Vector &d) const
 move a cameras according to d
 
VectorK6 localCoordinates (const PinholeCamera &T2) const
 return canonical coordinate
 
static size_t Dim ()
 
static PinholeCamera Identity ()
 for Canonical
 

Transformations and measurement functions

typedef Eigen::Matrix< double, 2, DimK > Matrix2K
 
template<class POINT >
Point2 _project2 (const POINT &pw, OptionalJacobian< 2, dimension > Dcamera, OptionalJacobian< 2, FixedDimension< POINT >::value > Dpoint) const
 
Point2 project2 (const Point3 &pw, OptionalJacobian< 2, dimension > Dcamera={}, OptionalJacobian< 2, 3 > Dpoint={}) const
 project a 3D point from world coordinates into the image
 
Point2 project2 (const Unit3 &pw, OptionalJacobian< 2, dimension > Dcamera={}, OptionalJacobian< 2, 2 > Dpoint={}) const
 project a point at infinity from world coordinates into the image
 
double range (const Point3 &point, OptionalJacobian< 1, dimension > Dcamera={}, OptionalJacobian< 1, 3 > Dpoint={}) const
 
double range (const Pose3 &pose, OptionalJacobian< 1, dimension > Dcamera={}, OptionalJacobian< 1, 6 > Dpose={}) const
 
template<class CalibrationB >
double range (const PinholeCamera< CalibrationB > &camera, OptionalJacobian< 1, dimension > Dcamera={}, OptionalJacobian< 1, 6+CalibrationB::dimension > Dother={}) const
 
double range (const CalibratedCamera &camera, OptionalJacobian< 1, dimension > Dcamera={}, OptionalJacobian< 1, 6 > Dother={}) const
 
Matrix34 cameraProjectionMatrix () const
 for Linear Triangulation
 
Vector defaultErrorWhenTriangulatingBehindCamera () const
 for Nonlinear Triangulation
 

Transformations and measurement functions

std::pair< Point2, bool > projectSafe (const Point3 &pw) const
 Project a point into the image and check depth.
 
Point2 _project (const POINT &pw, OptionalJacobian< 2, 6 > Dpose, OptionalJacobian< 2, FixedDimension< POINT >::value > Dpoint, OptionalJacobian< 2, DimK > Dcal) const
 
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
 
Point2 project (const Unit3 &pw, OptionalJacobian< 2, 6 > Dpose={}, OptionalJacobian< 2, 2 > Dpoint={}, OptionalJacobian< 2, DimK > Dcal={}) const
 project a point at infinity from world coordinates into the image
 
Point2 reprojectionError (const Point3 &pw, const Point2 &measured, OptionalJacobian< 2, 6 > Dpose={}, OptionalJacobian< 2, 3 > Dpoint={}, OptionalJacobian< 2, DimK > Dcal={}) const
 project a 3D point from world coordinates into the image
 
Point3 backproject (const Point2 &p, double depth, OptionalJacobian< 3, 6 > Dresult_dpose={}, OptionalJacobian< 3, 2 > Dresult_dp={}, OptionalJacobian< 3, 1 > Dresult_ddepth={}, OptionalJacobian< 3, DimK > Dresult_dcal={}) const
 backproject a 2-dimensional point to a 3-dimensional point at given depth
 
Unit3 backprojectPointAtInfinity (const Point2 &p) const
 backproject a 2-dimensional point to a 3-dimensional point at infinity
 
double range (const Point3 &point, OptionalJacobian< 1, 6 > Dcamera={}, OptionalJacobian< 1, 3 > Dpoint={}) const
 
double range (const Pose3 &pose, OptionalJacobian< 1, 6 > Dcamera={}, OptionalJacobian< 1, 6 > Dpose={}) const
 
double range (const CalibratedCamera &camera, OptionalJacobian< 1, 6 > Dcamera={}, OptionalJacobian< 1, 6 > Dother={}) const
 
double range (const PinholeBaseK< CalibrationB > &camera, OptionalJacobian< 1, 6 > Dcamera={}, OptionalJacobian< 1, 6 > Dother={}) const
 

Detailed Description

template<typename Calibration>
class gtsam::PinholeCamera< Calibration >

A pinhole camera class that has a Pose3 and a Calibration. Use PinholePose if you will not be optimizing for Calibration

Member Typedef Documentation

◆ Measurement

template<typename Calibration>
typedef Point2 gtsam::PinholeCamera< Calibration >::Measurement

Some classes template on either PinholeCamera or StereoCamera, and this typedef informs those classes what "project" returns.

◆ Rotation

Pose Concept requirements

Constructor & Destructor Documentation

◆ PinholeCamera() [1/3]

template<typename Calibration>
gtsam::PinholeCamera< Calibration >::PinholeCamera ( )
inline

default constructor

◆ PinholeCamera() [2/3]

template<typename Calibration>
gtsam::PinholeCamera< Calibration >::PinholeCamera ( const Pose3 pose)
inlineexplicit

constructor with pose

◆ PinholeCamera() [3/3]

template<typename Calibration>
gtsam::PinholeCamera< Calibration >::PinholeCamera ( const Pose3 pose,
const Calibration &  K 
)
inline

constructor with pose and calibration

Member Function Documentation

◆ _project()

Point2 gtsam::PinholeBaseK< Calibration >::_project ( const POINT &  pw,
OptionalJacobian< 2, 6 >  Dpose,
OptionalJacobian< 2, FixedDimension< POINT >::value >  Dpoint,
OptionalJacobian< 2, DimK >  Dcal 
) const
inlineinherited

Templated projection of a point (possibly at infinity) from world coordinate to the image

Parameters
pwis a 3D point or a Unit3 (point at infinity) in world coordinates
Dposeis the Jacobian w.r.t. pose3
Dpointis the Jacobian w.r.t. point3
Dcalis the Jacobian w.r.t. calibration

◆ _project2()

template<typename Calibration>
template<class POINT >
Point2 gtsam::PinholeCamera< Calibration >::_project2 ( const POINT &  pw,
OptionalJacobian< 2, dimension >  Dcamera,
OptionalJacobian< 2, FixedDimension< POINT >::value >  Dpoint 
) const
inline

Templated projection of a 3D point or a point at infinity into the image

Parameters
pweither a Point3 or a Unit3, in world coordinates

◆ dim()

template<typename Calibration>
size_t gtsam::PinholeCamera< Calibration >::dim ( ) const
inline

◆ Dim()

template<typename Calibration>
static size_t gtsam::PinholeCamera< Calibration >::Dim ( )
inlinestatic

◆ Dpoint()

static Matrix23 gtsam::PinholeBase::Dpoint ( const Point2 pn,
double  d,
const Matrix3 &  Rt 
)
staticprotectedinherited

Calculate Jacobian with respect to point

Parameters
pnprojection in normalized coordinates
ddisparity (inverse depth)
Rttransposed rotation matrix

◆ Dpose()

static Matrix26 gtsam::PinholeBase::Dpose ( const Point2 pn,
double  d 
)
staticprotectedinherited

Calculate Jacobian with respect to pose

Parameters
pnprojection in normalized coordinates
ddisparity (inverse depth)

◆ Level()

template<typename Calibration>
static PinholeCamera gtsam::PinholeCamera< Calibration >::Level ( const Calibration &  K,
const Pose2 pose2,
double  height 
)
inlinestatic

Create a level camera at the given 2D pose and height

Parameters
Kthe calibration
pose2specifies the location and viewing direction (theta 0 = looking in direction of positive X axis)
heightcamera height

◆ LevelPose()

static Pose3 gtsam::PinholeBase::LevelPose ( const Pose2 pose2,
double  height 
)
staticinherited

Create a level pose at the given 2D pose and height

Parameters
Kthe calibration
pose2specifies the location and viewing direction (theta 0 = looking in direction of positive X axis)
heightcamera height

◆ Lookat()

template<typename Calibration>
static PinholeCamera gtsam::PinholeCamera< Calibration >::Lookat ( const Point3 eye,
const Point3 target,
const Point3 upVector,
const Calibration &  K = Calibration() 
)
inlinestatic

Create a camera at the given eye position looking at a target point in the scene with the specified up direction vector.

Parameters
eyespecifies the camera position
targetthe point to look at
upVectorspecifies the camera up direction vector, doesn't need to be on the image plane nor orthogonal to the viewing axis
Koptional calibration parameter

◆ LookatPose()

static Pose3 gtsam::PinholeBase::LookatPose ( const Point3 eye,
const Point3 target,
const Point3 upVector 
)
staticinherited

Create a camera pose at the given eye position looking at a target point in the scene with the specified up direction vector.

Parameters
eyespecifies the camera position
targetthe point to look at
upVectorspecifies the camera up direction vector, doesn't need to be on the image plane nor orthogonal to the viewing axis

◆ Project() [1/2]

static Point2 gtsam::PinholeBase::Project ( const Point3 pc,
OptionalJacobian< 2, 3 >  Dpoint = {} 
)
staticinherited

Project from 3D point in camera coordinates into image Does not throw a CheiralityException, even if pc behind image plane

Parameters
pcpoint in camera coordinates

◆ Project() [2/2]

static Point2 gtsam::PinholeBase::Project ( const Unit3 pc,
OptionalJacobian< 2, 2 >  Dpoint = {} 
)
staticinherited

Project from 3D point at infinity in camera coordinates into image Does not throw a CheiralityException, even if pc behind image plane

Parameters
pcpoint in camera coordinates

◆ project2() [1/2]

Point2 gtsam::PinholeBase::project2 ( const Point3 point,
OptionalJacobian< 2, 6 >  Dpose = {},
OptionalJacobian< 2, 3 >  Dpoint = {} 
) const
inherited

Project point into the image Throws a CheiralityException if point behind image plane iff GTSAM_THROW_CHEIRALITY_EXCEPTION

Parameters
point3D point in world coordinates
Returns
the intrinsic coordinates of the projected point

◆ project2() [2/2]

Point2 gtsam::PinholeBase::project2 ( const Unit3 point,
OptionalJacobian< 2, 6 >  Dpose = {},
OptionalJacobian< 2, 2 >  Dpoint = {} 
) const
inherited

Project point at infinity into the image Throws a CheiralityException if point behind image plane iff GTSAM_THROW_CHEIRALITY_EXCEPTION

Parameters
point3D point in world coordinates
Returns
the intrinsic coordinates of the projected point

◆ range() [1/8]

double gtsam::PinholeBaseK< Calibration >::range ( const Point3 point,
OptionalJacobian< 1, 6 >  Dcamera = {},
OptionalJacobian< 1, 3 >  Dpoint = {} 
) const
inlineinherited

Calculate range to a landmark

Parameters
point3D location of landmark
Returns
range (double)

◆ range() [2/8]

double gtsam::PinholeBaseK< Calibration >::range ( const Pose3 pose,
OptionalJacobian< 1, 6 >  Dcamera = {},
OptionalJacobian< 1, 6 >  Dpose = {} 
) const
inlineinherited

Calculate range to another pose

Parameters
poseOther SO(3) pose
Returns
range (double)

◆ range() [3/8]

double gtsam::PinholeBaseK< Calibration >::range ( const CalibratedCamera camera,
OptionalJacobian< 1, 6 >  Dcamera = {},
OptionalJacobian< 1, 6 >  Dother = {} 
) const
inlineinherited

Calculate range to a CalibratedCamera

Parameters
cameraOther camera
Returns
range (double)

◆ range() [4/8]

double gtsam::PinholeBaseK< Calibration >::range ( const PinholeBaseK< CalibrationB > &  camera,
OptionalJacobian< 1, 6 >  Dcamera = {},
OptionalJacobian< 1, 6 >  Dother = {} 
) const
inlineinherited

Calculate range to a PinholePoseK derived class

Parameters
cameraOther camera
Returns
range (double)

◆ range() [5/8]

template<typename Calibration>
double gtsam::PinholeCamera< Calibration >::range ( const Point3 point,
OptionalJacobian< 1, dimension >  Dcamera = {},
OptionalJacobian< 1, 3 >  Dpoint = {} 
) const
inline

Calculate range to a landmark

Parameters
point3D location of landmark
Returns
range (double)

◆ range() [6/8]

template<typename Calibration>
double gtsam::PinholeCamera< Calibration >::range ( const Pose3 pose,
OptionalJacobian< 1, dimension >  Dcamera = {},
OptionalJacobian< 1, 6 >  Dpose = {} 
) const
inline

Calculate range to another pose

Parameters
poseOther SO(3) pose
Returns
range (double)

◆ range() [7/8]

template<typename Calibration>
template<class CalibrationB >
double gtsam::PinholeCamera< Calibration >::range ( const PinholeCamera< CalibrationB > &  camera,
OptionalJacobian< 1, dimension >  Dcamera = {},
OptionalJacobian< 1, 6+CalibrationB::dimension >  Dother = {} 
) const
inline

Calculate range to another camera

Parameters
cameraOther camera
Returns
range (double)

◆ range() [8/8]

template<typename Calibration>
double gtsam::PinholeCamera< Calibration >::range ( const CalibratedCamera camera,
OptionalJacobian< 1, dimension >  Dcamera = {},
OptionalJacobian< 1, 6 >  Dother = {} 
) const
inline

Calculate range to a calibrated camera

Parameters
cameraOther camera
Returns
range (double)

◆ translationInterval()

static std::pair<size_t, size_t> gtsam::PinholeBase::translationInterval ( )
inlinestaticinherited

Return the start and end indices (inclusive) of the translation component of the exponential map parameterization

Returns
a pair of [start, end] indices into the tangent space vector

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