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 ...
随机推荐
- 【Linux】Ubuntu16.04 ftp匿名访问
一.安装: 1.安装命令: sudo apt-get install vsftpd 2.配置文件: vi /etc/vsftpd.conf 3.开启.关闭.重启服务 sudo /etc/init.d/ ...
- 【Docker】删除镜像
删除镜像:docker rmi [OPTIONS] IMAGE [IMAGE...] 1.删除所有未被 tag 标记和未被容器使用的镜像: docker image prune 2.删除所有未被容器使 ...
- Team Foundation Server 2015使用教程【1】:团队项目创建
- lumen 笔记一
可以用config()函数和evn()函数来获取 .evn里面的配置内容 config('app.timezone') 获取配置config(['app.timezone' => 'China/ ...
- Java面向对象程序设计第8章3-5
Java面向对象程序设计第8章3-5 3.String类型有什么特点? 一旦赋值,便不能更改其指向的字符对象 如果更改,则会指向一个新的字符对象 不能为null 4.String什么时候进行值比较,什 ...
- Linux(Centos)安装node及anyproxy
一.安装node //下载 wget https://nodejs.org/dist/v10.9.0/node-v10.9.0-linux-x64.tar.xz //解压 tar xf node-v1 ...
- spring定时器时间设置规则
单纯针对时间的设置规则org.springframework.scheduling.quartz.CronTriggerBean允许你更精确地控制任务的运行时间,只需要设置其cronExpressio ...
- Centos7源码编译安装mysql8
前面介绍了很多关于mysql的文章,下面主要介绍一下mysql8的源码编译安装 一 基本环境 [root@CentOS-7-x86-64-Minimal-1810 ~]# cd /usr/local/ ...
- Frangi形态学滤波详解
利用Hessian矩阵的滤波函数Frangi,网上的文章只是把论文中的公式贴出来了. 我感觉分析下滤波函数是怎么起作用,还是挺有意思的一件事情. Frangi滤波方法的论文是: Frangi A F, ...
- iFit—Smart Cardio Equipment 简介与下载
iFit—Smart Cardio Equipment 无法在谷歌商店中下载,经过技术提取app只可以直接通过下载app安装简单方便 实测机型:华为荣耀畅玩2平板, 小米6X,360N5S均测试无BU ...