踩坑 视觉SLAM 十四讲第二版 ch9 编译及运行问题

1.编译运行

cd ch9
mkdir build
cd build
cmake ..
make

make时报错:

CMakeFiles/pose_estimation_3d3d.dir/pose_estimation_3d3d.cpp.o: In function `fmt::v8::appender fmt::v8::detail::write<char, fmt::v8::appender>(fmt::v8::appender, fmt::v8::basic_string_view<fmt::v8::type_identity<char>::type>, fmt::v8::basic_format_specs<char> const&, fmt::v8::detail::locale_ref) [clone .isra.1336]':
pose_estimation_3d3d.cpp:(.text+0x68c7): undefined reference to `fmt::v8::detail::error_handler::on_error(char const*)'

等等 有关 In function `fmt 的问题,就是说明,没有链接到fmt,我们只需要在cmakelist.txt中加入fmt 链接即可,方法如下:
在target_link_libraries 最后 加上 fmt即可

target_link_libraries(bundle_adjustment_ceres ${CERES_LIBRARIES} bal_common fmt)
target_link_libraries(bundle_adjustment_g2o ${G2O_LIBS} bal_common fmt)

2.运行bundle_adjustment_g2o.cpp

 ./bundle_adjustment_g2o ../problem-16-22106-pre.txt 

3.结果显示

 然后我们用meshlab打开生成的final.ply 和initial.ply对比

如果没有meshlab,先安装:

sudo apt-get install meshlab

然后打开meshlab

点击 “import mesh”选择对应路径下的.ply文件

 initial.ply

final.ply

扫描二维码关注公众号,回复: 15645831 查看本文章

猜你喜欢

转载自blog.csdn.net/weixin_62952541/article/details/130456331
今日推荐