1、暴力匹配与FLANN的匹配时间比较
当ORB特征点为1000时,FLANN慢于暴力匹配,当ORB特征点>=1500时,FLANN时间少于暴力匹配。
特征点数目1000:(以下第一是FLANN,第二个是暴力)
特征点数目1300:
特征点数目1500:
特征点数目2000:
特征点数目3000:
2、cv::BFMatcher是cv的类名。
Brute-force matcher constructor.
cv::BFMatcher::BFMatcher ( int normType = NORM_L2,
bool crossCheck = false
)
Parameters
normType:One of NORM_L1, NORM_L2, NORM_HAMMING, NORM_HAMMING2. L1 and L2 norms are preferable choices for SIFT and SURF descriptors, NORM_HAMMING should be used with ORB, BRISK and BRIEF, NORM_HAMMING2 should be used with ORB when WTA_K3 or 4 (see ORB::ORB constructor description).
crossCheck :If it is false, this is will be default BFMatcher behaviour when it finds the k nearest neighbors for each query descriptor. If crossChecktrue, then the knnMatch() method with k=1 will only return pairs (i,j) such that for i-th query descriptor the j-th descriptor in the matcher’s collection is the nearest and vice versa, i.e. the BFMatcher will only return consistent pairs. Such technique usually produces best results with minimal number of outliers when there are enough matches. This is alternative to the ratio test, used by D. Lowe in SIFT paper.
来自:https://docs.opencv.org/3.1.0/d3/da1/classcv_1_1BFMatcher.html#abe0bb11749b30d97f60d6ade665617bd
3、radiusMatch()
Mat descriptors1, descriptors2;
vector< vector< DMatch > > matches_radius;//不是vector< DMatch >
//省略计算特征点及描述子过程
BFMatcher matcher_bf(NORM_HAMMING, false);
matcher_bf.radiusMatch(descriptors1, descriptors2, matches_radius,100);
matches_radius的每一个 vector< DMatch >是某一个特征点的所有满足距离小于100的匹配点,匹配点按距离由小到大排列。
for(int j=0;j<matches_radius.size();j++){
if(matches_radius[j].size()!=0){
for(int i=0;i<matches_radius[j].size();i++){
cout<<matches_radius[j][i].distance<<",";
}
}
cout<<endl;cout<<endl;
}
输出: