python之OpenCV的作用以及安装案例教程
作者:Holidaylovesam 时间:2021-11-27 07:14:20
OpenCV的作用及安装
OpenCV简介
OpenCV是一个开源的跨平台计算机视觉库,可以运行在Linux、Windows、Android和Mac OS操作系统上。提供了Python、Ruby、MATLAB等语言的接口,并且实现了图像处理和计算机视觉方面的很多通用算法,可以给开发者调用。
OpenCV应用领域
计算机视觉领域方向
人机互动
物体识别
图像分割
人脸识别
动作识别
运动跟踪
机器人
运动分析
机器视觉
结构分析
汽车安全驾驶
OpenCV涉及的技术
图像数据的操作: 分配、释放、复制、设置和转换。 图像是视频的输入输出I/O ,文件与摄像头的输入、图像和视频文件输出)。
矩阵和向量的操作以及线性代数的算法程序:矩阵积、解方程、特征值以及奇异值等。
各种动态数据结构:列表、队列、集合、树、图等。
基本的数字图像处理:滤波、边缘检测、角点检测、采样与差值、色彩转换、形态操作、直方图、图像金字塔等。
结构分析:连接部件、轮廓处理、距离变换、各自距计算、模板匹配、Hough变换、多边形逼近、直线拟合、椭圆拟合、Delaunay 三角划分等。
摄像头定标:发现与跟踪定标模式、定标、基本矩阵估计、齐次矩阵估计、立体对应。
运动分析:光流、运动分割、跟踪。
目标识别:特征法、隐马尔可夫模型:HMM。
基本的GUI:图像与视频显示、键盘和鼠标事件处理、滚动条。
图像标注:线、二次曲线、多边形、画文字。
OpenCV的安装
mac上安装opencv时,一开始使用pip3 install python-opencv时报错,提示:No matching distribution found for python-opencv,使用pip3 install opencv,也报错,提示找不到opencv,如图
alicedembp:~ alice$ pip3 install python-opencv
Collecting python-opencv
Could not find a version that satisfies the requirement python-opencv (from versions: )
No matching distribution found for python-opencv
后来重新反过来试了一下pip3 install opencv-python,居然成功了 ,如图
alicedembp:~ alice$ pip3 install python-opencv
Collecting python-opencv
Could not find a version that satisfies the requirement python-opencv (from versions: )
No matching distribution found for python-opencv
alicedembp:~ alice$ pip3 install opencv-python
Collecting opencv-python
Downloading https://files.pythonhosted.org/packages/8d/ff/13e77ee7ac431f831e20d81a6bf0214ca1cf550cf9b575e3213e14325c81/opencv_python-4.1.0.25-cp37-cp37m-macosx_10_7_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (52.1MB)
100% |████████████████████████████████| 52.1MB 735kB/s
Requirement already satisfied: numpy>=1.14.5 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from opencv-python) (1.16.1)
Installing collected packages: opencv-python
Successfully installed opencv-python-4.1.0.25
alicedembp:~ alice$
可以在终端使用命令行import cv2检验一下是否真的成功了
alicedembp:~ alice$ python
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>>
导入时无出错提示,确认已成功~也可通过cv2.__version__查看安装的版本,示例如下:
alicedembp:~ alice$ python
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.1.0'
来源:https://blog.csdn.net/alice_tl/article/details/89291235
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python matplotlib中的subplot函数使用详解
![](https://img.aspxhome.com/file/2023/3/67813_0s.jpg)
Python format函数详谈
Python如何匹配文本并在其上一行追加文本
![](https://img.aspxhome.com/file/2023/2/99122_0s.png)
实现MySQL远程访问办法
python实现京东订单推送到测试环境,提供便利操作示例
Python实现绘制多种激活函数曲线详解
![](https://img.aspxhome.com/file/2023/8/78488_0s.png)
python计算日期之间的放假日期
文字链接,怎么办?
![](https://img.aspxhome.com/file/UploadPic/20088/4/20088413222403s.gif)
Python 实现删除某路径下文件及文件夹的实例讲解
读写xml文件的2个小函数
静态页面分页的AJAX实现
![](https://img.aspxhome.com/file/UploadPic/20081/19/2008119162559319s.jpg)
Python实现自动化邮件发送过程详解
![](https://img.aspxhome.com/file/2023/0/113020_0s.png)
JavaScript for: i++ vs i–
python数据类型_字符串常用操作(详解)
教你如何在CI框架中使用 .htaccess 隐藏url中index.php
python图形开发GUI库pyqt5的基本使用方法详解
![](https://img.aspxhome.com/file/2023/4/70884_0s.png)
Python 共享变量加锁、释放详解
![](https://img.aspxhome.com/file/2023/2/103622_0s.png)
python多线程和多进程关系详解
各种鼠标经过图片边框加粗效果整理
python图片灰度化处理的几种方法
![](https://img.aspxhome.com/file/2023/9/112979_0s.jpg)