SIFT OpenCV 官方文档:

https://docs.opencv.org/master/da/df5/tutorial_py_sift_intro.html

https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_feature2d/py_sift_intro/py_sift_intro.html

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

在用python使用opencv进行SIFT时候,编译出现这样问题:

Traceback (most recent call last):
File "F:\image\test.py", line 7, in <module>
sift = cv2.SIFT()

  

出错代码如下:

import cv2
import numpy as np img = cv2.imread('home.jpg')
gray= cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) sift = cv2.SIFT()
kp = sift.detect(gray,None) img=cv2.drawKeypoints(gray,kp)

  

原因:opencv将SIFT等算法整合到xfeatures2d集合里面了。变更后写法如下:

import cv2
import numpy as np img = cv2.imread('home.jpg')
gray= cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) sift = cv2.xfeatures2d.SIFT_create()
kp = sift.detect(gray,None) img=cv2.drawKeypoints(gray,kp,img)
cv2.imwrite('sift_keypoints.jpg',img)

  

然后又出现错误:

Traceback (most recent call last):
File "F:\image\test.py", line 7, in <module>
sift = cv2.xfeatures2d.SIFT_create()
AttributeError: module 'cv2' has no attribute 'xfeatures2d'

  

再尝试解决:

出错原因:

**原因:**3.X以后OpenCv只包含部分内容,需要神经网络或者其他的函数需要导入opencv_contrib

解决方法:

pip install opencv-contrib-python

注意: 
如果已经安装OpenCv2,则需要先卸载pip uninstall opencv-python再安装

参考资料:https://pypi.python.org/pypi/opencv-contrib-python

再次出错:

cv2.error: 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'

  

问题待解决。。。

------------------------------

感谢,按照一楼大神的方法,问题已解决。

“

版本的问题,直接在终端pip install opencv-contrib-python和你一样的问题,后来重新装了opencv-contrib-python 3.3版本,可以正常使用。
具体来说就是
第一步,卸载原有的opencv-contrib-python
pip3 uninstall opencv-contrib-python(我使用的是python3.6.5)
如果你使用的是python2的版本,使用pip uninstall opencv-contrib-python
第二步,安装新的版本
pip3 install --user opencv-contrib-python==3.3.0.10我使用的是python3.6.5)
如果你使用的是python2的版本,使用pip install --user opencv-contrib-python==3.3.0.10。
如果出现了readtimeouterror就关掉terminal重新输入几次。因为下载源在外网,可能不稳定。

”

Introduction to SIFT (Scale-Invariant Feature Transform)的更多相关文章

  1. SIFT(Scale-invariant feature transform) & HOG(histogram of oriented gradients)

    SIFT :scale invariant feature transform HOG:histogram of oriented gradients 这两种方法都是基于图像中梯度的方向直方图的特征提 ...

  2. Computer Vision_33_SIFT:LIFT: Learned Invariant Feature Transform——2016

    此部分是计算机视觉部分,主要侧重在底层特征提取,视频分析,跟踪,目标检测和识别方面等方面.对于自己不太熟悉的领域比如摄像机标定和立体视觉,仅仅列出上google上引用次数比较多的文献.有一些刚刚出版的 ...

  3. Computer Vision_33_SIFT:Remote Sensing Image Registration With Modified SIFT and Enhanced Feature Matching——2017

    此部分是计算机视觉部分,主要侧重在底层特征提取,视频分析,跟踪,目标检测和识别方面等方面.对于自己不太熟悉的领域比如摄像机标定和立体视觉,仅仅列出上google上引用次数比较多的文献.有一些刚刚出版的 ...

  4. Image Processing and Computer Vision_Review:Local Invariant Feature Detectors: A Survey——2007.11

    翻译 局部不变特征探测器:一项调查 摘要 -在本次调查中,我们概述了不变兴趣点探测器,它们如何随着时间的推移而发展,它们如何工作,以及它们各自的优点和缺点.我们首先定义理想局部特征检测器的属性.接下来 ...

  5. Paper | Recovering Realistic Texture in Image Super-resolution by Deep Spatial Feature Transform

    目录 故事背景 空域特征转换 超分辨率网络 发表在2018年CVPR. 摘要 Despite that convolutional neural networks (CNN) have recentl ...

  6. SIFT算法详解(转)

    http://blog.csdn.net/zddblog/article/details/7521424 目录(?)[-] 尺度不变特征变换匹配算法详解 Scale Invariant Feature ...

  7. 【转】 SIFT算法详解

    尺度不变特征变换匹配算法详解Scale Invariant Feature Transform(SIFT)Just For Fun zdd  zddmail@gmail.com 对于初学者,从Davi ...

  8. [Computer Vision] SIFT特征学习笔记

    SIFT(Scale Invariant Feature Transform),尺度空间不变特征,目前手工设计的最好vision特征. 以下是学习http://blog.csdn.net/zddblo ...

  9. SIFT

    简介 SIFT(scale invariant feature transform)——尺度不变特征转换,用来检测和描述局部特征,运用范围包括object recognition(目标检测), rob ...

随机推荐

  1. 【jQuery】select动态追加的option选中

    var turnUpHidden = $("input[name='turnUpHidden']").val(); if(turnUpHidden != "") ...

  2. Ant:Ant 入门

    背景 自从有了 Maven 以后,Ant 视乎就不流行了,不过 Ant 还是有其应用场景的,Ant 的思想比较简洁,如下: 一个 project 包含多个 target(类似成员方法). 一个 tar ...

  3. vi命令用法

    从shell中启动可视化编辑器vi filename指示shell启动vi编辑器,并将参数filename传给它.如果当前目前中存在该文件,则vi编辑器将它解释为要打开的文件:如果没有该文件,则vi编 ...

  4. unity3d-地图制作之暗光

    最近看了暗黑破坏神3的视频,看到游戏里面的场景画面,颇有感触. 画面可谓做的极好的,虽然我审美观不是那么滴好,但是这游戏就让我看的赏心悦目,就让我好想来撸那么一把. 看完暗黑视频后,我就开始研究里面的 ...

  5. Java:Maven依赖包下载

    Maven依赖的包可以到Maven的中心仓库 http://search.maven.org/#browse 进行查找下载 例如需要MyBatis的依赖包,搜索mybatis,然后选择正确的路径,复制 ...

  6. HTML:基本的标签

    概述: <html></html>标准的语言格式,回环标签,有头和躯体部分,头里面一般显示标题title,躯体部分显示内容:背景色.文字.图片.超链接.表格.表单等. 可以直接 ...

  7. Heap Spray原理

    Heap Spray定义基本描述 Heap Spray并没有一个官方的正式定义,毕竟这是漏洞攻击技术的一部分.但是我们可以根据它的特点自己来简单总结一下.Heap Spray是在shellcode的前 ...

  8. Ubuntu 12.04 LTS安装Windows字体

    内容参考自别人的博客:http://www.cnblogs.com/zhj5chengfeng/p/3251009.html 1. 为了方便,先将Windows字体拷贝到~/WinFonts下. 我是 ...

  9. oracle分析函数之windowing_clause--rows

    Some analytic functions allow the windowing_clause. In the listing of analytic functions at the end ...

  10. go语言基础之递归实现数字累加

    1.实现1+100 = 5050 示例: package main import "fmt" //实现1+2+3+……100 func test01() (sum int) { f ...