# G2O and multi-view point cloud global registration optimization

SimpleTriangle

## background

I have a bunch of three-dimensional scattered point clouds after initial registration. After rough matching, all the point clouds are basically unified in the same coordinate system, as shown in Figure 1 and Figure 2. In order to obtain better global results, it is necessary to perform global registration optimization on the point cloud after rough matching.

 Figure 1 Point cloud bottom surface Figure 2 Partial details

The above-mentioned point cloud is displayed based on pcl, and different colors represent different point cloud blocks. It can be clearly seen from Figure 1 that the global point cloud "fusion" (in fact, it is not fused, it is just loaded and displayed), and the effect is poor. It can be seen from Figure 2 that there is a large dislocation for the [ear] part.

Because I G2O before, but I haven't done much in-depth research. Knowing that G2O can be used to solve the global optimization problem , which happens to be very similar to the problem I asked to solve.

Therefore, he resolutely chose to use G2O to build solutions to his own problems.

## Further understanding of G2O

G2O is a combination of nonlinear optimization and graph theory . It is mostly used to solve slam back-end optimization problems, and most of its own examples are also related to slam. The so-called graph is a pile of nodes and edges according to a certain relationship. Among them, the node is the goal to be optimized, and the edge is the relationship between each optimization goal (also called its error term, I prefer to call it [relationship] here).

Based on CMake + VS2017 to complete the installation of the G2O library, the installation process is not recorded in detail, and basically Baidu can solve it.

After installing g2o, follow the habit to look through the example carried in its own source code in order to find inspiration. I found it in the example directory at a glance [ gicp_demo ].

### G2O--gicp_demo

The basic method of using g2o is:

1. Declare an optimizer;
2. Choose a solution method;
3. Construct a graph-the relationship between vertices and edges;
4. Optimized processing.

` first time, they thought that "the gicp method is global", but this is not the case. In fact, it cannot even be called a complete icp problem `

`(Regarding the indication in the red font, it is only a personal understanding at present, there may be errors, please leave a message to correct me, and exchange and study together)`

`We know that ICP solution is an iterative calculation process, and the main steps of classic ICP solution are:`

1. `Input two point clouds AB to solve the corresponding point pairs (at least 3 non-collinear points in the three-dimensional model);`
2. `Based on the corresponding point pairs, construct the transformation matrix M from A to B;`
3. `Act M on A to get A*, and replace A with A*;`
4. `Termination condition of iteration (number of iterations or minimum error metric);`
5. `Repeat steps 1--3 until step 4 is met, and terminate.`
6. `Output transformation matrix M.`

`But looking closely at g2o's gicp_demo, its process is not the same as the classic ICP solution process, but more like the solution of step 2 in ICP.`

`Let's take a closer look at the gicp_demo given in g2o.`

### `Disassemble gicp_demo`

`First of all, let's post the official g2o example directly (although it is very annoying to post other people's code directly) for easy explanation.`

`In this Demo, g2o first declared and set the optimizer optimizer , and made a set of 1000 points true_points as the source point cloud.`

`Second, add two nodes to the graph and set the node ID. The node type here is VertexSE3 ( class G2O_TYPES_SLAM3D_API VertexSE3 : public BaseVertex<6, Isometry3> ), which is also the main optimization goal. According to the order in which the nodes are added to the graph, the node added for the first time is regarded as a fixed perspective; vc->setEstimate(cam); This code segment tells us that the real solution result is stored in Eigen::Isometry3d (essentially a matrix), here The type of the cam Eigen::Isometry3d ; this step actually only declares two empty nodes, and the node parameter is just the unit Eigen::Isometry3d .`

`Again, 1000 edges are added to the graph. In this process, first obtain the two vertices (nodes) that the edge needs to link according to the node id, vp0 and vp1 , and "make" two three-dimensional points that contain noise true_points pt0 and pt1 (this step has actually defaulted to pt0 And pt1 are corresponding point pairs); then Edge_V_V_GICP declared, which is a binary edge of class G2O_TYPES_ICP_API Edge_V_V_GICP : public BaseBinaryEdge<3, EdgeGICP, VertexSE3, VertexSE3> (061a7167b54d1b ), which links vp0 and vp1 respectively; 1e7 also provides observations EdgeGICP Value, EdgeGICP type can store the corresponding point pair. In this step, must pay great attention to the belonging of the node and the three-dimensional coordinate point-the corresponding relationship . At this point, you can basically put all the information into the g2o graph. This step is mainly concerned with how to put your own three-dimensional point pairs into the g2o graph.`

