I'm using python 3.6.3, opencv-contrib-python-3.3.1.11 in VS Code. I'm trying to run the following code:
import cv2
image1 = cv2.imread('PATH.image1.jpg',0)
image2 = cv2.imread('PATH.image2.jpg',0)
sift = cv2.xfeatures2d.SIFT_create()
kp1, des1 = sift.detectAndComputer(image1,None)
kp2, desc2 = sift.detectAndComputer(image2,None)
I've read about the change in SIFT for earlier versions of openCV and the later versions making a user install the opencv contrib instead. My error isn't around the create but rather around the detectAndComputer method. This is the error:
Exception has occurred: AttributeError
'cv2.xfeatures2d_SIFT' object has no attribute 'detectAndComputer'
The correct call is kp1, des1 = sift.detectAndCompute(image1,None)
rather than detectAndComputer
.
There are some details on this process and code syntax here