g2o
Public Member Functions | Public Attributes | List of all members
g2o::VertexCam Class Reference

SBACam Vertex, (x,y,z,qw,qx,qy,qz) the parameterization for the increments constructed is a 6d vector (x,y,z,qx,qy,qz) (note that we leave out the w part of the quaternion. qw is assumed to be positive, otherwise there is an ambiguity in qx,qy,qz as a rotation. More...

#include <types_sba.h>

Inheritance diagram for g2o::VertexCam:
Inheritance graph
[legend]
Collaboration diagram for g2o::VertexCam:
Collaboration graph
[legend]

Public Member Functions

 VertexCam ()
 
virtual bool read (std::istream &is)
 read the vertex from a stream, i.e., the internal state of the vertex More...
 
virtual bool write (std::ostream &os) const
 write the vertex to a stream More...
 
virtual void setToOriginImpl ()
 sets the node to the origin (used in the multilevel stuff) More...
 
virtual void setEstimate (const SBACam &cam)
 
virtual void oplusImpl (const double *update)
 
virtual bool setEstimateDataImpl (const double *est)
 
virtual bool getEstimateData (double *est) const
 
virtual int estimateDimension () const
 
virtual bool setMinimalEstimateDataImpl (const double *est)
 
virtual bool getMinimalEstimateData (double *est) const
 
virtual int minimalEstimateDimension () const
 
- Public Member Functions inherited from g2o::BaseVertex< 6, SBACam >
 BaseVertex ()
 
virtual const double & hessian (int i, int j) const
 get the element from the hessian matrix More...
 
virtual double & hessian (int i, int j)
 
virtual double hessianDeterminant () const
 
virtual double * hessianData ()
 
virtual void mapHessianMemory (double *d)
 
virtual int copyB (double *b_) const
 
virtual const double & b (int i) const
 get the b vector element More...
 
virtual double & b (int i)
 
Eigen::Matrix< double, D, 1, Eigen::ColMajor > & b ()
 return right hand side b of the constructed linear system More...
 
const Eigen::Matrix< double, D, 1, Eigen::ColMajor > & b () const
 
virtual double * bData ()
 return a pointer to the b vector associated with this vertex More...
 
virtual void clearQuadraticForm ()
 
virtual double solveDirect (double lambda=0)
 
HessianBlockTypeA ()
 return the hessian block associated with the vertex More...
 
const HessianBlockTypeA () const
 
virtual void push ()
 backup the position of the vertex to a stack More...
 
virtual void pop ()
 restore the position of the vertex by retrieving the position from the stack More...
 
virtual void discardTop ()
 pop the last element from the stack, without restoring the current estimate More...
 
virtual int stackSize () const
 return the stack size More...
 
const EstimateTypeestimate () const
 return the current estimate of the vertex More...
 
void setEstimate (const EstimateType &et)
 set the estimate for the vertex also calls updateCache() More...
 
- Public Member Functions inherited from g2o::OptimizableGraph::Vertex
 Vertex ()
 
virtual Vertexclone () const
 returns a deep copy of the current vertex More...
 
virtual ~Vertex ()
 
void setToOrigin ()
 sets the node to the origin (used in the multilevel stuff) More...
 
bool setEstimateData (const double *estimate)
 
bool setEstimateData (const std::vector< double > &estimate)
 
virtual bool getEstimateData (std::vector< double > &estimate) const
 
bool setMinimalEstimateData (const double *estimate)
 
bool setMinimalEstimateData (const std::vector< double > &estimate)
 
virtual bool getMinimalEstimateData (std::vector< double > &estimate) const
 
void oplus (const double *v)
 
int hessianIndex () const
 temporary index of this node in the parameter vector obtained from linearization More...
 
int G2O_ATTRIBUTE_DEPRECATED (tempIndex() const)
 
void setHessianIndex (int ti)
 set the temporary index of the vertex in the parameter blocks More...
 
void G2O_ATTRIBUTE_DEPRECATED (setTempIndex(int ti))
 
bool fixed () const
 true => this node is fixed during the optimization More...
 
void setFixed (bool fixed)
 true => this node should be considered fixed during the optimization More...
 
bool marginalized () const
 true => this node is marginalized out during the optimization More...
 
void setMarginalized (bool marginalized)
 true => this node should be marginalized out during the optimization More...
 
int dimension () const
 dimension of the estimated state belonging to this node More...
 
virtual void setId (int id)
 sets the id of the node in the graph be sure that the graph keeps consistent after changing the id More...
 
void setColInHessian (int c)
 set the row of this vertex in the Hessian More...
 
int colInHessian () const
 get the row of this vertex in the Hessian More...
 
const OptimizableGraphgraph () const
 
OptimizableGraphgraph ()
 
void lockQuadraticForm ()
 
void unlockQuadraticForm ()
 
virtual void updateCache ()
 
CacheContainercacheContainer ()
 
- Public Member Functions inherited from g2o::HyperGraph::Vertex
 Vertex (int id=InvalidId)
 creates a vertex having an ID specified by the argument More...
 
int id () const
 returns the id More...
 
const EdgeSetedges () const
 returns the set of hyper-edges that are leaving/entering in this vertex More...
 
EdgeSetedges ()
 returns the set of hyper-edges that are leaving/entering in this vertex More...
 
virtual HyperGraphElementType elementType () const
 
- Public Member Functions inherited from g2o::HyperGraph::HyperGraphElement
virtual ~HyperGraphElement ()
 
HyperGraphElementclone () const
 
- Public Member Functions inherited from g2o::HyperGraph::DataContainer
 DataContainer ()
 
virtual ~DataContainer ()
 
const DatauserData () const
 the user data associated with this vertex More...
 
DatauserData ()
 
void setUserData (Data *obs)
 
void addUserData (Data *obs)
 

Public Attributes

 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
 

Additional Inherited Members

- Public Types inherited from g2o::BaseVertex< 6, SBACam >
typedef SBACam EstimateType
 
typedef std::stack< EstimateType, std::vector< EstimateType, Eigen::aligned_allocator< EstimateType > > > BackupStackType
 
typedef Eigen::Map< Eigen::Matrix< double, D, D, Eigen::ColMajor >, Eigen::Matrix< double, D, D, Eigen::ColMajor >::Flags &Eigen::AlignedBit?Eigen::Aligned:Eigen::Unaligned > HessianBlockType
 
- Static Public Attributes inherited from g2o::BaseVertex< 6, SBACam >
static const int Dimension
 dimension of the estimate (minimal) in the manifold space More...
 
- Protected Attributes inherited from g2o::BaseVertex< 6, SBACam >
HessianBlockType _hessian
 
Eigen::Matrix< double, D, 1, Eigen::ColMajor > _b
 
EstimateType _estimate
 
BackupStackType _backup
 
- Protected Attributes inherited from g2o::OptimizableGraph::Vertex
OptimizableGraph_graph
 
Data_userData
 
int _hessianIndex
 
bool _fixed
 
bool _marginalized
 
int _dimension
 
int _colInHessian
 
OpenMPMutex _quadraticFormMutex
 
CacheContainer_cacheContainer
 
- Protected Attributes inherited from g2o::HyperGraph::Vertex
int _id
 
EdgeSet _edges
 
- Protected Attributes inherited from g2o::HyperGraph::DataContainer
Data_userData
 

Detailed Description

SBACam Vertex, (x,y,z,qw,qx,qy,qz) the parameterization for the increments constructed is a 6d vector (x,y,z,qx,qy,qz) (note that we leave out the w part of the quaternion. qw is assumed to be positive, otherwise there is an ambiguity in qx,qy,qz as a rotation.

Definition at line 71 of file types_sba.h.

Constructor & Destructor Documentation

g2o::VertexCam::VertexCam ( )

Definition at line 71 of file types_sba.cpp.

72  {
73  }

Member Function Documentation

virtual int g2o::VertexCam::estimateDimension ( ) const
inlinevirtual

returns the dimension of the extended representation used by get/setEstimate(double*) -1 if it is not supported

Reimplemented from g2o::OptimizableGraph::Vertex.

Definition at line 113 of file types_sba.h.

113  {
114  return 7;
115  }
virtual bool g2o::VertexCam::getEstimateData ( double *  estimate) const
inlinevirtual

writes the estimater to an array of double

Returns
true on success

Reimplemented from g2o::OptimizableGraph::Vertex.

Definition at line 107 of file types_sba.h.

107  {
108  Eigen::Map <Vector7d> v(est);
109  v = estimate().toVector();
110  return true;
111  }
Vector7d toVector() const
Definition: se3quat.h:135
const EstimateType & estimate() const
return the current estimate of the vertex
Definition: base_vertex.h:99
virtual bool g2o::VertexCam::getMinimalEstimateData ( double *  estimate) const
inlinevirtual

writes the estimate to an array of double

Returns
true on success

Reimplemented from g2o::OptimizableGraph::Vertex.

Definition at line 123 of file types_sba.h.

123  {
124  Eigen::Map<Vector6d> v(est);
126  return true;
127  }
Vector6d toMinimalVector() const
Definition: se3quat.h:152
virtual int g2o::VertexCam::minimalEstimateDimension ( ) const
inlinevirtual

returns the dimension of the extended representation used by get/setEstimate(double*) -1 if it is not supported

Reimplemented from g2o::OptimizableGraph::Vertex.

Definition at line 129 of file types_sba.h.

129  {
130  return 6;
131  }
virtual void g2o::VertexCam::oplusImpl ( const double *  v)
inlinevirtual

update the position of the node from the parameters in v. Implement in your class!

Implements g2o::OptimizableGraph::Vertex.

Definition at line 91 of file types_sba.h.

92  {
93  Eigen::Map<const Vector6d> v(update);
94  _estimate.update(v);
97  _estimate.setDr();
98  }
void setDr()
Definition: sbacam.h:159
void setTransform()
Definition: sbacam.h:152
void setProjection()
Definition: sbacam.h:156
void update(const Vector6d &update)
Definition: sbacam.h:98
bool g2o::VertexCam::read ( std::istream &  is)
virtual

read the vertex from a stream, i.e., the internal state of the vertex

Implements g2o::OptimizableGraph::Vertex.

Definition at line 75 of file types_sba.cpp.

References g2o::SBACam::setKcam().

76  {
77  // first the position and orientation (vector3 and quaternion)
78  Vector3D t;
79  for (int i=0; i<3; i++){
80  is >> t[i];
81  }
82  Vector4D rc;
83  for (int i=0; i<4; i++) {
84  is >> rc[i];
85  }
86  Quaterniond r;
87  r.coeffs() = rc;
88  r.normalize();
89 
90 
91  // form the camera object
92  SBACam cam(r,t);
93 
94  // now fx, fy, cx, cy, baseline
95  double fx, fy, cx, cy, tx;
96 
97  // try to read one value
98  is >> fx;
99  if (is.good()) {
100  is >> fy >> cx >> cy >> tx;
101  cam.setKcam(fx,fy,cx,cy,tx);
102  } else{
103  is.clear();
104  std::cerr << "cam not defined, using defaults" << std::endl;
105  cam.setKcam(300,300,320,320,0.1);
106  }
107 
108  // set the object
109  setEstimate(cam);
110  // std::cout << cam << std::endl;
111 
112  return true;
113  }
Eigen::Matrix< double, 3, 1, Eigen::ColMajor > Vector3D
Definition: eigen_types.h:46
Eigen::Matrix< double, 4, 1, Eigen::ColMajor > Vector4D
Definition: eigen_types.h:47
virtual void setEstimate(const SBACam &cam)
Definition: types_sba.h:84
virtual void g2o::VertexCam::setEstimate ( const SBACam cam)
inlinevirtual

Definition at line 84 of file types_sba.h.

References g2o::BaseVertex< D, T >::setEstimate().

Referenced by g2o::EdgeSBACam::initialEstimate(), and g2o::EdgeSBAScale::initialEstimate().

84  {
88  _estimate.setDr();
89  }
void setDr()
Definition: sbacam.h:159
void setTransform()
Definition: sbacam.h:152
void setProjection()
Definition: sbacam.h:156
void setEstimate(const EstimateType &et)
set the estimate for the vertex also calls updateCache()
Definition: base_vertex.h:101
virtual bool g2o::VertexCam::setEstimateDataImpl ( const double *  )
inlinevirtual

writes the estimater to an array of double

Returns
true on success

Reimplemented from g2o::OptimizableGraph::Vertex.

Definition at line 101 of file types_sba.h.

101  {
102  Eigen::Map <const Vector7d> v(est);
104  return true;
105  }
void fromVector(const Vector7d &v)
Definition: se3quat.h:147
virtual bool g2o::VertexCam::setMinimalEstimateDataImpl ( const double *  )
inlinevirtual

sets the initial estimate from an array of double

Returns
true on success

Reimplemented from g2o::OptimizableGraph::Vertex.

Definition at line 117 of file types_sba.h.

117  {
118  Eigen::Map<const Vector6d> v(est);
120  return true;
121  }
void fromMinimalVector(const Vector6d &v)
Definition: se3quat.h:163
virtual void g2o::VertexCam::setToOriginImpl ( )
inlinevirtual

sets the node to the origin (used in the multilevel stuff)

Implements g2o::OptimizableGraph::Vertex.

Definition at line 80 of file types_sba.h.

80  {
81  _estimate = SBACam();
82  }
bool g2o::VertexCam::write ( std::ostream &  os) const
virtual

write the vertex to a stream

Implements g2o::OptimizableGraph::Vertex.

Definition at line 115 of file types_sba.cpp.

References g2o::SBACam::baseline, g2o::SBACam::Kcam, g2o::SE3Quat::rotation(), and g2o::SE3Quat::translation().

116  {
117  const SBACam &cam = estimate();
118 
119  // first the position and orientation (vector3 and quaternion)
120  for (int i=0; i<3; i++)
121  os << cam.translation()[i] << " ";
122  for (int i=0; i<4; i++)
123  os << cam.rotation().coeffs()[i] << " ";
124 
125  // now fx, fy, cx, cy, baseline
126  os << cam.Kcam(0,0) << " ";
127  os << cam.Kcam(1,1) << " ";
128  os << cam.Kcam(0,2) << " ";
129  os << cam.Kcam(1,2) << " ";
130  os << cam.baseline << " ";
131  return os.good();
132  }
const EstimateType & estimate() const
return the current estimate of the vertex
Definition: base_vertex.h:99

Member Data Documentation

g2o::VertexCam::EIGEN_MAKE_ALIGNED_OPERATOR_NEW

Definition at line 74 of file types_sba.h.


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