`Finally, initialize the graph relationship and perform N iterations of optimization. The optimization result of each node is stored in optimizer.vertices() . In the hash table: key--corresponding to node id, value--corresponding to node, Here is the type VertexSE3 VertexSE3 obtained from Eigen::Isometry3d is the result data we really care about.This example should construct the following hypergraph, where the graph has two graph nodes, n1 is a fixed node, n2 is a variable node, there are 1000 edges between the nodes, and each edge links a pair of corresponding points. For the ICP problem, the corresponding The fixed point in the point is connected to the graph node n1, and the variable point is connected to the graph node n2:`

` `
 node--edge
``````void icp() {
double euc_noise = 0.01;       // noise in position, m

//声明优化器
SparseOptimizer optimizer;
//是否打印详细信息
optimizer.setVerbose(false);

// variable-size block solver
//设定一个求解方法
g2o::OptimizationAlgorithmLevenberg* solver = new g2o::OptimizationAlgorithmLevenberg(
g2o::make_unique<BlockSolverX>(g2o::make_unique<LinearSolverDense<g2o::BlockSolverX::PoseMatrixType>>()));

/*g2o::OptimizationAlgorithmGaussNewton *solver = new g2o::OptimizationAlgorithmGaussNewton(
g2o::make_unique<BlockSolverX>(g2o::make_unique<LinearSolverDense<g2o::BlockSolverX::PoseMatrixType>>()));*/

//设定优化器使用的优化方法
optimizer.setAlgorithm(solver);

//随机点坐标
vector<Vector3d> true_points;
for (size_t i = 0; i < 1000; ++i)
{
//这里从均匀分布中采样了一组数字
true_points.push_back(Vector3d((g2o::Sampler::uniformRand(0., 1.) - 0.5) * 3,
g2o::Sampler::uniformRand(0., 1.) - 0.5,
g2o::Sampler::uniformRand(0., 1.) + 10));
}

// set up two poses
//猜测: 设定两个相机位姿
int vertex_id = 0;
for (size_t i = 0; i < 2; ++i)
{
// set up rotation and translation for this node
//平移向量
Vector3d t(0, 0, i);
//四元数旋转
Quaterniond q;
q.setIdentity();

//李群(特殊欧拉群，包含旋转和平移，自己感觉和4*4矩阵类似)
Eigen::Isometry3d cam; // camera pose
cam = q;
//返回平移向量的可写表达式
cam.translation() = t;

// set up node
//李群。这里作为节点,作为优化变量
VertexSE3 *vc = new VertexSE3();
//设置顶点的估计值
vc->setEstimate(cam);
//设置该节点在 图 中的id，以便追踪
vc->setId(vertex_id);      // vertex id

//打印节点的初始平移和旋转矩阵
cerr << t.transpose() << " | " << q.coeffs().transpose() << endl;

// set first cam pose fixed
if (i == 0)
vc->setFixed(true);

// add to optimizer
//优化器添加节点

vertex_id++;
}

// set up point matches
for (size_t i = 0; i < true_points.size(); ++i)
{
// get two poses
//获取前述添加的节点。
/* optimizer.vertices()的返回值是一个哈希表(Map)类型，本质是std::unordered_map<int, Vertex*>，
*/
VertexSE3* vp0 =
dynamic_cast<VertexSE3*>(optimizer.vertices().find(0)->second);
VertexSE3* vp1 =
dynamic_cast<VertexSE3*>(optimizer.vertices().find(1)->second);

// calculate the relative 3D position of the point
Vector3d pt0, pt1;
pt0 = vp0->estimate().inverse() * true_points[i];
pt1 = vp1->estimate().inverse() * true_points[i];

// add in noise
//添加高斯噪声
pt0 += Vector3d(g2o::Sampler::gaussRand(0., euc_noise),
g2o::Sampler::gaussRand(0., euc_noise),
g2o::Sampler::gaussRand(0., euc_noise));

pt1 += Vector3d(g2o::Sampler::gaussRand(0., euc_noise),
g2o::Sampler::gaussRand(0., euc_noise),
g2o::Sampler::gaussRand(0., euc_noise));

// form edge, with normals in varioius positions
Vector3d nm0, nm1;
nm0 << 0, i, 1;
nm1 << 0, i, 1;
nm0.normalize();
nm1.normalize();

//g20的二元边
Edge_V_V_GICP * e           // new edge with correct cohort for caching
= new Edge_V_V_GICP();

e->setVertex(0, vp0);      // first viewpoint
e->setVertex(1, vp1);      // second viewpoint

EdgeGICP meas;
meas.pos0 = pt0;
meas.pos1 = pt1;
meas.normal0 = nm0;
meas.normal1 = nm1;

//定义观测值
e->setMeasurement(meas);
//        e->inverseMeasurement().pos() = -kp;

meas = e->measurement();
// use this for point-plane
//约束信息(协方差矩阵的逆) = 点面的精度矩阵信息
e->information() = meas.prec0(0.01);

}

// move second cam off of its true position
//变换第二个点云。
VertexSE3* vc =
dynamic_cast<VertexSE3*>(optimizer.vertices().find(1)->second);
Eigen::Isometry3d cam = vc->estimate();
cam.translation() = Vector3d(0, 0, 0.2);
vc->setEstimate(cam);

//初始化整个图结构
optimizer.initializeOptimization();
//计算所有边的误差向量
optimizer.computeActiveErrors();

//输出优化前的误差平方
cout << "Initial chi2(before opt) = " << FIXED(optimizer.chi2()) << endl;

optimizer.setVerbose(true);

optimizer.optimize(5);

//输出优化前的误差平方
cout << "Initial chi2(after opt) = " << FIXED(optimizer.chi2()) << endl;

//打印变化矩阵
cout << endl << "Second vertex should be near 0,0,1" << endl;
cout << dynamic_cast<VertexSE3*>(optimizer.vertices().find(0)->second)
->estimate().translation().transpose() << endl;
cout << dynamic_cast<VertexSE3*>(optimizer.vertices().find(1)->second)
->estimate().translation().transpose() << endl;
}``````

