《SLAM十四讲》g2o_custombundle在windows轻松调通

环境:win10 + visual studio 2015 update3

直接将源代码拷贝工程目录下,在资源文件下新建两个文件夹(flag与tools,如图所示),如图,并将common里面.h .cpp添加进来

将上述 一个源文件 g2o_bundle.cpp 和一个头文件 g2o_bal_class.h 高级保存,选择 Unicode - 1200;

在DebugX64 和ReleaseX64 模式下添加属性表(得益于我编过了g2o库);

g2o_bal_class.h文件下,作如下修改:

【ceres已经通过VCPKG安装完毕,全局适用】

//#include "ceres/autodiff.h"
#include<ceres/internal/autodiff.h>

//#include "tools/rotation.h"
#include "common/tools/rotation.h"

在以上两种模式下,选择项目属性-配置属性-调试-命令参数;输入 :-input data/problem-16-22106-pre.txt    (记得把data文件夹也拷贝过来)

注意:Debug不是一般的慢,Release很快, 命令行参数也可以是 -help查看更多功能

至此,《SLAM十四讲》所有关于G2O的例程编译通过

原文地址:https://www.cnblogs.com/winslam/p/8987489.html