ubuntu20.04 ros noetic cv4 编译sg-slam问题汇总

ajin128 / 2024-10-15 / 原文

1.CV_RGB2GRAY
2.CV_MINMAX
3.CV_RGB2GRAY
4.CV_FILLED

引入头文件

include<opencv2/imgproc/types_c.h>

include<opencv2/opencv.hpp>

include <opencv2/highgui/highgui_c.h>

include <opencv2/imgproc/imgproc_c.h>

或者1和3将CV_改为cv::COLOR_

5.fatal error: opencv/cv.h: 没有那个文件或目录

include <opencv/cv.h>

换成

include<opencv2/imgproc/imgproc_c.h>

include <opencv2/highgui/highgui_c.h>

6.sim3报错

error: static assertion failed: std::map must have the same value_type as its allocator
static_assert(is_same<typename _Alloc::value_type, value_type>::value,

把LoopClosing.h第49行的
typedef map<KeyFrame,g2o::Sim3,std::less<KeyFrame>,
Eigen::aligned_allocator<std::pair<const KeyFrame, g2o::Sim3> > > KeyFrameAndPose;
改成下面
typedef map<KeyFrame
,g2o::Sim3,std::less<KeyFrame>,
Eigen::aligned_allocator<std::pair<KeyFrame
const, g2o::Sim3> > > KeyFrameAndPose;

7.error:usleep

System.h,添加头文件#include<unistd.h>

8.‘CvMat’ has not been declared

报错对应文件添加头文件#include <opencv2/core/types_c.h>

9.‘CV_REDUCE_SUM’ was not declared in this scope

报错对应文件添加头文件#include<opencv2/core/core_c.h>

10.CV_LOAD_IMAGE_UNCHANGED’ was not declared in this scope

修改为cv::IMREAD_UNCHANGED

11.No rule to make target '/home/ajin/slam_study/SG-SLAM/src/sg-slam/Thirdparty/DBoW2/lib/libDBoW2.so', needed by '/home/ajin/slam_study/SG-SLAM/src/sg-slam/lib/libsg-slam.so'. Stop.

cd path/SG-SLAM/src/sg-slam/Thirdparty/DBoW2

mkdir lib

把libDBoW2.so复制到lib,libDBoW2.so位置自行locate