### `test`

`Execute the above example that comes with g2o, and finally print out the transformation matrix. Then extract the example separately, change into your own data (corresponding point pairs), and also output the transformation matrix, and then apply the transformation matrix to the point cloud. The result is shown in Figure 3:`

` `
 Figure 3 g2o--gicp

`Maybe some great gods had expected it to be the result above! ! I have to say that the optimization results of g2o are also far from satisfactory...`

`Is that true? ......`

### `summary`

`If you follow the above process and follow the official example of g2o, the result is really like that! ! ! But compared with pcl's icp, the result is really bad, what's the problem?`

` in the scarlet part above, here I still use scarlet letters to remind myself --- g2o's gicp is not a complete ICP solution .`

`By analyzing the official code example, it can be found that before the solution, the input point pair is essentially corresponding to the default. On this basis, the iterative calculation is based on the same set of corresponding point pairs, and the iterative calculation between the corresponding points of the set For the entire two point clouds, this is actually only one icp calculation, and the result is of course not ideal.`

`In other words, the Demo missed (or g2o was designed in this way, or you don’t know enough about it) the calculation process of the corresponding point pairs in the ICP iteration scheme, that is, the lack of step 1 , g2o--gicp is just a simple calculation Step 2 , only a single optimal transformation matrix is obtained. For the icp solution problem of the overall two point clouds, when the second solution is performed, the corresponding relationship between the corresponding point pairs has changed, so the matrix obtained by g2o---gicp_demo is only a single optimal matrix, so the result is also As shown in Figure 3.`

`So how to get the overall optimal result? Of course, the above steps are put into a big loop, every time g2o--gicp is calculated, the point cloud is transformed, the correspondence relationship is solved again, and the calculation is iterative in turn. The result figure is omitted...`

## `Build an optimized graph`

`After fully understanding the g2o's built-in icp example, I return to the problem I asked to solve at the beginning. There are N pieces of scattered point clouds after rough matching, and I want to perform global optimization registration global point cloud `

`The so-called global point cloud after rough configuration has the following characteristics:`

1. `There is a high overlap rate between two adjacent point clouds;`
2. `There is or no overlap between the separated point clouds (at least one point cloud);`
3. `Each point cloud can have one, zero (this condition can exist, and it does not conflict with condition 1 when constructing the g2o map) or multiple point clouds with high overlap rate;`
4. `The overlap relationship between the point clouds is corresponding (ie: A overlaps with B, C, and D, then there must be A in the overlapped point cloud of the BCD).`

### `optimize the target`

`The optimization goals mentioned above are only our perceptual knowledge, but the optimization goals must also be transformed into mathematical expressions. The dictation is as follows: Optimization goal = Solve--N pieces of three-dimensional scattered point clouds, with point cloud A as the target point cloud, calculate the transformation matrix of all three-dimensional scattered point clouds registered to A, and the transformation matrix makes all corresponding point pairs European The distance is the smallest, or the specified number of iterations is reached. `

`The above optimization goal implies: if A and C do not overlap, then C cannot directly register and align with A, but A and B, B and C overlap, then the transformation from C to A needs to be transformed to B first. The matrix is changed to A again, and it is necessary to ensure that A and B, B and C are all optimal transformations. In other words, B is optimally transformed to A, and C is optimally transformed to B, then the most optimal transformation between ABC and ABC is completed.优 Transformation.`

`After confirming the mathematical expression of the optimization goal, it is also necessary to confirm the expression of the overlap ratio between the point clouds, dictated as follows : overlap ratio = the ratio of the number of corresponding point pairs of the two point clouds to the average point number of the two point clouds. `

`After completing the above two mathematical definitions, the overall flow of the program should be as follows:`

1. `Calculate the corresponding point pairs and overlap ratio between the global point clouds;`
2. `Overlapping point cloud screening (point clouds with a low overlap rate are considered to be non-overlapping and do not participate in the construction of edges in the g2o graph);`
3. `g2o global composition:`

• `Graph node`
• ` side (emphasis)`
• `Optimizer and optimization algorithm`
4. `Based on the output matrix of step 3, update the coordinates of all point clouds;`
5. `Repeat steps 1-4 until the termination conditions are met.`

`The final output is the optimized global point cloud and the corresponding transformation matrix.`

### `Program realization`

`The PCL point cloud library and g2o (nonsense) are used in the project, and pcl is mainly used to calculate the point cloud overlap ratio.`

`From the above [g2o--gicp_demo], we can see that g2o has provided the defined graph node class VertexSE3 and graph binary edge class Edge_V_V_GICP and edge class EdgeGICP for the ICP scheme, which are used directly here, eliminating the need for custom graph edges , Graph nodes are troublesome (Of course, if you learn g2o in depth, it is still recommended to do more exploration).`

#### `Point cloud data structure`

`Through the foregoing analysis, it can be known that a certain point cloud structure should contain the following necessary content:`

1. `Point set`
2. `Is it fixed;`
3. `Transformation matrix`
4. `Adjacency information`
5. `Necessary methods (nearest neighbor point cloud, corresponding point pair calculation).`

`The structure is as follows:`

``````typedef pcl::PointCloud<pcl::PointXYZ> pointcloud;

class MyPnts
{
public:
MyPnts() ;
~MyPnts();
int id;
int v_number;

vector<Vector3d> pts;

bool fixed = false;

Isometry3d pose; //该点云的初始位姿，也是优化目标

//该点云的所有邻接信息
vector<OutgoingEdge*> neighbours;

//当前点云在所有点云序列中的k个最近邻点云(重叠率最高的前K个)
void computeKNNearPnts(vector< std::shared_ptr<MyPnts>>& frames, int k);

//对应点对计算
void computeClosestPointsToNeighbours(vector< shared_ptr<MyPnts>>& frames, float thresh);

/*
* Method:    calCorrespond  计算两片点云的相互对应点对的索引
* Access:    public
* Returns:   std::unordered_map<int, std::vector<int>> first 0->src,1 -> tar;
* Parameter: pointcloud::Ptr src
* Parameter: pointcloud::Ptr tar
*/
std::unordered_map<int, std::vector<int>> calCorrespond(MyPnts src, MyPnts tar,double dst = 10.0);

private:
};``````

`Among them, the calculation of the overlap relationship between the current point cloud and other global point clouds (except the current point cloud) and the corresponding point pairs are all computeKNNearPnts() function 061a7167b55292.`

#### `Map`

`This is the most important and extremely error-prone place.`

`The [coarsely with a global point cloud characteristics], determines the characteristics of the structure of FIG G2 o, FIG side should satisfy [coarse global characteristics of the point cloud] description, pseudo FIG follows : `

 Global icp pseudo image

`As shown in the figure above, suppose: there are 5 point clouds globally, then the g2o graph has 5 nodes, n1 is a fixed node, n1 and n2 overlap, n2 and n5 overlap, n1 and n5 also overlap, but n1 and n3, There is no overlap between n1 and n4, n2 and n4.`

`Note: The overlap relationship here is a constraint relationship from g2o's point of view. Further, it is the link relationship between the edges between two point clouds. This edge may consist of hundreds or thousands of corresponding point pairs. The edges with arrows in the figure above are only indicative, not real graph edges.`

`After clarifying the structure of the diagram, the structure diagram code is as follows:`

