在OpenCV Python中找不到SIFT或xfeatures2d [英] Unable to find SIFT or xfeatures2d in OpenCV Python

查看:1095
本文介绍了在OpenCV Python中找不到SIFT或xfeatures2d的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我使用OpenCV 3.4.1切换回python进行面部检测和模式识别,但是在运行OpenCV进行点识别时,出现错误

I recently switch back to python for facial detection and pattern recognition using OpenCV 3.4.1 However when running OpenCV for point recongnition, I get the error

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

我已经读到将行从sift = cv2.SIFT_create()更改为sift = sift = cv2.xfeatures2d.SIFT_create()应该可以解决此问题.

I have read that changing the line from sift = cv2.SIFT_create() to sift = sift = cv2.xfeatures2d.SIFT_create() should solve this.

但是我得到一个错误

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

xfeatures2d是否应包含在OpenCV中?关于如何解决此问题的任何建议?谢谢!

Shouldnt xfeatures2d be included in OpenCV? Any suggestion on how to fix this? Thanks!

推荐答案

我猜您已使用pip安装了opencv-python.该软件包不包括贡献模块.要解决此问题,请卸载opencv-python并安装opencv-contrib-python.

I guess you installed opencv-python with pip. That package does not include contributed modules. To fix, uninstall opencv-python and install opencv-contrib-python instead.

这篇关于在OpenCV Python中找不到SIFT或xfeatures2d的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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