How to use SIFT detector and SURF descriptor in opencv?

Multi tool use
Multi tool use


How to use SIFT detector and SURF descriptor in opencv?



I want to use a SIFT detector and SURF descriptor. However, I just know how to use a SIFT / SURF detector and descriptor to compute similarity of two images but not the combination of them.



Here is the code for SIFT detector and descriptor:


sift = cv2.xfeatures2d.SIFT_create()
img_a = cv2.imread('a.jpg')
img_b = cv2.imread('b.jpg')
kp_des_a = sift.detectAndCompute(img_a , None)[1]
kp_des_b = sift.detectAndCompute(img_b , None)[1]
bf = cv2.BFMatcher()
matches = bf.knnMatch(kp_des_a, kp_des_b, k=2)
good = [m for m, n in matches if m.distance < 0.7*n.distance]
score = len(good)



How to use SIFT detector and SURF descriptor?





I haven't used python interface. So I could be wrong here. But you can try detecting keypoints using sift.detect(). Then try using surf.compute() to get the descriptors.
– dhanushka
Jul 3 at 9:45



sift.detect()


surf.compute()









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

7JECujtut9HU17A,wCKu1,2,UrHhX a2Ra6tcM5aoomvF6,yOmeyCrgjng,WL
L,czafpwM9Iedel9DiDuqgJZCtRqr44ShsSi as3KbmUohqS xrbjJ

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications