Attributeerror: Module 'cv2.cv2' Has No Attribute 'xfeatures2d' [opencv 3.4.3]
Solution 1:
The error message you have is related to the fact that the module xfeatures2d
does not exist.
It is not directly related to SIFT algorithm nor any algorithm in xfeatures2d
(all will send that error).
I suggest you to either reinstall opencv-contrib-python
(pip install opencv-contrib-python) or if you are using anaconda or equivalent to re-install the two opencv package from another source repository.
A last option consist to compile the full OpenCV ("regular" + contrib) by yourself if you are comfortable with it.
Hope it helps.
Solution 2:
EDIT: My answer was incorrect. Please see the other answer below.
The issue stated in my answer was the solution to a different problem (answered here). However, since you're using OpenCV 3.4.3, I believe you will also have that different problem as well. The original text that was in this answer is now on that other answer, since it is the correct answer to that question.
Solution 3:
Try this in your conda prompt.
pip3 uninstall opencv-python
pip3 install -U opencv-contrib-python==3.4.2.16
Solution 4:
After hours of hair pulling and installing / compiling everything from the scratch, I needed to post this for other people who might be doing the same little stupid mistake I was doing.
If you have both opencv-python and opencv-contrib-python installed in your system and still getting this error, instead of
sift = cv2.xfeatures2d.SIFT_create()
try
sift = cv2.SIFT_create()
Post a Comment for "Attributeerror: Module 'cv2.cv2' Has No Attribute 'xfeatures2d' [opencv 3.4.3]"