一、问题描述

在学习openCV的过程中使用了SIFT的时候,发现书上的代码用不了,报错:

module 'cv2.cv2' has no attribute 'xfeatures2d'

二、问题原因

算法被申请了专利,将opencv版本退到3.4.2即可解决,必须小于等于Python3.7

三、解决方案

遇到这个问题 首先检查自己配置的python版本python --version ,这里要求是3.7版本的。
如果高版本无法转换到3.7的话建议重新创建一个虚拟环境。
在满足条件后键入pip3 install opencv-contrib-python==3.4.2.17就能解决了。
conda安装虚拟环境

#这样就创建了一个名字为my_env_name,基于python版本3.7的一个虚拟环境了。
conda create -n my_env_name python=3.7

conda虚拟环境的激活脚本

source activate my_env_name

安装虚拟环境的激活脚本3.4.2.17

#​卸载opencv
pip uninstall opencv-python#安装3.4.2.16
pip install opencv-python==3.4.2.16   -i https://pypi.tuna.tsinghua.edu.cn/simplepip install opencv-contrib-python==3.4.2.16  -i https://pypi.tuna.tsinghua.edu.cn/simple

【完美解决方案】module ‘cv2.cv2‘ has no attribute ‘xfeatures2d‘相关推荐

  1. 完美解决AttributeError: module ‘cv2.cv2‘ has no attribute ‘bgsegm

    测试 import numpy as np import cv2 cap = cv2.VideoCapture('vtest.avi') fgbg = cv2.bgsegm.createBackgro ...

  2. AttributeError: module ‘cv2.cv2‘ has no attribute ‘bgsegm‘

    问题: AttributeError: module 'cv2.cv2' has no attribute 'bgsegm' 解决方案: 打开cmd 激活env环境,然后输入下面指令: pip ins ...

  3. 程序报错:AttributeError: module ‘cv2.cv2‘ has no attribute ‘cv2.MultiTracker_create()‘

    问题1:pycharm运行程序时报错 AttributeError: module 'cv2.cv2' has no attribute 'cv2.MultiTracker_create()' 解决方 ...

  4. AttributeError: module ‘cv2.cv2‘ has no attribute ‘xfeatures2d‘解决方法

    运行一段关于图像拼接的代码时,出现问题 AttributeError: module 'cv2.cv2' has no attribute 'xfeatures2d' def __init__(sel ...

  5. 解决opencv错误AttributeError: module ‘cv2.cv2‘ has no attribute ‘xfeatures2d‘

    解决opencv错误AttributeError: module 'cv2.cv2' has no attribute 'xfeatures2d' 文章目录: 一.错误原因 二.解决方法 一.错误原因 ...

  6. 解决AttributeError: module ‘cv2.cv2‘ has no attribute ‘estimateRigidTransform‘

    问题: AttributeError: module 'cv2.cv2' has no attribute 'estimateRigidTransform' 分析: 出现该问题的原因可能是opencv ...

  7. 成功解决Exception “unhandled AttributeError“ module ‘cv2.cv2‘ has no attribute ‘estimateRigidTransform‘

    成功解决Exception "unhandled AttributeError" module 'cv2.cv2' has no attribute 'estimateRigidT ...

  8. 成功解决AttributeError: module 'cv2.cv2' has no attribute 'CV_CAP_PROP_FPS'和 'CV_CAP_PROP_FRAME_WIDTH'

    成功解决AttributeError: module 'cv2.cv2' has no attribute 'CV_CAP_PROP_FPS'和 'CV_CAP_PROP_FRAME_WIDTH' 目 ...

  9. 成功解决AttributeError: module 'cv2.cv2' has no attribute 'xfeatures2d'

    成功解决AttributeError: module 'cv2.cv2' has no attribute 'xfeatures2d' 目录 解决问题 解决思路 解决方法 解决问题 Attribute ...

最新文章

  1. Django 验证码4.4
  2. 『中级篇』Minikube快速搭建K8S单节点环境(61)
  3. matlab怎么重复一个数字,有 1、2、3、4 个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?用matlab编程怎么编...
  4. Dubbo Cloud Native 实践与思考
  5. Crystal Report 2008
  6. iOS-MVVM-模式介绍
  7. python 函数可以作为容器对象的元素_python基础(十四):函数对象与闭包
  8. https的ssl证书申请及服务器的nginx的配置教程
  9. JAVA设计模式之工厂模式(简单,工厂,抽象)
  10. 极品五笔在非管理员权限下无法使用的问题
  11. xlsread服务器出现意外情况
  12. 溢出的文字如何省略号显示
  13. 数量积、向量积、混合积
  14. 2021十大杰出现货黄金交易平台排名
  15. 人工智能AI编程基础(五)
  16. 蚂蚁金服对收购英支付企业不予置评,雷军忆当年“被迫”当金山CEO往事 | 雷锋早报...
  17. 一起看 I/O | Android 开发者不能错过的 13 件事
  18. python应用——习题练习
  19. python基础编程练习_python基础练习之几个简单的游戏
  20. box-shadow用法总结

热门文章

  1. 利用jquery修改elment的自定义组件多选框el-select(修改多选框的颜色)
  2. java同名变量在list中添加两次_快速解决List集合add元素,添加多个对象出现重复的问题...
  3. halcon中面到面的距离_halcon学习笔记——(8)由标定板得到测量平面位姿-阿里云开发者社区...
  4. 名词解释 算法的有限性_数据结构与算法期中考试卷(含答案)
  5. -9 逆序输出一个整数的各位数字_leetcode两数相加(大整数相加)
  6. python模拟输入回车键_用Python模拟键盘输入
  7. 华为手机充满有提醒吗_2020手机充电速度排名:最快21分钟充满,华为第15名
  8. 笔试常见的智力题(附答案)
  9. Linux进程全解7——父进程wait / waitip回收子进程
  10. 5类6类7类网线对比_孩子们长高的黄金时期是从3月到5月,这阶段多吃6类食物长得快...