I'm trying a simple thing like
detector = cv2.SIFT() and get this bad error
detector = cv2.SIFT() AttributeError: 'module' object has no attribute 'SIFT' I do not understand that because cv2 is installed.
cv2.__version__ is
$Rev: 4557 $ My system is Ubuntu 12.04.
Maybe someone has got the same problem and could help me.
EDIT:
Long story short, testypypypy.py:
import cv2 detector = cv2.SIFT() ERROR:
Traceback (most recent call last): File "testypypy.py", line 3, in <module> detector = cv2.SIFT() AttributeError: 'module' object has no attribute 'SIFT If I take SURF it works because SURF is in dir(cv2) but if I also take cv2.BFMatcher() I get the same error... So it's missing and I have to add it but I don't know how.
To get access to the original SIFT and SURF implementations found in OpenCV 2.4. X, you'll need to pull down both the opencv and opencv_contrib repositories from GitHub and then compile and install OpenCV 3 from source.
There is a pip source that makes this very easy.
If you have another version of opencv-python installed use this command to remove it to avoid conflicts:
pip uninstall opencv-python Then install the contrib version with this:
pip install opencv-contrib-python SIFT usage:
import cv2 sift = cv2.xfeatures2d.SIFT_create() If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With