When I try:
sift = cv2.sift()
I get at the end the following:
AttributeError: module 'cv2.cv2' has no attribute 'sift'
How can I fix it? Any help would be appreciated
When I try:
sift = cv2.sift()
I get at the end the following:
AttributeError: module 'cv2.cv2' has no attribute 'sift'
How can I fix it? Any help would be appreciated
Short answer:
If anyone is getting error while running
sift = cv2.SIFT_create()
Make sure you have
sift = cv2.xfeatures2d.SIFT_create()
Long answer:
This may not be the answer to this specific question, but I decide to write this down just in case anyone might find it hlepful like I did.
I was learning SIFT via Introduction to SIFT (Scale-Invariant Feature Transform), and trying out the code
sift = cv2.SIFT_create()
Which told me the following
AttributeError: module 'cv2.cv2' has no attribute 'SIFT_create'
(Edit: the default doc version in the link above is 4.4.0-pre. If you switch it to 4.3.0 the doc correctly tell you to call the right method. I suppose this means that SIFT will back to main in the next release of 4.4.0)
Then I came to this question and in the comment above the link from @Micka gave me the answer, as shown in the short answer. Thank you Micka!
P.S. The patent has actually expired so SIFT is actually free now, but the work of moving SIFT to main modules is yet to be done as of this moment.