【发布时间】:2014-05-16 10:45:38
【问题描述】:
我的项目是基于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;
}
}
从this site,我得到这个代码:
//-- 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? 以及我必须做什么才能达到最大距离?
我要使用的算法,我之前用过不变量矩和城市街区距离来匹配最小距离的图像。
【问题讨论】:
标签: android opencv matching threshold orb