I wrote this function for comparison of keypoints of frames of a video.
def match_images(img1, img2):
"""Given two images, returns the matches"""
detector = cv2.SIFT(100)
matcher = cv2.BFMatcher(cv2.NORM_L2)
kp1, desc1 = detector.detectAndCompute(img1, None)
kp2, desc2 = detector.detectAndCompute(img2, None)
raw_matches = matcher.knnMatch(desc1, trainDescriptors = desc2, k = 2)
kp_pairs = filter_matches(kp1, kp2, raw_matches)
return kp_pairs
And I got this error
Traceback (most recent call last):
File "test.py", line 173, in <module>
kp_pairs = match_images(img1, img2)
File "test.py", line 18, in match_images
detector = cv2.SIFT(100)
AttributeError: 'module' object has no attribute 'SIFT'