1.opencv/cv.h: 没有那个文件或目录

将opencv/cv.h:修改为

#include <opencv2/opencv.hpp>

2.‘CvMat’ has not been declared

添加头文件

#include <opencv2/core/types_c.h>

3.‘CV_REDUCE_SUM’ was not declared in this scope

添加头文件

#include<opencv2/core/core_c.h>

4.‘cvCreateMat’ was not declared in this scope;

等以下的报错
在这里插入图片描述
添加头文件

#include <opencv2/imgproc/types_c.h>

#include <opencv2/imgproc.hpp>

5. 编译DBoW2等出现"OpenCV > 2.4.3 not found."

make[2]: *** No rule to make target '../Thirdparty/DBoW2/lib/libDBoW2.so', needed by '../lib/libORB_SLAM2.so'

将CMakeLists.txt的opencv改称对应版本
6.‘CV_LOAD_IMAGE_UNCHANGED’ was not declared in this scope

修改为

cv::IMREAD_UNCHANGED

7. ‘CV_GRAY2BGR’ was not declared in this scope

修改方法为:将CV_BGR2GRAY改为cv::COLOR_BGR2GRAY
或者加入头文件

#include <opencv2/imgproc/types_c.h>

8. error: ‘CV_CALIB_CB_ADAPTIVE_THRESH’ was not declared in this scope

#include <opencv2/calib3d/calib3d_c.h>

9.‘CV_AA’ was not declared in this scope

#include <opencv2/imgproc/imgproc_c.h>

10.‘CV_FONT_HERSHEY_SIMPLEX’ was not declared in this scope

修改方法:将CV_FONT_HERSHEY_SIMPLEX改为cv::FONT_HERSHEY_SIMPLEX
11. error: ‘CV_REDUCE_SUM’ was not declared in this scope

#include<opencv2/core/core_c.h>

12.error: static assertion failed: std::map must have the same value_type as its allocator

在loopClosing.h:50修改

typedef map<KeyFrame*,                  //键
                g2o::Sim3,                  //值
                std::less<KeyFrame*>,       //排序算法
                Eigen::aligned_allocator<std::pair<const KeyFrame*, g2o::Sim3> > // 指定分配器,和内存空间开辟有关. 为了能够使用Eigen库中的SSE和AVX指令集加速,需要将传统STL容器中的数据进行对齐处理
                > KeyFrameAndPose;

typedef map<KeyFrame*,                  //键
                g2o::Sim3,                  //值
                std::less<KeyFrame*>,       //排序算法
                Eigen::aligned_allocator<std::pair<KeyFrame* const , g2o::Sim3> > // 指定分配器,和内存空间开辟有关. 为了能够使用Eigen库中的SSE和AVX指令集加速,需要将传统STL容器中的数据进行对齐处理
                > KeyFrameAndPose;

Logo

音视频技术社区,一个全球开发者共同探讨、分享、学习音视频技术的平台,加入我们,与全球开发者一起创造更加优秀的音视频产品!

更多推荐