我的项目是基于android的草药识别。我使用 ORB 来获取关键点、特征并匹配特征。
我想使用这个算法:
- 我使用 4 个参考图像,并将它们的特征 image1 与 image1、1-2、1-3、1-4、2-3、3,4 进行匹配。
- 然后我将到数据库的最小和最大距离存储为阈值。 (最低阈值 = 总最小值/6)
- 当我识别新图像时,我将新的最小和最大距离与数据库中的进行比较。但我不知道该怎么做。
{
for (j=MinID; j<=MaxID; j++){
MatOfDMatch matches = DetectUtility.match(features, matFromJson(DB.GetORBFitur(j)));
List<DMatch> matchesList = matches.toList();
Double max_dist = 0.0;
Double min_dist = 100.0;
for (int i = 0; i < matchesList.size(); i++){
Double dist = (double) matchesList.get(i).distance;
if (dist < min_dist && dist != 0){
min_dist = dist;
}
if (dist > max_dist){
max_dist = dist;
}
}
From 这个网站,我得到这个代码:
//-- Draw only "good" matches (i.e. whose distance is less than 3*min_dist )
std::vector< DMatch > good_matches;
for( int i = 0; i < descriptors_object.rows; i++ )
{ if( matches[i].distance < 3*min_dist )
{ good_matches.push_back( matches[i]); }
}
如何获得那个神奇的数字3?
我必须做什么才能达到最大距离?
我想要使用的算法,我之前使用过使用不变矩和城市街区距离来匹配具有最小距离的图像。
I don`t know either. Distance is measure of the feature point similarity, less is better. The original ORB paper (fig. 5, below) shows distribution of the distances for good and bad matches. One can surely says that "good" distance threshold would be around 64.
所以更正确的是:
double dist_th = 64;
for( int i = 0; i < descriptors_object.rows; i++ )
{ if( matches[i].distance < dist_th )
{ good_matches.push_back( matches[i]); }
}
然后你仍然需要使用RANSAC来过滤不一致的匹配。因此,最简单的解决方案是将您的查询图像与所有 4 个数据库图像进行匹配。
但我建议您使用一些分类器,而不仅仅是匹配。看到这个家伙的方法(它有效,我认识他)-http://cmp.felk.cvut.cz/~sulcmila/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)