BAL(bundle adjustment large)
Kong Liangqian Lv6

BAL数据集解释

1
2
3
4
5
6
7
8
9
10
<num_cameras> <num_points> <num_observations>
<camera_index_1> <point_index_1> <x_1> <y_1>
...
<camera_index_num_observations> <point_index_num_observations> <x_num_observations> <y_num_observations>
<camera_1>
...
<camera_num_cameras>
<point_1>
...
<point_num_points>

第一行,表示相机的数量,点的数量,和观察的数量(一个点可以在多个相机视角被观察到)

第二行,

camera_index_1camera_index_num_observations这么多行,表示某一个点在某个相机上的像素坐标

第五行,依次表示相机的参数(9个:- R,t,f,k1和k2。 旋转R被指定为罗德里格斯的向量)

第八行,依次表示点的xyz坐标

所以下面的行数

1
2
3
4
5
6
<camera_1>
...
<camera_num_cameras>
<point_1>
...
<point_num_points>

应该为num_camera*9+num_points*3

顶点

顶点为需要优化的参数,是包含噪声的

G2O内部已经定义好的几个顶点类型

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
VertexSE2 : public BaseVertex<3, SE2>  //2D pose Vertex, (x,y,theta)
VertexSE3 : public BaseVertex<6, Isometry3> //6d vector (x,y,z,qx,qy,qz) (note that we leave out the w part of the quaternion)
VertexPointXY : public BaseVertex<2, Vector2>
VertexPointXYZ : public BaseVertex<3, Vector3>
VertexSBAPointXYZ : public BaseVertex<3, Vector3>

// SE3 Vertex parameterized internally with a transformation matrix and externally with its exponential map
VertexSE3Expmap : public BaseVertex<6, SE3Quat>

// SBACam Vertex, (x,y,z,qw,qx,qy,qz),(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
VertexCam : public BaseVertex<6, SBACam>

// Sim3 Vertex, (x,y,z,qw,qx,qy,qz),7d vector,(x,y,z,qx,qy,qz) (note that we leave out the w part of the quaternion.
VertexSim3Expmap : public BaseVertex<7, Sim3>

顶点类中需要的定义的四个方法

读写不需要动

1
2
3
virtual bool read(istream &in) {}

virtual bool write(ostream &out) const {}

设置待估计值的初始状态

1
2
3
virtual void setToOriginImpl() override {
_estimate = PoseAndIntrinsics();
}

以及如何更新估计值

1
2
3
4
5
6
7
virtual void oplusImpl(const double *update) override {
_estimate.rotation = SO3d::exp(Vector3d(update[0], update[1], update[2])) * _estimate.rotation;
_estimate.translation += Vector3d(update[3], update[4], update[5]);
_estimate.focal += update[6];
_estimate.k1 += update[7];
_estimate.k2 += update[8];
}

需要知道的成员变量

1
EstimateType _estimate;

此为这个顶点需要估计的估计值

 Comments