Opencv && C++ 报错记录以解决方案
常见报错
- 按以下方法win10配置vscode opencv c++ 环境报错:
https://blog.csdn.net/qq_45022687/article/details/120949170
报错:E:\c++_workspace\project02\cpp\test02.cpp:5:10: fatal error: opencv2/opencv.hpp: No such file or directory
解决:按F5 或者ctrl+F5试试;
特征点提取和匹配报错
报错:cannot declare variable ‘fast’ to be of abstract type 'cv::FastFeatureDetect
解决:不允许使用抽象类类型“cv::FastFeatureDetector”的对象 的解决办法
报的问题: cannot declare variable 'fast' to be of abstract type 'cv::FastFeatureDetect
为什么会报错?
角点检测的几个方法(SURF,SIFT,ORB)都被转移opencv_contrib中了。所以版本之间有差异。
这是转移前的写法:
cv::FastFeatureDetector fast(15);
fast.detect(img, keypoints);
这种是转移后的写法:
Ptr<FeatureDetector> fast = FastFeatureDetector::create(40);
fast->detect(img, keypoints);