AttributeError: module ‘cv2‘ has no attribute ‘SIFT‘解决总结

遇到该问题时,网友多是建议补个包,即pip install opencv-contrib-python
我在补完之后又出现下面这样的错误:
OpenCV(3.4.3) C:\projects\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 ‘cv::xfeatures2d::SIFT::create’
将opencv版本退到3.4.2即可解决,卸载之前的包(pip uninstall opencv-python),然后

pip install opencv-python==3.4.2.16
pip install opencv-contrib-python==3.4.2.16

注意以上两条命令==左右没有空格

如果错误:

  'module' object has no attribute 'xfeatures2d'

原因:opencv将SIFT等算法整合到xfeatures2d集合里面了。

siftDetector=cv2.SIFT()

变更后为

siftDetector= cv2.xfeatures2d.SIFT_create()

参考:AttributeError: module 'cv2' has no attribute 'SIFT'

相关推荐

  1. react面试总结2

    2024-01-13 11:14:04       31 阅读
  2. 2.3学习总结

    2024-01-13 11:14:04       26 阅读
  3. 2.4学习总结

    2024-01-13 11:14:04       34 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-01-13 11:14:04       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-01-13 11:14:04       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-01-13 11:14:04       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-01-13 11:14:04       20 阅读

热门阅读

  1. 换根DP求树的重心/求最小距离和

    2024-01-13 11:14:04       35 阅读
  2. pythonrequests用法

    2024-01-13 11:14:04       33 阅读
  3. 【C】存储类别(作用域、链接、存储期)

    2024-01-13 11:14:04       33 阅读
  4. js null和undefined的区别

    2024-01-13 11:14:04       29 阅读
  5. CNAS中兴新支点——软件验收测试功能有哪些

    2024-01-13 11:14:04       34 阅读
  6. Qt QML和QWidget混合编程(面试亮点)

    2024-01-13 11:14:04       39 阅读
  7. [论文笔记] PAI-Megatron中qwen和mistral合并到Megtron-LM

    2024-01-13 11:14:04       40 阅读
  8. openssl3.2 - 官方demo学习 - client-conf.c

    2024-01-13 11:14:04       32 阅读
  9. Python中的图像处理和计算机视觉应用

    2024-01-13 11:14:04       38 阅读
  10. PyQt UI 信号槽函数重复执行问题

    2024-01-13 11:14:04       35 阅读