error: ‘CV_INTER_LINEAR’ was not declared in this scope
OpenCV4部分取消了CV_前缀
解决方法很简单,就是找到报错的文件,报错的变量修改适配 OpenCV4 中的变量。
CV_INTER_LINEAR 修改为 cv::INTER_LINEAR
或者,添加头文件
#include<opencv2/imgproc/imgproc_c.h>
error: ‘CV_RANSAC’ was not declared in this scope
CV_RANSAC 修改为 cv::RANSAC
error: ‘CV_WINDOW_AUTOSIZE’ was not declared in this scope
CV_WINDOW_AUTOSIZE 修改为 cv::WINDOW_AUTOSIZE
或者,添加头文件
#include <opencv2/highgui/highgui_c.h>
error: ‘CV_GRAY2RGB’ was not declared in this scope
#include <opencv2/imgproc/types_c.h>
报错 fatal error: opencv/cv.h: No such file or directory
将报错文件包含的头文件进行修改:
#include <opencv/cv.h>
修改为:
#include <opencv2/imgproc/types_c.h>
fatal error: opencv/highgui.h: No such file or directory
报错文件包含的头文件进行修改:
#include <opencv/highgui.h>
修改为:
#include <opencv2/highgui/highgui_c.h>
error: ‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope
将报错文件包含的头文件进行修改:
CV_LOAD_IMAGE_GRAYSCALE
修改为:
cv::IMREAD_GRAYSCALE
error: ‘CV_LOAD_IMAGE_COLOR’ was not declared in this scope文章来源:https://www.toymoban.com/news/detail-663695.html
CV_LOAD_IMAGE_COLOR
修改为:文章来源地址https://www.toymoban.com/news/detail-663695.html
cv::IMREAD_COLOR
到了这里,关于OpenCV3程序转到OpenCV4编译的问题的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!