打开终端,依次输入命令,安装相关依赖和工具
sudo apt update
sudo apt upgrade
sudo apt install libglew-dev cmake libboost-dev libboost-thread-dev libboost-filesystem-dev libeigen3-dev -y
参照https://blog.csdn.net/qq_41694024/article/details/125942875安装cmake
参照https://blog.csdn.net/KRISNAT/article/details/122071364安装pangolin,(直接安装v0.5比较好,参考下面的问题6)
执行下面的命令
cd Pano-SLAM
chmod +x build.sh
./build.sh
CMake Error at CMakeLists.txt:35 (message): OpenCV > 2.4.3 not found.
解决办法:
\Pano_SLAM\CMakeLists.txt
和 Pano_SLAM\Thirdparty\DBoW2\CMakeLists.txt第31行,find_package(OpenCV 3.0 QUIET)
,更改为自己的OpenCV版本号,若不知道版本号,可利用下面的命令进行查询。
pkg-config opencv --modversion
Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
使用
sudo apt-get install python3-dev
之后,该错误消失。
Pano_SLAM/include/ORBextractor.h:12:10: fatal error: opencv/cv.h: No
such file or directory
在opencv4中opencv2的cv.h融合进了imgproc.hpp里,所以把源码中的#include <opencv/cv.h>
改成#include <opencv2/imgproc.hpp>
即可。
参考https://blog.csdn.net/Lkilvin/article/details/123054182
‘decay_t’ is not a member of ‘std’
将CmakeLists.txt中
set(CMAKE_CXX_FLAGS "-std=c++11")
改为
set(CMAKE_CXX_STANDARD 14)
fatal error: numpy/arrayobject.h: No such file or directory
根据Python版本号,执行下列命令
python -c "import numpy; print(numpy.get_include())"
或
python3 -c "import numpy; print(numpy.get_include())"
找不到的话,需要安装 NumPy。
Python3安装numpy的命令如下
sudo apt-get install python3-numpy
/usr/bin/ld: cannot find -lEigen3::Eigen: No such file or directory
collect2: error: ld returned 1 exit status make[2]: ***
[CMakeFiles/Pano_SLAM.dir/build.make:439: …/lib/libPano_SLAM.so]
Error 1 make[1]: *** [CMakeFiles/Makefile2:85:
CMakeFiles/Pano_SLAM.dir/all] Error 2 make: *** [Makefile:91: all]
Error 2
(通过改变Pangolin的版本解决,降低为V0.5)
不同版本Pangolin的下载地址https://github.com/stevenlovegrove/Pangolin/issues/769
编译v0.5过程中可能会出现错误,参考https://blog.csdn.net/weixin_54347747/article/details/126659089解决。
Pano_SLAM/Examples/FishEye/LB_FishEye.cc:60:53: error: ‘CV_LOAD_IMAGE_UNCHANGED’ was not declared in this scope 60 | cv::Mat tImg=cv::imread(vstrImageFishEye[0][0],CV_LOAD_IMAGE_UNCHANGED);
继续使用 CV_LOAD_IMAGE_UNCHANGED的话,but add this header file:
#include "opencv2/imgcodecs/legacy/constants_c.h"
Pano_SLAM/Examples/FishEye/LB_FishEye.cc:308:25: error: ‘CV_RGB2GRAY’ was not declared in this scope 308 | cvtColor(src, gray, CV_RGB2GRAY); // 转换为灰度图
参考https://www.cnblogs.com/lonelypinky/p/11586388.html
文件头添加
#include <opencv2/imgproc/types_c.h>
从原作者团队官网http://gpcv.whu.edu.cn/data/panslam.html下载Kashiwa dataset,解压。
运行程序时,出现闪退问题。
参照https://blog.csdn.net/baidu_38431960/article/details/126669067解决该问题。
g2o和工程的CMakeLists.txt文件中,将其中的march=native注释掉,然后全部重新编译。
原语句为
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -march=native ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -march=native")
将其中的 -march=native
注释掉,更改为
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 ")