本文整理汇总了C++中FlannBasedMatcher::radiusMatch方法的典型用法代码示例。如果您正苦于以下问题:C++ FlannBasedMatcher::radiusMatch方法的具体用法?C++ FlannBasedMatcher::radiusMatch怎么用?C++ FlannBasedMatcher::radiusMatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlannBasedMatcher
的用法示例。
在下文中一共展示了FlannBasedMatcher::radiusMatch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: match
static void match(Mat& img1, Mat& img2, Mat& depth1, Mat& depth2) {
SurfFeatureDetector detector(400);
vector<KeyPoint> keypoint1, keypoint2;
detector.detect(img1, keypoint1);
detector.detect(img2, keypoint2);
SurfDescriptorExtractor extractor;
Mat des1, des2;
extractor.compute(img1, keypoint1, des1);
extractor.compute(img2, keypoint2, des2);
FlannBasedMatcher matcher;
vector< vector< DMatch > > matches;
matcher.radiusMatch(des1, des2, matches, 0.2);
Mat key = img1;
Mat space( 1024, 640 , CV_8UC3, CV_RGB(0, 0, 0));
vector< Point > ref1, ref2;
for(vector< vector<DMatch> >::iterator iter = matches.begin(); iter != matches.end(); iter++) {
if( iter -> size() > 0) {
DMatch match = iter->at(0);
line( key, keypoint1[match.queryIdx].pt, keypoint2[match.trainIdx].pt, CV_RGB(255,0,0), 1);
if( depth1.at<uint16_t>(keypoint1[match.queryIdx].pt) / 10 > 0 ) {
circle( space,
Point( depth1.at<uint16_t>(keypoint1[match.queryIdx].pt) / 10, keypoint1[match.queryIdx].pt.x),
5,
CV_RGB(255, 0, 0));
}
if( depth1.at<uint16_t>(keypoint1[match.queryIdx].pt) > 0 && depth2.at<uint16_t>(keypoint2[match.trainIdx].pt) > 0) {
ref1.push_back( Point( depth1.at<uint16_t>(keypoint1[match.queryIdx].pt), keypoint1[match.queryIdx].pt.x) );
ref2.push_back( Point( depth2.at<uint16_t>(keypoint2[match.trainIdx].pt), keypoint2[match.trainIdx].pt.x) );
}
}
}
imshow( "keypoint", key);
imshow( "space", space);
}