``````void G2oPCL::global_icp2(std::vector<std::shared_ptr<MyPnts>> &pnts)
{
using namespace g2o;
using namespace std;
using namespace Eigen;
g2o::SparseOptimizer optimizer;
optimizer.setVerbose(false);
g2o::OptimizationAlgorithmLevenberg* solver = new                         g2o::OptimizationAlgorithmLevenberg(
g2o::make_unique<g2o::BlockSolverX>(g2o::make_unique<g2o::LinearSolverDense<g2o::BlockSolverX::PoseMatrixType>>()));
optimizer.setAlgorithm(solver);

//节点
for (int i = 0; i < pnts.size(); ++i) {

g2o::VertexSE3 *vc = new VertexSE3();

vc->setEstimate( (*pnts[i]).pose);
vc->setId(i);      // vertex id
if (i == 0) {
vc->setFixed(true);
(*pnts[i]).fixed = true;
}
}

//构造全局边关系
for (int i = 0; i < pnts.size(); ++i) {
std::shared_ptr<MyPnts> &current = pnts[i];
int current_nebor = current->neighbours.size();
for (int j = 0; j < current_nebor; ++j) {
OutgoingEdge *oe = current->neighbours[j];
int nearIdx = oe->neighbourIdx;
std::shared_ptr<MyPnts> &dst = pnts[nearIdx];
g2o::VertexSE3* vp0 =
dynamic_cast<g2o::VertexSE3*>(optimizer.vertices().find(nearIdx)->second); //dstCloud
g2o::VertexSE3* vp1 =
dynamic_cast<g2o::VertexSE3*>(optimizer.vertices().find(current->id)->second); //srcCloud
for (auto cor : oe->correspondances) {
g2o::Edge_V_V_GICP * e = new g2o::Edge_V_V_GICP();
e->setVertex(0, vp0);
e->setVertex(1, vp1);
g2o::EdgeGICP meas;
meas.pos0 = dst->pts[cor.second];
meas.pos1 = current->pts[cor.first];

e->setMeasurement(meas);
//use this for point-point
e->information().setIdentity();

}
}
}

optimizer.initializeOptimization();

optimizer.computeActiveErrors();
double chiInit = optimizer.chi2(); //stop innerround if we get 100% better

optimizer.optimize(100);
cout << "round: " << "s" << " chi2: " << FIXED(chiInit) << endl;
for (int i = 0; i < pnts.size(); ++i) {
VertexSE3 *res = dynamic_cast<VertexSE3*>(optimizer.vertices().find(i)->second);

Isometry3d transAndRot = res->estimate();

MyPnts &mypnts = *pnts[i];

for (int j = 0; j < mypnts.v_number; ++j) {
mypnts.pts[j] = transAndRot * mypnts.pts[j];
}
}
}``````

`In the above code, not only the graph structure is constructed and the relationship between each node is set, but the coordinates of the points are also updated, which facilitates the calculation of corresponding point pairs in the next iteration.`

`At this point, the framework based on g2o to solve the problem mentioned at the beginning is basically completed, and the final main program code is as follows:`

``````int main()
{
std::unique_ptr<G2oPCL> gp = std::make_unique<G2oPCL>();

clock_t begin, end;
begin = clock();

std::vector<shared_ptr<MyPnts>> pnts;

//计算与目标点云重叠率最高的两片点云
computeNumbers(pnts, 2);

int N = 40;

for (int i = 0; i <N ; i++) {

std::cout << "\n===这是第" << i << "次全局优化===\n" << std::endl;
//对应点对约束距离为5.0
computeClosestPoints(pnts, 5.0);
gp->global_icp2(pnts);

}
end = clock();
double t = (end - begin) / 1000.0;
std::cout << "\n\n 执行时间是：" << t << std::endl;

std::cout << "保存结果到本地" << std::endl;
savePnts(pnts);
}``````

## `Experimental test`

`After completing the above preparation and code programming, enter your own data (point cloud shown in Figure 1 and Figure 2) into the optimization system.`

### `Test one`

`In this test, computeNumbers(pnts, 2) second parameter is 2, that is, to build a two yuan hypergraph (so-called two yuan hypergraph , but simply own definition, completely with any other The g2o program or code or tutorial is consistent, and does not have real mathematical meaning. It is also not applicable to other g2o learning processes. The so-called binary hypergraph here simply means that each node in the graph has two relational nodes. Similarly, each There are only two constraint relationships for each node), and the final result is as follows:`

 Figure 4 Point cloud bottom surface Figure 5 Partial details

`Comparing Fig. 4 and Fig. 5 with Fig. 1 and Fig. 2 respectively, the visual effect has been improved a lot.`

`The screenshots during execution are as follows:`

 Figure 6 Figure 7 Figure 8 Figure 9

`Observe Figure computeNumbers(pnts, 2); , because the parameter passed in 061a7167b555a7 is 2, so here only the two points with the highest overlap rate of each point cloud are calculated, and the printed information can be seen that the point cloud with the id of 0 has the highest overlap rate It is the point cloud with id 1 and id 2. The point cloud with id 3 has the highest overlap rate of id 2 and id 4, that is to say, the current point cloud with the highest overlap rate is its two adjacent points Cloud, this is in line with your actual situation; continue to see, as the number of iterations increases, the overlap rate between each point cloud is constantly changing, which is also in line with the actual situation; finally, look at the error parameter estimation ch2 The output change of 62w-->24w-->8w-->5w (globally about 20w corresponding point pairs) gradually decreases, that is to say, the global sum of squared Euclidean distances between corresponding point pairs is gradually decreasing, which is also in line with the actual situation.`

