如何显示相应的关键点?

时间:2015-01-17 16:45:25

标签: c++ opencv image-processing

我想在控制台中显示KeyPoints的相应大小和角度。我知道如何检测它,但我不知道什么是正确的索引显示。我想获得像keypoints1.size和keypoints1.angle的结果类似于keypoints2.size和keypoints2.angle。下面我开始了程序:

SurfFeatureDetector detector(400);
vector<KeyPoint> keypoints1, keypoints2;
detector.detect(img1,keypoints1);
detector.detect(img2,keypoints2);

SurfDescriptorExtractor extractor;
Mat descriptors1, descriptors2;
extractor.compute(img1,keypoints1,descriptors1);
extractor.compute(img2,keypoints2,descriptors2);

BruteForceMatcher<L2<float> > matcher;
vector<DMatch> matches;
matcher.match(descriptors1, descriptors2, matches);

1 个答案:

答案 0 :(得分:0)

你可以这样做:

for(auto& m : matches) {
  cout << "Keypoints 1 angle: " << keypoints1[m.queryIdx].angle << endl;
  cout << "Keypoints 2 angle: " << keypoints2[m.trainIdx].angle << endl;
}

更改.angle属性以显示您需要的内容