我试图使用Flann匹配器来匹配图像之间的特征。以下是几行代码:
vector<MatchesInfo> matches;
Ptr<FlannBasedMatcher> matcher(new flann::LshIndexParams(20, 10, 2));
matcher.knnMatch(afeatures.descriptors, bfeatures.descriptors, matches, 2);这会产生以下错误:
类"cv::Ptr“没有成员"knnMatch”
我做错了什么?
发布于 2018-05-22 18:35:10
试试这个:
vector<vector< DMatch >> knnMatches;
FlannBasedMatcher matcher;
matcher.knnMatch(desc1, desc2, knnMatches, 50);如果使用KNN,也会使用Lowe的比率来确定匹配之间的距离是否合适。还要确保描述符是CV_32F类型的。
发布于 2019-12-04 15:14:23
如果使用cv::Ptr,则需要使用箭头指针:->
但是您使用了点指针:.
将代码更改为:
matcher->knnMatch(afeatures.descriptors, bfeatures.descriptors, matches, 2);https://stackoverflow.com/questions/50409352
复制相似问题