在 OpenCV 中计算特征匹配 (BFMatcher) 中的相似性度量
我正在比较图像,并且使用 BFMatcher
来执行特征匹配
我的实际代码是:
def get_similarity_from_desc(approach, query_desc, corp_desc):
if approach == 'sift':
# BFMatcher with euclidean distance
bf = cv.BFMatcher()
else:
# BFMatcher with hamming distance
bf = cv.BFMatcher(cv.NORM_HAMMING)
matches = bf.knnMatch(query_desc,corp_desc,k=2)
# Apply ratio test
good = []
for m,n in matches:
if m.distance < 0.75*n.distance:
good.append([m])
similarity = ??
return similarity
我想知道是否可以在给定良好匹配列表的情况下计算相似性度量 good
以及两个图像的描述符 query_desc
和 corp_desc
此时我想到:
similarity = len(good) / len(matches)
但是我认为这不是一个正确的判断方式两幅图像之间的相似度
你知道一个更好吗计算该度量的方法?
I am comparing images and I have used BFMatcher
to perform feature matching
My actual code is:
def get_similarity_from_desc(approach, query_desc, corp_desc):
if approach == 'sift':
# BFMatcher with euclidean distance
bf = cv.BFMatcher()
else:
# BFMatcher with hamming distance
bf = cv.BFMatcher(cv.NORM_HAMMING)
matches = bf.knnMatch(query_desc,corp_desc,k=2)
# Apply ratio test
good = []
for m,n in matches:
if m.distance < 0.75*n.distance:
good.append([m])
similarity = ??
return similarity
I am wondering if it is possible to compute a similarity measure given the list of good matches good
and the descriptors of the two images query_desc
and corp_desc
At this moment I have thought:
similarity = len(good) / len(matches)
But I think this is not a correct way of determining similarity between two images
Do you know a better approach for computing this measure?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我终于做到了这一点,似乎效果很好:
来源:https://linuxtut.com/en/c9497ffb5240622ede01 /
I have finally done this, which seems to work well:
Source: https://linuxtut.com/en/c9497ffb5240622ede01/