我想用 opencv 开发一个 android 应用程序。 我有这个 C++ 代码
FastFeatureDetector detector(50);
detector.detect(mGr, v);
这段代码工作正常。
现在我想使用不同的检测器:
OrbFeatureDetector detector;
detector.detect(mGr, v);
但是我得到以下错误:
The type 'cv::ORB' must implement the inherited pure virtual method 'cv::FeatureDetector::detectImpl'
是什么原因?
最佳答案
有一个基类,是FeatureDetector (链接指向最新的文档)。
FeatureDetector 有一个纯虚方法 detectImpl
。至少在您的 OpenCV 版本中。所有派生自 FeatureDetector 的类(子类)都必须实现该方法。显然,FastFeatureDetector 实现了该方法,但 OrbFeatureDetector 没有。
我在 documentation 中看到有很多 child 类: 除FastFeatureDetector , 还有 this , this , this , this , this和 this .
我还找到了cv::ORB ,但不是 OrbFeatureDetector。有一些“踪迹”here (当时是“候选”),但我想知道您使用的是哪个 opencv 版本...您是否尝试包含文件 orb.h
?
无论如何,我建议,如果您还没有,请将您的 opencv 版本更新到最新版本,并使用 cv::ORB
,如下所述:https://stackoverflow.com/a/12202175/2436175
关于安卓opencv。特征检测器。实现检测,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17478424/