AttributeError: 'module' object has no attribute 'xfeatures2d' [Python/OpenCV 2.4]

前端 未结 10 1155
我寻月下人不归
我寻月下人不归 2020-12-01 15:39

This line:

sift = cv2.xfeatures2d.SIFT_create()

return error:

Traceback (most recent call last):
  File \"C:/Python27/openC         


        
相关标签:
10条回答
  • 2020-12-01 16:22

    After executing the command:

    pip install opencv-contrib-python
    

    , I got the following error:

    error: OpenCV(4.0.0) /Users/rene/build/skvark/opencv-python/opencv_contrib/modules/xfeatures2d/src/sift.cpp:1207: error: (-213:The function/feature is not implemented) This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function 'create'

    Could solve it with the following command in anaconda:

    conda install -c menpo opencv
    

    Or with pip:

    pip install opencv-python==3.4.2.17
    
    pip install opencv-contrib-python==3.4.2.17
    
    0 讨论(0)
  • 2020-12-01 16:30

    It doesn't work for OpenCV 4.0 due to US patent matter. Perhaps we shall give it a thumb up for this OpenSift effort:

    https://github.com/robwhess/opensift

    0 讨论(0)
  • 2020-12-01 16:32

    I think you should install opencv-contrib-python instead. The module you're using is not support in opencv-python. See opencv-contrib-python.

    To install:

    pip install opencv-contrib-python
    
    0 讨论(0)
  • 2020-12-01 16:34

    I got the same error... I have used cv2.__version__ and cv2.__path__ to check the opencv version and path. Then I removed cv2 from site-packages. and install the following

    pip install opencv-python==3.4.2.17
    
    pip install opencv-contrib-python==3.4.2.17
    
    0 讨论(0)
提交回复
热议问题