我试图使用检测器ORB获取图像中的关键点,但总是得到异常和崩溃,我的代码是下一个。
vector < KeyPoint > kp;
int nfeatures = 500;
float scaleFactor = 1.2f;
int nlevels = 8;
int edgeThreshold = 15;
int firstLevel = 0;
int WTA_K = 2;
int scoreType = ORB::HARRIS_SCORE;
int patchSize = 31;
int fastThreshold = 20;
Ptr < ORB > detector = ORB::create(
nfeatures,
scaleFactor,
nlevels,
edgeThreshold,
firstLevel,
WTA_K,
scoreType,
patchSize,
fastThreshold );
detector->detect(img, kp);
cout << "Found " << kp.size() << " Keypoints " << std::endl;
Mat out;
drawKeypoints(img, kp, out, Scalar::all(255));
imshow("Kpts", out);img是很早就声明的,问题是什么时候做detect->detect(img,kp);我不知道问题是什么,我尝试了其他形式的do it,但在调用detect()时都崩溃了。
我尝试使用BRISK,这个问题在检测崩溃的调用中也是一样的。我轻快地为simplify做了下一个:
Ptr < BRISK > detector = BRISK::create();
vector <KeyPoint> kp;
detector->detect(img,kp);这正变得令人恼火。
我使用的是windows 10的visual studio 2015中的opencv 3。
很抱歉我的英语,谢谢你的回答。
发布于 2020-05-10 17:36:35
此错误在今天的CV2版本4.2.0 actual中仍然存在。我同样尝试过用cv2.ORB()进行初始化,收到了~00x5 error,尝试了ORB_create(),最终成功了!
发布于 2015-11-12 10:08:52
好的,我用cmake和opencv_contrib解决了为visual studio构建opencv的问题,如果有人有同样的问题,我会按照下面的链接的说明进行操作:
http://audhootchavancv.blogspot.in/2015/08/how-to-install-opencv-30-and.html
https://stackoverflow.com/questions/33650585
复制相似问题