pythonimage-processingimage-preprocessinghistogram-of-oriented-gradients

Finding distance between two Histogram of Oriented Gradients Features


I have two 4000 dimension HOG features, created by cv2.HOGDescriptor. I need to find distance between, this two vectors.

def getDistances(firstFace,secondFace):
EuclideanDistance = distance.euclidean(firstFace,secondFace)
print("Euclidean distance from x to y: ", EuclideanDistance)

I tried something like this but results seemed wrong to me. If I need to explain, I have 3 image. A and B almost identical. C is completely different.

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

Distance of A and B should be smaller than that.


Solution

  • Try this.

    from scipy.spatial import distance
    a = (1, 2, 3)
    b = (4, 5, 6)
    dst = distance.euclidean(a, b)