21

I have been trying to find a way to generate similarity score ( in %) after comparing two images using SIFT in python (2.7.x) opencv (2.4.9). I was only able to find examples that draw lines between matches. How do I proceed with this.

4
  • to be exact i'm looking for python implementation of VL_UBCMATCH function
    – user93
    May 12, 2016 at 6:08
  • Did you find it ?
    – edyvedy13
    Jun 26, 2017 at 15:22
  • 1
    No I couldn't find it. An example code would be really helpful
    – user93
    Jun 26, 2017 at 16:18
  • 1
    Does stackoverflow.com/a/51728654/1021819 help?
    – jtlz2
    Sep 19, 2019 at 11:51

1 Answer 1

6

There is an opencv equivalent of vl_ubcmatch function in Matlab.

Here is the excerpt from opencv documentation.

# create BFMatcher object
bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)

# Match descriptors.
matches = bf.match(des1,des2)

matches = bf. match (des1, des2) matches the two sets of descriptors and returns a list of DMatch objects. This DMatch object has four attributes: distance, trainIdx, queryIdx, imgIdx. These return values are equivalent of vl_ubcmatch function.

I hope you will find it helpful.

2
  • What I need is score. VL_UBCMATCH in addition to matches returns score
    – user93
    May 15, 2016 at 17:46
  • 2
    According to VLFEAT documentation, VL_UBCMATCH returns the squared Euclidean distance to the score variable. In fact, when I try SIFT Tutorial, the score variable has distance values between the two SIFT descriptors. scores(:, 1) is 21647, and sum((int64(da(:, 9)) - int64(db(:, 618))) .^2) is same value , where da(:, 9) is 9th SIFT descriptor in ImageA, db(:, 618) is 618th SIFT descriptor in ImageB. Isn't this your desired output?
    – satojkovic
    May 19, 2016 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.