gaoxiang12 / slambook2

edition 2 of the slambook
MIT License
5.39k stars 2k forks source link

ch7 pose_estimation_3d2d.cpp #244

Open crystalascii opened 2 years ago

crystalascii commented 2 years ago

In ch7 pose_estimation_3d2d.cpp void bundleAdjustmentG2O( const VecVector3d &points_3d, const VecVector2d &points_2d, const Mat &K, Sophus::SE3d &pose)

typedef g2o::BlockSolver<g2o::BlockSolverTraits<6, 3>> BlockSolverType; // pose is 6, landmark is 3

how to set the PoseDim and LandmarkDim? Why in here PoseDim is 6 and LandmarkDim is 3? Any tutorial or reference for this topic?

crystalascii commented 2 years ago

ch6 g2oCurveFitting.cpp
main函数里面 //每个误差项优化变量维度为3,误差值维度为1 typedef g2o::BlockSolver<g2o::BlockSolverTraits<3, 1>> BlockSolverType;

这里说的误差值维度为1,我将这里的<3, 1>设置为<3,100>,结果答案一样。 是否说明在一元边里面,第二个参数值可以忽略,不知道这样的理解是不是对的?

gaoxiang12 commented 2 years ago

g2o内部会根据这两个变量设置一些雅可比矩阵的内存分配情况。设大了一般没影响。 但是把PoseDim和LandmarkDim写在模板参数里也是种限制,因为有的问题可能用不到Pose和Landmark的概念,讲解起来就比较模糊。

crystalascii commented 2 years ago

谢谢高博的答复,确实如高博所说的,在解决不需要用到Pose和Landmark的问题,比如曲线拟合时,这两个参数让人有点摸不着头脑。个人感觉g2o的官方支持文档做的不是太好,只能依靠摸索着前进。

0315Clyyy commented 1 year ago

您好,请问您知道为什么在pose_estimation_3d2d.cpp中面对每条边两个节点的情况依然设置一元边?是因为只有一个优化变量T吗?既然设置了一元边为什么在g2o::BlockSolver中设置<6,3>呢?