opencv常见用法和opencv3->opencv4版本切换

1.1 cv::TermCriteria

The class defining termination criteria for iterative algorithms(这个类定义了迭代算法的终止准则)

枚举类

enum Type {
        COUNT =1,
        MAX_ITER =COUNT,
        EPS =2
}

EnumeratorMeaningCOUNTthe maximum number of iterations or elements to compute最大迭代次数MAX_ITERditto最大迭代次数EPSthe desired accuracy or change in parameters at which the iterative algorithm stops迭代算法停止时所需的精度或参数变化

cv::TermCriteria::TermCriteria()
cv::TermCriteria::TermCriteria(int type, int maxCount, double epsilon)

typeThe type of termination criteria, one of TermCriteria::TypemaxCountThe maximum number of iterations or elements to computeepsilonThe desired accuracy or change in parameters at which the iterative algorithm stops

2.1 identifier “CV_AA” is undefined:

#include

2.2 identifier “CV_GRAY2RGB” is undefined:

#include

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

2.4 fatal error: opencv/cv.h: No such file or directory

找不到opencv/cv.h文件

include

#include

2.5 fatal error: opencv/highgui.h: No such file or directory

#include

2.6 error: ‘CV_FONT_HERSHEY_SIMPLEX’ was not declared in this scope

CV_FONT_HERSHEY_SIMPLEX--->FONT_HERSHEY_SIMPLEX

opencv4部分取消了CV_前缀
正确作法:

#include

2.7 error: ‘CV_WINDOW_NORMAL’ was not declared in this scope

#include

2.8 error: ‘CV_INTER_LINEAR’ was not declared in this scope

将CV_删除转到变量定义查看某hpp,再寻找所对应的.h文件

#include

2.9 error: ‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope

#include

2.10 pcl的一大段错误

2.11 error: ‘CvMat’ does not name a type

error: ‘CvMat’ has not been declared
cvCreateMat()

添加头文件

#include
#include

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.”

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上编译时)

2.15 fatal error: opencv/cxcore.h: No such file or directory

#include

2.16 CV_LOAD_IMAGE_UNCHANGED

添加头文件

#include
或者修改为
cv::IMREAD_UNCHANGED

2.17 CV_MINMAX

添加头文件

#include

Original: https://blog.csdn.net/weixin_43848456/article/details/123380782
Author: xlsemmmmmm
Title: opencv常见用法和opencv3->opencv4版本切换

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/518297/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球