2

我有两个 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的距离应该小于那个。

4

1 回答 1

2

Try this.

from scipy.spatial import distance
a = (1, 2, 3)
b = (4, 5, 6)
dst = distance.euclidean(a, b)
于 2021-03-02T13:45:30.423 回答