2015-06-15 31 views
0

我只有一个小问题,正确的资源。 我正在使用opencv 2.4.8,我无法找到合适的资源knnMatch()。我试过以下哪些方法不起作用:OpenCV - 方法'knnMatch'无法解析

#include "opencv2/core/core.hpp" 
#include <opencv2/nonfree/features2d.hpp> 
#include "opencv2/nonfree/nonfree.hpp" 
#include <opencv2/ml/ml.hpp> 
//#include "opencv2/features2d/features2d.hpp" 
//#include <opencv2/legacy/legacy.hpp> 

有人可以说我正确的资源吗?谷歌也没有帮助我。

试图找到两个描述的3场比赛最接近与关键点:

Ptr<DescriptorMatcher> matcher; 
matcher.knnMatch(descriptorsLeft, descriptorsRight,3); 
+0

你能说明错误发生在哪里吗? – Elried

+0

@Elried:我试图找到两个关键点描述符的3个最近匹配:Ptr 匹配器; \t matcher.knnMatch(descriptorsLeft,descriptorsRight,3); – attenbe

回答

0

您使用的是Ptr<DescriptorMatcher>所以你应该取消对它的引用,以调用方法...

matcher.knnMatch(descriptorsLeft, descriptorsRight,3); //error 
matcher->knnMatch(descriptorsLeft, descriptorsRight,3); // should be better