Python + OpenCV 3-无法使用SIFT [英] Python+OpenCV 3 - cant use SIFT

查看:635
本文介绍了Python + OpenCV 3-无法使用SIFT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编译了OpenCV 3&最新源代码中的opencv_contrib.将其安装到Python 2.7的site-packages文件夹中.我可以在 http://docs.opencv上关注所有教程.org/trunk/doc/py_tutorials/py_feature2d/py_matcher/py_matcher.html 除外,涉及SIFT的除外.

I compiled OpenCV 3 & opencv_contrib from latest source code. Installed it into site-packages folder for Python 2.7. I can follow all of the tutorials at http://docs.opencv.org/trunk/doc/py_tutorials/py_feature2d/py_matcher/py_matcher.html except the ones involving SIFT.

这是我得到的错误:

Traceback (most recent call last):
  File "C:\Projects\icu\ex01.py", line 9, in <module>
    sift = cv2.SIFT()
AttributeError: 'module' object has no attribute 'SIFT'

请帮助.我搜索了&搜索和搜索并找不到与Opencv3相关的任何内容.

Please help. I searched & searched & searched and cant find anything related to Opencv3.

哦,我用Visual Studio 2013来构建它.

Oh, and I used Visual Studio 2013 to build it.

推荐答案

从3.0版开始,SIFT,SURF,BRIEF和FREAK已移至单独的 opencv_contrib存储库.

as of 3.0, SIFT, SURF, BRIEF and FREAK were moved to a seperate opencv_contrib repo.

您将必须下载该文件,将其添加到您的主要cmake设置中(请参阅此处的自述文件),然后重建主要的opencv存储库.在进行安装"之后,您的python应该有一个新的cv2.pyd,其中再次包含了这些内容.然后:

you will have to download that, add it to your main cmake settings (please see the README there), and rebuild the main opencv repo. after 'make install' your python should have a new cv2.pyd, that contains those again. then:

# note the additional namespace:
sift = cv2.xfeatures2d.SIFT_create() 

这篇关于Python + OpenCV 3-无法使用SIFT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