【发布时间】:2014-06-20 08:02:30
【问题描述】:
我正在尝试使用 ORB 检测关键点,一切都很好,直到我切换到 Opencv 2.4.9。
首先,关键点的数量似乎减少了,并且对于某些图像,没有检测到关键点:
这是我用两个版本编译的代码:(2.3.1 和 2.4.9)
#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/features2d/features2d.hpp>
using namespace cv;
int main(int argc, char **argv){
Mat img = imread(argv[1]);
std::vector<KeyPoint> kp;
OrbFeatureDetector detector;
detector.detect(img, kp);
std::cout << "Found " << kp.size() << " Keypoints " << std::endl;
Mat out;
drawKeypoints(img, kp, out, Scalar::all(255));
imshow("Kpts", out);
waitKey(0);
return 0;
}
结果: 2.3.1: 找到 152 个关键点
2.4.9: 找到 0 个关键点
我还使用不同的 ORB 构造函数进行了测试,但我得到了相同的结果,没有 KPts。 与 2.3.1 默认构造函数中相同的构造函数值: 2.4.9 自定义构造:
#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/features2d/features2d.hpp>
using namespace cv;
int main(int argc, char **argv){
Mat img = imread(argv[1]);
std::vector<KeyPoint> kp;
// default in 2.4.9 is : ORB(700, 1.2f, 3, 31, 0);
OrbFeatureDetector detector(500, 1.2f, 8, 31, 0); // default values of 2.3.1
detector.detect(img, kp);
std::cout << "Found " << kp.size() << " Keypoints " << std::endl;
Mat out;
drawKeypoints(img, kp, out, Scalar::all(255));
imshow("Kpts", out);
waitKey(0);
return 0;
}
你知道发生了什么吗?我该如何解决?
谢谢。
【问题讨论】:
-
你有解决办法吗?
-
在其他图像上你也发现了 0 个关键点?还是与 openCV 2.3.1 相比,关键点更少?
标签: c++ opencv feature-detection orb