OpenCV similarity between two images using Euclidean distance

asked 2015-08-19 03:32:31 -0500

ndk076 gravatar image

Can we use the Euclidean distance to determine the similarity between two images

  • Detect Keypoint image1, image2 using SUFT
  • Compute Descriptor image1, image2 using SUFT
  • double dif = norm(des1,des2,L2_norm)----> if dif is small -> can we tell that two images similar?

If yes, so what is the threshold to lead to these two images are similar.

And another question is when I compute descriptor for those images. I see that the size of them is not equal. Ex: des1 is 64x96, des2 is 64x85 So the norm function throw an exception.

So is there any way for us to normalize the descriptor to fixed size in order to using Euclidean distance or not?

And I use OpenCV Java API to do these above stuffs currently.

edit retag flag offensive close merge delete

Comments

1

i'm afraid, your idea is not feasible at all.

well you could compare single descriptors(rows), but that does not make any sense, since the single descriptors are in arbitrary order.

you will have to use a BF or Flann Matcher to get matches, those will contain the id's of the keypoints, and the euclid.distance between the respective descriptors at those points. from those, you can derive some heuristic measure, like the average distance beween descriptors, or such.

berak gravatar imageberak ( 2015-08-19 06:21:01 -0500 )edit

Thanks for your answer berak! Could you please tell more details about "derive some heuristic measure, like the average distance beween descriptors, or such". I really need to know how to do it because what I end up to have is an meaningful number to represent distance between two descriptors.

ndk076 gravatar imagendk076 ( 2015-08-19 06:46:16 -0500 )edit
1

sum up the distances, and divide by count, i guess, would be the most primitive measure

berak gravatar imageberak ( 2015-08-19 06:54:13 -0500 )edit

Thanks you again! I will try it.

ndk076 gravatar imagendk076 ( 2015-08-19 06:59:30 -0500 )edit