AttributeError: module 'cv2.cv2' has no attribute 'ximgproc'(问题已解决,亲测有效!)

AttributeError: module ‘cv2.cv2’ has no attribute ‘ximgproc’(问题已解决,亲测有效!)

遇到该问题时,网友多是建议补个包,即
pip3 install opencv-contrib-python
我在补完之后又出现下面这样的错误:
OpenCV(3.4.3) C:\projects\opencv-python\opencv_contrib\modules\xfeatures2d\src\sift.cpp:1207: error: (-213:The function/feature is not implemented) This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function ‘cv::xfeatures2d::SIFT::create’
貌似是该算法被申请了专利还是咋的,将opencv版本退到3.4.2即可解决,卸载之前的包,然后
pip3 install opencv-python == 3.4.2.16
pip3 install opencv-contrib-python == 3.4.2.16

AttributeError: module ‘cv2.cv2’ has no attribute ‘estimateRigidTransform’

The code below is a Python tutorial for Selective Search using OpenCV 3.3. Note the bug alert for OpenCV 3.2 mentioned after the code block. Please read through the comments to understand the code.
卸载opencv重新装3.3或者3.4

NameError:name ‘xrange’ is not defined

原因是我的python版本为python 3.4,而xrange( )函数时在python 2.x中的一个函数,在Python 3中,range()的实现方式与xrange()函数相同,所以就不存在专用的xrange( ),因此,当遇到这种问题时,有两种方法可以解决这个问题。

  1. 第一种:若你想在python 3中运行程序,将xrange( )函数全部换为range( )即可
  2. 第二种:将出现此问题的程序放在python 2.x版本的环境中运行即可
  • 21
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值