`The structure of the binary hypergraph is as follows:`

 Figure 10 Binary graph

### `Test two`

`computeNumbers(pnts, N); parameter N of 061a7167b5561c is set to 3, a ternary hypergraph is constructed.`

`Under the ternary hypergraph, the final effect is similar to that shown in Figure 4 and Figure 5. It is also considered that the global optimization has been completed; during this period, the information output during program execution is as follows:`

`According to the above printing information, the structure of the constructed ternary graph is as follows:`

`So far, I have basically completed my original purpose, I am delighted...`

## `Summary & digressions`

`I am currently just an ordinary villager in g2o novice village, and the above description is not really a slam problem. The description is only to explore ideas for the problems I face, not pedagogical, and not authoritative (some exaggerated). Make personal records and exchanges of interest.`

`The solution and ideas described above should be able to solve the multi-view global registration optimization problem of scattered point clouds, and it should also be regarded as a general solution (not limited to overlapping of adjacent point clouds).`

`G2O is used more in the slam backend. Most of the official demos are slam2d, slam3d, etc., but they are not limited to this. Because I did not extend it in the slam direction for the problems I faced, I did not start with the slam2d routines as described in other tutorials, but chose the ICP field I am more familiar with.`

`But then again, from the perspective of the overall solution, the problem you are facing can be regarded as a typical slam optimization problem: a three-dimensional point cloud with a closed loop of multiple viewing angles is known, and the global camera pose can be solved by finding landmarks. .`

`In short, I know: g2o can be used to solve the nonlinear optimization problem .`

`Lai Lai...`

`(By the way, the picture layout is really bad)`

`c++算法windows`
`阅读 1.6k更新于 2021-12-01 `
`本作品系原创，采用《署名-非商业性使用-禁止演绎 4.0 国际》许可协议知识梳理专注知识整理，总结和分享`
`SimpleTriangle`

`只会写 Hello World 的厨子`

