36 using namespace Eigen;
53 _estimate << 1. , 1. , .5 , .5 , .1;
58 for (
int i=0; i<5; i++)
65 for (
int i=0; i<5; i++)
66 os << _estimate[i] <<
" ";
79 for (
int i=0; i<3; i++){
83 for (
int i=0; i<4; i++) {
95 double fx, fy, cx, cy, tx;
100 is >> fy >> cx >> cy >> tx;
104 std::cerr <<
"cam not defined, using defaults" << std::endl;
105 cam.
setKcam(300,300,320,320,0.1);
117 const SBACam &cam = estimate();
120 for (
int i=0; i<3; i++)
122 for (
int i=0; i<4; i++)
123 os << cam.
rotation().coeffs()[i] <<
" ";
126 os << cam.
Kcam(0,0) <<
" ";
127 os << cam.
Kcam(1,1) <<
" ";
128 os << cam.
Kcam(0,2) <<
" ";
129 os << cam.
Kcam(1,2) <<
" ";
142 for (
int i=0; i<7; i++)
146 for (
int i=0; i<6; i++)
147 for (
int j=i; j<6; j++) {
157 for (
int i=0; i<7; i++)
159 for (
int i=0; i<6; i++)
160 for (
int j=i; j<6; j++){
170 if (from_.count(from) > 0)
184 for (
int i=0; i<3; i++)
192 for (
int i=0; i<3; i++){
208 for (
int i=0; i<2; i++)
218 for (
int i=0; i<2; i++)
232 for (
int i=0; i<3; i++)
242 for (
int i=0; i<3; i++)
263 Eigen::Matrix<double,3,1,Eigen::ColMajor> pc = cam.
w2n * pt;
270 double ipz2 = 1.0/(pz*pz);
272 std::cout <<
"[SetJac] infinite jac" << std::endl;
276 double ipz2fx = ipz2*cam.
Kcam(0,0);
277 double ipz2fy = ipz2*cam.
Kcam(1,1);
280 Eigen::Matrix<double,3,1,Eigen::ColMajor> pwt;
283 pwt = (pt-trans).head<3>();
286 Eigen::Matrix<double,3,1,Eigen::ColMajor> dp = cam.
dRdx * pwt;
302 dp = -cam.
w2n.col(0);
306 dp = -cam.
w2n.col(1);
310 dp = -cam.
w2n.col(2);
348 Eigen::Matrix<double,3,1,Eigen::ColMajor> pc = cam.
w2n * pt;
355 double ipz2 = 1.0/(pz*pz);
357 std::cout <<
"[SetJac] infinite jac" << std::endl;
361 double ipz2fx = ipz2*cam.
Kcam(0,0);
362 double ipz2fy = ipz2*cam.
Kcam(1,1);
364 Eigen::Matrix<double,3,1,Eigen::ColMajor> pwt;
367 pwt = (pt-trans).head<3>();
370 Eigen::Matrix<double,3,1,Eigen::ColMajor> dp = cam.
dRdx * pwt;
383 dp = -cam.
w2n.col(0);
386 dp = -cam.
w2n.col(1);
389 dp = -cam.
w2n.col(2);
438 Eigen::Matrix<double,3,1,Eigen::ColMajor> pc = cam.
w2n * pt;
445 double ipz2 = 1.0/(pz*pz);
447 std::cout <<
"[SetJac] infinite jac" << std::endl;
451 double ipz2fx = ipz2*cam.
Kcam(0,0);
452 double ipz2fy = ipz2*cam.
Kcam(1,1);
454 Eigen::Matrix<double,3,1,Eigen::ColMajor> pwt;
457 pwt = (pt-trans).head<3>();
460 Eigen::Matrix<double,3,1,Eigen::ColMajor> dp = cam.
dRdx * pwt;
465 _jacobianOplus[1](0,4) = (pz*dp(0) - px*dp(2))*ipz2fx;
466 _jacobianOplus[1](1,4) = (pz*dp(1) - py*dp(2))*ipz2fy;
469 _jacobianOplus[1](0,5) = (pz*dp(0) - px*dp(2))*ipz2fx;
470 _jacobianOplus[1](1,5) = (pz*dp(1) - py*dp(2))*ipz2fy;
473 dp = -cam.
w2n.col(0);
474 _jacobianOplus[1](0,0) = (pz*dp(0) - px*dp(2))*ipz2fx;
475 _jacobianOplus[1](1,0) = (pz*dp(1) - py*dp(2))*ipz2fy;
476 dp = -cam.
w2n.col(1);
477 _jacobianOplus[1](0,1) = (pz*dp(0) - px*dp(2))*ipz2fx;
478 _jacobianOplus[1](1,1) = (pz*dp(1) - py*dp(2))*ipz2fy;
479 dp = -cam.
w2n.col(2);
480 _jacobianOplus[1](0,2) = (pz*dp(0) - px*dp(2))*ipz2fx;
481 _jacobianOplus[1](1,2) = (pz*dp(1) - py*dp(2))*ipz2fy;
486 _jacobianOplus[0](0,0) = (pz*dp(0) - px*dp(2))*ipz2fx;
487 _jacobianOplus[0](1,0) = (pz*dp(1) - py*dp(2))*ipz2fy;
489 _jacobianOplus[0](0,1) = (pz*dp(0) - px*dp(2))*ipz2fx;
490 _jacobianOplus[0](1,1) = (pz*dp(1) - py*dp(2))*ipz2fy;
492 _jacobianOplus[0](0,2) = (pz*dp(0) - px*dp(2))*ipz2fx;
493 _jacobianOplus[0](1,2) = (pz*dp(1) - py*dp(2))*ipz2fy;
496 _jacobianOplus[2].setZero();
497 _jacobianOplus[2](0,0) = px/pz;
498 _jacobianOplus[2](1,1) = py/pz;
499 _jacobianOplus[2](0,2) = 1.;
500 _jacobianOplus[2](1,3) = 1.;
507 for (
int i=0; i<2; i++)
517 for (
int i=0; i<2; i++)
550 if (from_.count(v1) == 1){
EIGEN_MAKE_ALIGNED_OPERATOR_NEW EdgeSBAScale()
Eigen::Matrix< double, 2, 1, Eigen::ColMajor > Vector2D
virtual void linearizeOplus()
Jacobian for monocular projection with intrinsics calibration.
virtual bool setMeasurementFromState()
G2O_REGISTER_TYPE(VERTEX_TAG, VertexTag)
virtual bool read(std::istream &is)
read the vertex from a stream, i.e., the internal state of the vertex
virtual bool write(std::ostream &os) const
write the vertex to a stream
Eigen::Matrix< double, 3, 1, Eigen::ColMajor > Vector3D
virtual bool read(std::istream &is)
read the vertex from a stream, i.e., the internal state of the vertex
Eigen::Matrix< double, 4, 1, Eigen::ColMajor > Vector4D
std::set< Vertex * > VertexSet
virtual void linearizeOplus()
Jacobian for stereo projection.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW EdgeProjectP2SC()
virtual bool read(std::istream &is)
read the vertex from a stream, i.e., the internal state of the vertex
virtual bool read(std::istream &is)
read the vertex from a stream, i.e., the internal state of the vertex
virtual void setMeasurement(const Measurement &m)
Eigen::Matrix< double, 7, 1 > Vector7d
virtual bool write(std::ostream &os) const
write the vertex to a stream
virtual bool write(std::ostream &os) const
write the vertex to a stream
virtual void setEstimate(const SBACam &cam)
JacobianXiOplusType _jacobianOplusXi
EIGEN_MAKE_ALIGNED_OPERATOR_NEW EdgeProjectP2MC_Intrinsics()
SBACam Vertex, (x,y,z,qw,qx,qy,qz) the parameterization for the increments constructed is a 6d vector...
virtual bool write(std::ostream &os) const
write the vertex to a stream
virtual bool read(std::istream &is)
read the vertex from a stream, i.e., the internal state of the vertex
SE3Quat _inverseMeasurement
virtual void initialEstimate(const OptimizableGraph::VertexSet &from, OptimizableGraph::Vertex *to)
base class to represent an edge connecting an arbitrary number of nodes
EIGEN_MAKE_ALIGNED_OPERATOR_NEW EdgeProjectP2MC()
const Eigen::Quaterniond & rotation() const
virtual bool write(std::ostream &os) const
write the vertex to a stream
A general case Vertex for optimization.
void setTranslation(const Vector3D &t_)
virtual bool write(std::ostream &os) const
write the vertex to a stream
EIGEN_MAKE_ALIGNED_OPERATOR_NEW VertexSBAPointXYZ()
virtual bool read(std::istream &is)
read the vertex from a stream, i.e., the internal state of the vertex
EIGEN_MAKE_ALIGNED_OPERATOR_NEW VertexIntrinsics()
virtual void resize(size_t size)
EIGEN_STRONG_INLINE const InformationType & information() const
information matrix of the constraint
G2O_REGISTER_TYPE_GROUP(data)
virtual bool write(std::ostream &os) const
write the vertex to a stream
const EstimateType & estimate() const
return the current estimate of the vertex
virtual void setMeasurement(const double &m)
virtual bool read(std::istream &is)
read the vertex from a stream, i.e., the internal state of the vertex
void setKcam(double fx, double fy, double cx, double cy, double tx)
JacobianXjOplusType _jacobianOplusXj
Eigen::Matrix< double, 3, 4 > w2n
virtual bool read(std::istream &is)
read the vertex from a stream, i.e., the internal state of the vertex
virtual void linearizeOplus()
Jacobian for monocular projection.
virtual bool write(std::ostream &os) const
write the vertex to a stream
EIGEN_STRONG_INLINE const Measurement & measurement() const
accessor functions for the measurement represented by the edge
virtual void initialEstimate(const OptimizableGraph::VertexSet &from_, OptimizableGraph::Vertex *to_)
std::vector< JacobianType, Eigen::aligned_allocator< JacobianType > > _jacobianOplus
jacobians of the edge (w.r.t. oplus)
virtual void setMeasurement(const SE3Quat &meas)
const Vector3D & translation() const
VertexContainer _vertices