opencv常见用法和opencv3->opencv4版本切换
opencv常见用法和opencv3->opencv4版本切换
- 一、opencv4的一些语法用法记录
- 1.1 cv::TermCriteria
- 1.1.1 Public Types
- 1.1.2 defaut constructor
- 1.1.3 构造2
- 二、opencv3->opencv4版本切换报错
- 2.1 identifier "CV_AA" is undefined:
- 2.2 identifier "CV_GRAY2RGB" is undefined:
- 2.3 identifier "CV_CALIB_CB_ADAPTIVE_THRESH" is undefined
- 2.4 fatal error: opencv/cv.h: No such file or directory
- 2.5 fatal error: opencv/highgui.h: No such file or directory
- 2.6 error: ‘CV_FONT_HERSHEY_SIMPLEX’ was not declared in this scope
- 2.7 error: ‘CV_WINDOW_NORMAL’ was not declared in this scope
- 2.8 error: ‘CV_INTER_LINEAR’ was not declared in this scope
- 2.9 error: ‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope
- 2.10 pcl的一大段错误
- 2.11 error: ‘CvMat’ does not name a type
- 2.11.1
- 2.11.2 CV_REDUCE_SUM(‘CV_REDUCE_SUM’ was not declared in this scope)
- 2.12 error: static assertion failed: std::map must have the same value_type as its allocator on Ubuntu 20.04
- 2.13 编译DBoW2等出现"OpenCV > 2.4.3 not found."
- 2.14 Pangolin出错(orb_slam2在ubuntu20.04上编译时)
- 2.15 fatal error: opencv/cxcore.h: No such file or directory
- 2.16 CV_LOAD_IMAGE_UNCHANGED
- 2.17 CV_MINMAX
opencv
一、opencv4的一些语法用法记录
1.1 cv::TermCriteria
The class defining termination criteria for iterative algorithms(这个类定义了迭代算法的终止准则)
1.1.1 Public Types
枚举类
enum Type {COUNT =1,MAX_ITER =COUNT,EPS =2
}
Enumerator | Meaning |
---|---|
COUNT | the maximum number of iterations or elements to compute最大迭代次数 |
MAX_ITER | ditto最大迭代次数 |
EPS | the desired accuracy or change in parameters at which the iterative algorithm stops迭代算法停止时所需的精度或参数变化 |
1.1.2 defaut constructor
cv::TermCriteria::TermCriteria()
1.1.3 构造2
cv::TermCriteria::TermCriteria(int type, int maxCount, double epsilon)
type | The type of termination criteria, one of TermCriteria::Type |
maxCount | The maximum number of iterations or elements to compute |
epsilon | The desired accuracy or change in parameters at which the iterative algorithm stops |
二、opencv3->opencv4版本切换报错
2.1 identifier “CV_AA” is undefined:
#include <opencv2/imgproc/imgproc_c.h>
2.2 identifier “CV_GRAY2RGB” is undefined:
#include <opencv2/imgproc/types_c.h>
2.3 identifier “CV_CALIB_CB_ADAPTIVE_THRESH” is undefined
CV_CALIB_CB_NORMALIZE_IMAGE
CV_CALIB_CB_FILTER_QUADS
CV_CALIB_CB_FAST_CHECK
CV_CALIB_CB_NORMALIZE_IMAGE
CV_CALIB_CB_FAST_CHECK
CV_CALIB_CB_ADAPTIVE_THRESH
CV_CALIB_CB_FILTER_QUADS
#include <opencv2/calib3d/calib3d_c.h>
2.4 fatal error: opencv/cv.h: No such file or directory
找不到opencv/cv.h文件
#include <opencv/cv.h>改为
#include <opencv2/imgproc.hpp>
2.5 fatal error: opencv/highgui.h: No such file or directory
#include <opencv2/highgui/highgui_c.h>
2.6 error: ‘CV_FONT_HERSHEY_SIMPLEX’ was not declared in this scope
CV_FONT_HERSHEY_SIMPLEX--->FONT_HERSHEY_SIMPLEX
opencv4部分取消了CV_前缀
正确作法:
#include <opencv2/imgproc/imgproc_c.h>
2.7 error: ‘CV_WINDOW_NORMAL’ was not declared in this scope
#include <opencv2/highgui/highgui_c.h>
2.8 error: ‘CV_INTER_LINEAR’ was not declared in this scope
将CV_删除转到变量定义查看某hpp,再寻找所对应的.h文件
#include<opencv2/imgproc/imgproc_c.h>
2.9 error: ‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope
#include <opencv2/imgcodecs/legacy/constants_c.h>
2.10 pcl的一大段错误
pcl报错(types等等)
选择c++14 编译标准
https://blog.csdn.net/weixin_44001261/article/details/123299374.
2.11 error: ‘CvMat’ does not name a type
2.11.1
error: ‘CvMat’ has not been declared
cvCreateMat()
添加头文件
#include <opencv2/core/types_c.h>
2.11.2 CV_REDUCE_SUM(‘CV_REDUCE_SUM’ was not declared in this scope)
#include<opencv2/core/core_c.h>
查阅
https://docs.opencv.org.
2.12 error: static assertion failed: std::map must have the same value_type as its allocator on Ubuntu 20.04
链接: https://github.com/raulmur/ORB_SLAM2/pull/585/commits/d5c04468ce85d600f8a0a23fa280b0153fe115e0.
2.13 编译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'
改成对应的版本
2.14 Pangolin出错(orb_slam2在ubuntu20.04上编译时)
https://blog.csdn.net/qq_41035283/article/details/122093494.
https://blog.csdn.net/qq_37719890/article/details/122072958.
https://blog.csdn.net/guowenkang123/article/details/120172907.
2.15 fatal error: opencv/cxcore.h: No such file or directory
#include<opencv2/core/core_c.h>
2.16 CV_LOAD_IMAGE_UNCHANGED
添加头文件
#include <opencv2/imgcodecs/legacy/constants_c.h>
或者修改为
cv::IMREAD_UNCHANGED
2.17 CV_MINMAX
添加头文件
#include<opencv2/core/core_c.h>
opencv常见用法和opencv3->opencv4版本切换相关推荐
- Opencv常见用法和常见错误(一)
原文:http://blog.csdn.net/hlx371240/article/details/47129851 一. 读取中文的路径的图像 使用OpenCV错误的读法如下: int main() ...
- ubuntu 查看opencv以及opencv4版本
方式一: 查看opencv 3以及以下版本: pkg-config --modversion opencv 查看opencv4版本: pkg-config --modversion opencv4 方 ...
- 《OpenCV》配置多个C++版本的opencv(Ubuntu18.04)
参考: 多个opencv版本配置:https://immortalqx.github.io/2021/07/06/opencv-notes-0/ 多个opencv版本配置与调用:https://blo ...
- OpenCV常见的优化方法和技巧总结
OpenCV常见的优化方法和技巧总结 [尊重原创,转载请注明出处]http://blog.csdn.net/guyuealian/article/details/78540206 目录 OpenCV常 ...
- 解决 cv_bridge 与 opencv4 版本冲突问题
解决了在 ROS melodic / noetic 下 cv_bridge 与 opencv4 版本冲突导致的 opencv 操作 导致 Segmentation fault (core dumped ...
- opencv:centos7中安装opencv4.3.0环境
准备 安装依赖 sudo yum -y install epel-release # 安装epel扩展源 sudo yum -y install git gcc gcc-c++ cmake3 sudo ...
- ubuntu16.04 python版本切换以及pip工具基本知识点总结
基本知识点: 1.ubuntu16.04自带python2.7 和python3.5,不要卸载系统自带的python2.7或3.5. 2. /usr/bin/python 和/usr/bin/pyth ...
- qt msvc 版本 移植 linux,Qt 程序异常结束 (MinGW 与 MSVC 版本切换)
引言 针对Qt的两种版本,是不是有很多的疑惑,或者说在切换时,遇到了程序异常结束,函数未定义等很多奇怪的问题?今天我们来对常见的几种问题进行分析与解决. 简介 操作系统:window7 x64 编程I ...
- 解决Windows对JDK默认版本切换问题
解决Windows对JDK默认版本切换问题 参考文章: (1)解决Windows对JDK默认版本切换问题 (2)https://www.cnblogs.com/ll409546297/p/659317 ...
最新文章
- Pinging ? with 32 bytes of data 故障解决
- CNCF 云原生系列文章
- 软件工程python就业方向-软件工程实践2019第二次作业
- java读取 500M 以上文件,java读取大文件
- python怎么放音乐_python怎么播放音乐
- 牛客网--密码验证合格程序(Java)
- Linux驱动(1)--关于驱动的概述
- 轻松生成小程序分享海报
- ubuntu10.10升级到11.4出错之问题解决
- activiti 启动tomcat乱码_使用 IntelliJ IDEA 创建 Web 工程以及启动 Tomcat 乱码问题处理...
- 三菱PlC程序大型项目QCPU+QD77MS16 宝贝包含一套完整的电气开发系统资料(包含plc程序,触摸屏程序,伺服模块设置程序,程序开发地址规划表)
- 【Mybatis源码解析】Mybatis源码体系结构
- 【python】画图保存为emf
- it职业生涯_如何通过这些有用的网站提升您的自由职业生涯
- Mac系统-重置MySQL登陆密码
- 不安全的文件上传基本原理(Unsafe file upload)
- chrome谷歌浏览器插件制作简易教程
- RxJava操作符学习APP
- 2017远景能源Java面试
- Python 协议攻击脚本(六): STP攻击