`125 声望`
`88 粉丝`
`0 条评论`
``` window.g_useSSR = true; window.g_initialProps = {"router":{"location":{"pathname":"\u002Fa\u002F1190000041046057\u002Fen","search":"","hash":"","query":{},"state":undefined,"key":"ouh1m9"},"action":"POP"},"@@dva":0,"action":{"1190000041046057":{"votes":0,"isLiked":false,"isHated":undefined,"bookmarks":0,"isBookmarked":false}},"sfApp":{"comment":{"isFetchComments":false,"isShowComment":false}},"article":{"articles":{"rows":[],"size":0,"offset":0,"hasMore":true,"error":false,"loading":false,"isStopLoad":false,"cutLoadNum":1,"isLoadedFirstRecommend":false,"query":""},"currentTab":""},"articleDetail":{"artDetail":{"1190000041046057":{"title":"c++ - G2O and multi-view point cloud global registration optimization_个人文章","keywords":"c++,算法,windows","description":"I have a bunch of three-dimensional scattered point clouds after initial registration. After rough matching, all the point clouds are basically uni...","article":{"id":1190000041046057,"title":"G2O and multi-view point cloud global registration optimization","cover":null,"tags_list":"1040000000089741,1040000000089524,1040000000089709","user_id":1030000003942251,"blog_id":1200000003948721,"excerpt":"I have a bunch of three-dimensional scattered point clouds after initial registration. After rough matching, all the point clouds are basically uni...","parsed_text":"","is_bookmarked":false,"is_liked":false,"created":1638339398,"modified":1638340003,"real_views":1592,"real_unique_views":1315,"votes":0,"bookmarks":0,"status":0,"origin_url":"","article_type":1,"license":"1","langs":["en"],"comments":5,"tags":[{"id":1040000000089741,"url":"\u002Ft\u002Fc%2B%2B","name":"c++","icon_url":""},{"id":1040000000089524,"url":"\u002Ft\u002F%E7%AE%97%E6%B3%95","name":"算法","icon_url":""},{"id":1040000000089709,"url":"\u002Ft\u002Fwindows","name":"windows","icon_url":""}],"user":{"id":1030000003942251,"name":"SimpleTriangle","avatar_url":"https:\u002F\u002Favatar-static.segmentfault.com\u002F288\u002F623\u002F288623484-5637597b03766_huge128","url":"\u002Fu\u002Fyueyingyunfan","rank":125,"rank_word":"125","is_followed":false,"excerpt":"\u003Cp\u003E只会写 Hello World 的厨子\u003C\u002Fp\u003E","followers":88,"articles":28,"user_auth":null},"status_key":"available"},"blog":{"id":1200000003948721,"name":"知识梳理","url":"\u002Fblog\u002Fyueyignyunfan","thumbnail_url":null,"is_followed":false,"excerpt":"专注知识整理，总结和分享","followers":36,"articles":26,"license":"nd"},"actions":[],"member_actions":[],"article_types":{"1":"原创","2":"转载","3":"翻译"},"pay_info":null,"extra":{"reason":null,"operator":null,"operator_time":null},"tag":{"name":"c++","url":"\u002Ft\u002Fc%2B%2B","icon_url":""},"isServerLoaded":true}},"alertMsg":{"showAlert":false,"msg":""},"articleRelated":[]},"editor":{"markdownContent":"","title":{"value":"","isInvalid":false,"errorMsg":""},"log":{"value":"","isInvalid":false,"errorMsg":""},"tags":{"value":[],"isInvalid":false,"errorMsg":""},"draftInfo":{"id":"","status":""},"isFull":false,"initTags":[],"detail":{}},"global":{"sessionUser":null,"isHiddenHeader":false,"isHiddenFooter":false,"title":"G2O and multi-view point cloud global registration optimization - SegmentFault 思否","isShowLogin":false,"beginnerGuideState":{"visible":false,"type":1},"isShowBindMobile":false,"authChannel":"","unactivated":false,"isShowRegister":false,"headOptions":{"keywords":"c++,算法,windows","description":"I have a bunch of three-dimensional scattered point clouds after initial registration. After rough matching, all the point clouds are basically uni..."},"notices":[],"sessionInfo":{"key":"faa5e3b0be987b01be9123a5d9400c4c","login":false,"id":null},"singleNotice":"","currentRoute":{"customLayout":false,"headerType":undefined,"platform":undefined,"eggCtx":{"request":{"method":"GET","url":"\u002Fa\u002F1190000041046057\u002Fen","header":{"host":"segmentfault.com","x-https-cn":"yes","x-ddos":"yes","connection":"close","user-agent":"CCBot\u002F2.0 (https:\u002F\u002Fcommoncrawl.org\u002Ffaq\u002F)","accept":"text\u002Fhtml,application\u002Fxhtml+xml,application\u002Fxml;q=0.9,*\u002F*;q=0.8","accept-language":"en-US,en;q=0.5","accept-encoding":"br,gzip","x-https-ga":"yes","x-forwarded-for":"18.205.56.183"}},"response":{"status":404,"message":"Not Found","header":{"set-cookie":["csrfToken=wYozaUqON4eja68wRTfOTjxt; path=\u002F","PHPSESSID=faa5e3b0be987b01be9123a5d9400c4c; path=\u002F; max-age=604800; expires=Fri, 27 May 2022 18:06:00 GMT; domain=.segmentfault.com"]}},"app":{"env":"prod","name":"server","baseDir":"\u002Fusr\u002Fsrc\u002Fapp","subdomainOffset":2,"config":"\u003Cegg config\u003E","controller":"\u003Cegg controller\u003E","httpclient":"\u003Cegg httpclient\u003E","loggers":"\u003Cegg loggers\u003E","middlewares":"\u003Cegg middlewares\u003E","router":"\u003Cegg router\u003E","serviceClasses":"\u003Cegg serviceClasses\u003E"},"originalUrl":"\u002Fa\u002F1190000041046057\u002Fen","req":"\u003Coriginal node req\u003E","res":"\u003Coriginal node res\u003E","socket":"\u003Coriginal node socket\u003E"}},"letterNum":0,"noticeNum":0,"serverData":{"userAgent":"CCBot\u002F2.0 (https:\u002F\u002Fcommoncrawl.org\u002Ffaq\u002F)","Token":undefined,"X-Forwarded-For":"18.205.56.183"},"userStat":{},"newTask":{},"followedTags":[],"globalCss":"","baiduOxAppState":{"isShow":false,"copyUrl":""},"pageUsers":{},"wxShareCover":"","isBaiduOxApp":false,"showProductAuthModal":{"isShow":false,"title":""},"routeInterceptor":{"path":""},"safeCheckModal":{"isShow":false,"pageSource":""}},"video":{"videoData":{},"relationVideos":[],"videos":{"rows":[],"limit":0,"offset":0,"hasMore":true},"lives":[]},"activity":{"recommendList":[],"newestList":[],"finishedList":{},"eventType":[],"cityList":[]},"activityDetail":{"detailData":{}},"badges":{"listData":{},"detail":{},"records":{"page":1,"rows":[]},"loading":false},"blogHome":{"loading":false,"blogDetail":{},"articleData":{}},"blogs":{"channels":{},"articles":{"mode":"scrollLoad","page":1,"rows":[],"size":0,"offset":0,"hasMore":true,"error":false,"loading":false,"isStopLoad":false,"cutLoadNum":1,"isLoadedFirstRecommend":false},"currentTab":"recommendation","notices":{},"events":{},"recommendArticles":{},"hotQuestions":{},"hotTestData":{},"banners":{},"showOneLoading":false},"bookmark":{"loading":false,"detailInfo":{},"listInfo":{"page":1,"total_page":0,"rows":[]}},"deactivate":{"checkResult":{}},"dianping":{"homeInfo":{},"categroies":[],"categoryList":[],"categoryInfo":{},"loading":false,"companyInfo":{}},"dpDetail":{"dpDetail":{},"dpList":{"page":1,"total_page":10,"rows":[]},"usedsAndWishs":{"useds":0,"wisheds":0},"currentTab":"votes"},"draft":{"listData":{"rows":[],"hasMore":false,"page":1},"inviteListData":{"rows":[],"hasMore":false,"page":1},"inviteRegisterList":{"rows":[],"hasMore":false,"page":1},"loading":true},"help":{"reportRecord":{},"violationRecord":{},"appealsRecord":{},"communityGuide":{},"currentTab":"report"},"letterDetail":{"letterData":{"rows":[],"page":1,"size":100,"total_page":0,"hasMore":true},"loading":true,"readAll":false},"inbox":{"list":{"page":1,"count":0,"rows":{"inbox":{},"messages":[]},"total_page":1},"loading":false},"note":{"notes":{"rows":[],"page":1,"size":30,"hasMore":false,"sort":"modified","query":"mine","q":""},"bookmarkNotes":{"rows":[],"page":1,"size":30,"hasMore":false,"sort":"modified"},"noteDetail":{},"detail":[]},"noticeDetail":{"noticeData":{"rows":[],"offset":"","hasMore":true,"isStopScrollLoad":false,"loadedNum":1},"loading":true,"readAll":false},"personal":{"realTabName":"timeline","personalInfo":{},"listInfo":{},"blogs":[],"tags":{},"badges":{},"ranks":{},"loading":false,"financeInfo":{},"dashboardInfo":{},"dashboardHot":{"offset":1,"rows":[],"hasMore":false},"hotLoading":false},"personalSetting":{"userInfo":{},"accountInfo":{},"notifyInfo":{},"blockInfo":{"rows":[],"page":1,"total_page":1},"labInfo":{},"privacyInfo":{},"errorMsg":{"type":"","msg":""}},"portal":{"pageData":{},"noticeData":[]},"question":{"questionDetail":{},"relateDetail":{}},"questionList":{"questionList":{"page":1,"size":30,"count":0,"total_page":0,"rows":[]},"updateList":{"offset":"","rows":[]},"showLoading":false,"hostData":{},"userRank":{},"notices":{},"loading":false,"currentTab":"","isServerLoad":true},"review":{"loading":true,"articelDetail":{},"suggestEditDetail":{},"tagEditDetail":{},"questionDetail":{},"answerDetail":{},"closeDetail":{},"tagCleanDetail":{},"homeData":{"rows":[]}},"rivision":{"breadNav":[],"detail":[]},"search":{"result":{"rows":[],"page":1,"size":15,"q":"","total_page":0,"query":""}},"sites":{"questionList":{"page":1,"size":30,"count":0,"total_page":0,"rows":[]},"loading":false,"information":{},"articles":[]},"sitesSet":{"loading":false,"information":{}},"tag":{"rows":[],"loadMoreType":"scroll","offset":0,"page":1,"pageSize":30,"info":{},"loadedNum":0,"hasMore":false,"isStopLoad":false,"showLoading":true,"type":"","totalPage":0,"sort":"newest","allTagList":{}},"tagRivision":{"tagInfo":{},"detail":[]},"userTop":{"data":{}},"loading":{"global":false,"models":{"articleDetail":false},"effects":{"articleDetail\u002FgetArtDetail":false}}}; (function () { var data = window.g_initialProps["gtagData"] || window["gtagData"]; var script = document.createElement("script"); script.src = "https://www.googletagmanager.com/gtag/js?id=UA-918487-8"; script.async = true; script.onload = function () { window.dataLayer = window.dataLayer || []; window.gtag = function () { window.dataLayer.push(arguments); }; window.gtag("js", new Date()); window.gtag("config", "UA-918487-8"); data && window.gtag("set", data); }; document.getElementsByTagName("head")[0].appendChild(script); })(); ```