猿问

查找两个定向梯度特征直方图之间的距离

我有两个 4000 维 HOG 特征,由cv2.HOGDescriptor. 我需要找到这两个向量之间的距离。


def getDistances(firstFace,secondFace):

EuclideanDistance = distance.euclidean(firstFace,secondFace)

print("Euclidean distance from x to y: ", EuclideanDistance)

我尝试过类似的事情,但结果对我来说似乎是错误的。如果需要解释的话,我有 3 张图片。A和B几乎相同。C则完全不同。


Euclidean distance from x to y:  232.5758819580078 # A and C

Euclidean distance from x to y:  238.22845458984375 # B and C

Euclidean distance from x to y:  249.4779052734375 # A and B

A 和 B 的距离应小于该距离。


噜噜哒
浏览 135回答 1
1回答

慕妹3146593

尝试这个。from scipy.spatial import distancea = (1, 2, 3)b = (4, 5, 6)dst = distance.euclidean(a, b)
随时随地看视频慕课网APP

相关分类

Python
我要回答