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

前端 未结 10 1293
我寻月下人不归
我寻月下人不归 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:12

    This error may also occur in OpenCV 3+ as it is caused by mismatched versions of OpenCV and OpenCV-Contrib package.

    I had OpenCV version 3.4.1 and OpenCV-Contrib version 3.4.0. I tried the following with OpenCV-Contrib:

    Uninstall OpenCV-Contrib package:

    $ pip uninstall opencv-contrib-python
    

    Then install the same again:

    $ pip install opencv-contrib-python
    

    The pip automatically fetches and installs the latest compatible version.

提交回复
热议问题