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

查看:26
本文介绍了AttributeError: 'module' 对象没有属性 '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: 'module' 对象没有属性 'xfeatures2d' [Python/OpenCV 2.4]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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