2026/1/21 10:41:24
网站建设
项目流程
龙岗做网站的,苏州淘宝网站建设,ui模板免费下载,深圳网络公司推广https://github.com/shichaoy/cube_slam
这个代码版本太老#xff0c;依赖库版本也太老#xff0c;我的系统是ubuntu20.04#xff0c;opencv4.5#xff0c;编译会报很多错
其他库我是在以前运行orbslam2的时候都装好的#xff0c;可以参照我以前的文章。
一、复现步骤 …https://github.com/shichaoy/cube_slam这个代码版本太老依赖库版本也太老我的系统是ubuntu20.04opencv4.5编译会报很多错其他库我是在以前运行orbslam2的时候都装好的可以参照我以前的文章。一、复现步骤https://zhuanlan.zhihu.com/p/544128936参照这个基本就可以了1. mkdir -p ~/cubeslam_ws/src 2. cd ~/cubeslam_ws/src 把下载好的cube_slam放到src 3. cd cube_slam sh install_dependenices.sh 4. cd ~/cubeslam_ws 返回根目录 编译 catkin_make -j4 -DPYTHON_EXECUTABLE/usr/bin/python3然后你就会遇到很多报错没事一个个来解决二、报错解决1. 报错1cubeslam_ws/src/cube_slam/line_lbd/libs/lsd.cpp:1168:32: error: ‘CV_BGR2GRAY’ was not declared in this scope; did you mean ‘COLOR_BGR2GRAY’? 1168 | cvtColor(_image, gray, CV_BGR2GRAY); | ^~~~~~~~~~~ | COLOR_BGR2GRAY解决CV_GRAY2BGR→cv::COLOR_GRAY2BGR2.报错2fatal error: opencv/cv.h: No such file or directory解决将头文件替换为#include opencv2/opencv.hpp3. 报错3error: ‘std::vector’ has not been declared note: ‘std::vector’ is defined in header vector; did you forget to #include vector?解决#把下面两行加在 matrix_utils.h 最上面 #include vector #include string 并且在 matrix_utils.cpp 顶部加上 #include vector4. 报错4error: ‘iota’ is not a member of ‘std’解决把下面头文件加到出现 iota 的 .cpp 顶部 #include numeric算了一个个看报错太慢了。。我导出来错误有一万多行虽然有很多事重复的。其实这些报错都是因为opencv版本或者其他依赖库的版本不对导致的这个代码太老了我的系统比较新很多不适配找到一个博主修改的感谢大佬https://github.com/NeSC-IV/cube_slam-on-ubuntu20/blob/master/%E7%BC%96%E8%AF%91%E6%8C%87%E5%8D%97CubeSLAM%20Monocular%203D%20Object%20SLAM.md先照着他这个一个个改完应该没啥问题。后续我会考虑把改完的代码上传到github纪念一下编译成功三、运行今天下雪先休息明天再更。