AttributeError:模块'cv2.cv2'没有属性'xfeatures2d'[Opencv 3.4.3] [英] AttributeError: module 'cv2.cv2' has no attribute 'xfeatures2d' [Opencv 3.4.3]

查看:63
本文介绍了AttributeError:模块'cv2.cv2'没有属性'xfeatures2d'[Opencv 3.4.3]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了opencv 3.4.3(使用pip3 install opencv-pythonpip3 install opencv-python-contrib)

I have opencv 3.4.3 installed (using pip3 install opencv-python and pip3 install opencv-python-contrib)

当我运行包含此行的代码时:
sift = cv2.xfeatures2d.SIFT_create()
我收到此错误:

When I run a code containing this line:
sift = cv2.xfeatures2d.SIFT_create()
I got this error:

AttributeError: module 'cv2.cv2' has no attribute 'xfeatures2d'

opencv 3.4.3是否不再支持xfeatures2d功能?

Is xfeatures2d function not anymore supported by opencv 3.4.3?

推荐答案

您收到的错误消息与模块xfeatures2d不存在有关. 它与SIFT算法或xfeatures2d中的任何算法都没有直接关系(所有都将发送该错误). 我建议您或者重新安装opencv-contrib-python(pip install opencv-contrib-python),或者如果您正在使用anaconda或等效工具从另一个源存储库中重新安装两个opencv软件包. 最后一个选择是,如果您愿意的话,可以自己编译完整的OpenCV(常规" + contrib).

The error message you have is related to the fact that the module xfeatures2d does not exist. It is not directly related to SIFT algorithm nor any algorithm in xfeatures2d (all will send that error). I suggest you to either reinstall opencv-contrib-python(pip install opencv-contrib-python) or if you are using anaconda or equivalent to re-install the two opencv package from another source repository. A last option consist to compile the full OpenCV ("regular" + contrib) by yourself if you are comfortable with it.

希望有帮助.

这篇关于AttributeError:模块'cv2.cv2'没有属性'xfeatures2d'[Opencv 3.4.3]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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