AttributeError: module 'cv2' has no attribute 'SIFT'解决总结
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()

又报:
TypeError: Required argument 'outImage' (pos 3) not found
im=cv2.drawKeypoints(img_RGB,kp,flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
变更后为im=cv2.drawKeypoints(img_RGB,kp,img,flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
SURF:
import cv2
img = cv2.imread('cat.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
surf = cv2.xfeatures2d.SURF_create()
kp = surf.detect(gray, None)
img = cv2.drawKeypoints(gray, kp, img)
cv2.imshow("img", img)
k = cv2.waitKey(0)
if k & 0xff == 27:
cv2.destroyAllWindows()
AttributeError: module 'cv2' has no attribute 'SIFT'解决总结的更多相关文章
- python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法?
python中引入包的时候报错:import unittestimport smtplibimport timeimport osimport sysimp.reload(sys)sys.setdef ...
- 【pycharm】pycharm上安装tensorflow,报错:AttributeError: module 'pip' has no attribute 'main' 解决方法
pycharm上安装tensorflow,报错:AttributeError: module 'pip' has no attribute 'main' 解决方法 解决方法: 在pycharm的安装目 ...
- [开发技巧]·AttributeError: module 'pywt' has no attribute 'wavedec'解决方法
[开发技巧]·AttributeError: module 'pywt' has no attribute 'wavedec'解决方法 1.卸载 pywt pip uninstall pywt 2.安 ...
- pygame模块使用时出现AttributeError: module ‘pygame’ has no attribute '…'错误解决方法
pygame模块使用时出现AttributeError: module 'pygame' has no attribute '-'错误解决方法 首先在pygame中存在init()模块,出现这样的问题 ...
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...
- AttributeError: module '__main__' has no attribute 'main'解决方法
在终端运行.py文件时报错:AttributeError: module '__main__' has no attribute 'main' 原因:在PyCharm里运行python程序需要添加 i ...
- 提示AttributeError: 'module' object has no attribute 'HTTPSHandler'解决方法
今天在新机器上安装sqlmap,运行提示AttributeError: 'module' object has no attribute 'HTTPSHandler' 网上找了找资料,发现一篇文章ht ...
- OpenCV 学习笔记 05 人脸检测和识别 AttributeError: module 'cv2' has no attribute 'face'
1 环境设置: win10 python 3.6.8 opencv 4.0.1 2 尝试的方法 在学习人脸识别中,遇到了没有 cv2 中没有 face 属性.在网上找了几个方法,均没有成功解决掉该问题 ...
- cv2.SIFT() AttributeError: 'module' object has no attribute 'SIFT' OpenCV Python can't use SURF, SIFT
参考链接: https://stackoverflow.com/questions/18561910/opencv-python-cant-use-surf-sift For recent infor ...
随机推荐
- Python5_学习方法论
学习路线: 1.对基础知识的全面掌握,熟悉IDE和基本概念,注重知识体系构建: 2.开发实战.在该过程中掌握各类框架知识.熟悉模块的使用.并根据问题深入学习: ==================== ...
- mysql主从之keepalive+MySQL高可用
一 keepalive介绍 1.1 keepalived 是什么 keepalived 是集群管理中保证集群高可用的一个服务软件,用来防止单点故障. 1.2 keepalived 工作原理 keepa ...
- C# Charts绘制多条曲线
一.创建winform工程 拖拽控件Chart 二.比如要绘制俩条曲线,设置Chart控件的属性Series 三.chart的属性根据自己的业务需求设计,我这里只设置了图标类型 代码: using S ...
- k8s集群———flannel网络
#master执行将内网通信地址写入etcd中,确保flannel能与etcd通信 #添加 /opt/etcd/bin/etcdctl --ca-file=/opt/etcd/ssl/ca.pem - ...
- 洛谷$P$3160 局部极小值 $[CQOI2012]$ 状压$dp$
正解:状压$dp$ 解题报告: 传送门! 什么神仙题昂,,,反正我是没有想到$dp$的呢$kk$,,,还是太菜了$QAQ$ 首先看数据范围,一个4×7的方格,不难想到最多有8个局部极小值,过于显然懒得 ...
- XRPC之接口双向调用
一般远程接口调用的服务都是基于客户端主动调用服务端,由服务端来提供相关的接口服务:在新版本的XRPC中引入了一个新的功能,即接口双向通讯,组件提供服务创建客户会话的接口代理并调用客户提供的接口服务.接 ...
- Java工程师阅读源码的一些见解
一.为何阅读源码 就是说,通过阅读源码能给你带来什么好处. 学习如何从需求-设计-实现,开阔你的思维,提升你的架构设计能力: 帮助更好地理解原理和架构设计: 帮助更快地定位线上问题BUG 可以根据自己 ...
- 「学习笔记」珂朵莉树 ODT
珂朵莉树,也叫ODT(Old Driver Tree 老司机树) 从前有一天,珂朵莉出现了... 然后有一天,珂朵莉树出现了... 看看图片的地址 Codeforces可还行) 没错,珂朵莉树来自Co ...
- SpringCloudAlibaba通过jib插件打包发布到docker仓库
序言 在SpringBoot项目部署的时候,我了解到了Jib插件的强大,这个插件可以快速构建镜像发布到我们的镜像仓库当中去.于是我打算在毕设当中加上这个功能,并且整合到github actions中去 ...
- Linux下搭建C/C++编程环境
Linux下搭建C/C++编程环境 1.KDevelop下载 wget -O KDevelop.AppImage https://download.kde.org/stable/kdevelop/5. ...
