我正在做一个项目,我在图像中有一个特征,描述为一组 X 和 Y 坐标(每个特征 5-10 点),这是该特征独有的。我还有一个包含数千个特征的数据库,每个特征都有相同类型的描述符。结果如下所示:
myFeature: (x1,y1), (x2,y2), (x3,y3)...
myDatabase: Feature1: (x1,y1), (x2,y2), (x3,y3)...
Feature2: (x1,y1), (x2,y2), (x3,y3)...
Feature3: (x1,y1), (x2,y2), (x3,y3)...
...
我想在 myDatabase 的特征中找到 myFeature 的最佳匹配。
匹配这些功能的最快方法是什么?目前我正在逐步检查数据库中的每个功能并比较每个单独的点:
bestScore = 0
for each feature in myDatabase:
score = 0
for each point descriptor in MyFeature:
find minimum distance from the current point to the...
points describing the current feature in the database
if the distance < threshold:
there is a match to the current point in the target feature
score += 1
if score > bestScore:
save feature as new best match
这种搜索有效,但显然它在大型数据库上变得非常缓慢。有谁知道进行此类搜索的更快方法,或者至少是否有一种方法可以快速排除明显与描述符不匹配的特征?