【Computer Vision学习】OpenCV常见问题集锦【基于python3】(不断更新)

举报
ReCclay 发表于 2022/02/22 01:02:40 2022/02/22
【摘要】 问题: 在如下环境下使用SIFT算法:descriptor = cv2.xfeatures2d.SIFT_create() python:Python 3.8.6 opencv-python:4.4....

问题:

在如下环境下使用SIFT算法:descriptor = cv2.xfeatures2d.SIFT_create()

python:Python 3.8.6
opencv-python:4.4.0.44
opencv-contrib-python:4.4.0.44

  
 
  • 1
  • 2
  • 3

出现如下警告:

[ WARN:0] global c:\users\appveyor\appdata\local\temp\1\pip-req-build-wwma2wne\opencv_contrib\modules\xfeatures2d\misc\python\shadow_sift.hpp (15) cv::xfeatures2d::SIFT_create DEPRECATED: cv.xfeatures2d.SIFT_create() is deprecated due SIFT tranfer to the main repository. https://github.com/opencv/opencv/issues/16736

  
 
  • 1

解决办法:

在这里插入图片描述

2020年3月7日后,SIFT的专利将到期,因此应免费使用。 opencv将其移出非自由文件夹将使所有人都能使用默认标志编译opencv并仍然获得SIFT。

所以我们再使用SIFT算法,直接这样写即可:descriptor = cv2.SIFT_create()

问题:

内存不够

Error:Insufficient memory(Failed to allocate 1244164 bytes) in unknown function

  
 
  • 1

解决办法:

将python的版本升级为64位的!

问题:

缩进不正确

unindent does not match any outer indentation level

  
 
  • 1

解决办法:

python问题unindent does not match any outer indentation level在pycharm平台的解决方法

问题:

OpenCV 4.0.0无法使用drawKeypoints函数

Error is AttributeError: module 'cv2.cv2' has no attribute 'drawKeypoints'

  
 
  • 1

解决办法:

4.0.0版本的缺陷,进行升级即可!

问题:

安装出现以下提示

The directory or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag

  
 
  • 1

解决办法:

安装时在sudo后面加上-H选项,如下命令:sudo -H pip install xxxx


小技巧:

更新pip工具:pip install --upgrade pip

列出pip安装的包:pip list

更新某个软件包:pip install --upgrade xxxx

升级 pip 到最新的版本 (>=10.0.0) 后进行配置默认镜像源:

pip install pip -U # 升级pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple #更换为清华镜像源
pip config set global.index-url https://repo.huaweicloud.com/repository/pypi/simple #更换为华为镜像源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ #更换为阿里镜像源

  
 
  • 1
  • 2
  • 3
  • 4

文章来源: recclay.blog.csdn.net,作者:ReCclay,版权归原作者所有,如需转载,请联系作者。

原文链接:recclay.blog.csdn.net/article/details/109145271

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。