AttributeError:“模块"对象没有属性"xfeatures2d" [Python/OpenCV 2.4] [英] AttributeError: 'module' object has no attribute 'xfeatures2d' [Python/OpenCV 2.4]

查看:250
本文介绍了AttributeError:“模块"对象没有属性"xfeatures2d" [Python/OpenCV 2.4]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此行:

sift = cv2.xfeatures2d.SIFT_create()

返回错误:

Traceback (most recent call last):
  File "C:/Python27/openCVskrypty/GUI/SOLUTION2.py", line 11, in <module>
    sift = cv2.xfeatures2d.SIFT_create()
AttributeError: 'module' object has no attribute 'xfeatures2d'

我读到一些有关此错误的信息,它出现在OpenCV 3.0版中. 这很奇怪,因为我有2.4.11版本.

I read something about this error and it appears in OpenCV version 3.0. This is quite weird because I have 2.4.11 version.

我检查dir(cv2),但没有xfeatures2d模块.有人知道为什么吗?我可以单独下载吗?

I check dir(cv2) and I haven't got xfeatures2d module. Does anyone know why? Can I download it separately?

感谢您帮助解决此问题.

Thanks for help how fix this.

推荐答案

我认为您应该改为安装opencv-contrib-python.您正在使用的模块在opencv-python中不支持.参见 opencv-contrib-python .

I think you should install opencv-contrib-python instead. The module you're using is not support in opencv-python. See opencv-contrib-python.

要安装:

pip install opencv-contrib-python

这篇关于AttributeError:“模块"对象没有属性"xfeatures2d" [Python/OpenCV 2.4]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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