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

本文介绍了SIFT算法在Python3.8.6和OpenCV4.4.0.44环境下的使用方法,并解决了相关警告问题。同时,提供了内存不足、缩进错误、drawKeypoints函数缺失等常见问题的解决方案。
部署运行你感兴趣的模型镜像

问题:

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

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

出现如下警告:

[ 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

解决办法:

在这里插入图片描述

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

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

问题:

内存不够

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

解决办法:

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

问题:

缩进不正确

unindent does not match any outer indentation level

解决办法:

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'

解决办法:

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

解决办法:

安装时在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/ #更换为阿里镜像源

您可能感兴趣的与本文相关的镜像

Python3.8

Python3.8

Conda
Python

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ReCclay

如果觉得不错,不妨请我喝杯咖啡

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值