亲宝软件园·资讯

展开

python之OpenCV的作用及安装 python之OpenCV的作用以及安装案例教程

Holidaylovesam 人气:0
想了解python之OpenCV的作用以及安装案例教程的相关内容吗,Holidaylovesam在本文为您仔细讲解python之OpenCV的作用及安装的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:python之OpenCV作用,python之OpenCV安装,下面大家一起来学习吧。

OpenCV的作用及安装

OpenCV简介

OpenCV是一个开源的跨平台计算机视觉库,可以运行在Linux、Windows、Android和Mac OS操作系统上。提供了Python、Ruby、MATLAB等语言的接口,并且实现了图像处理和计算机视觉方面的很多通用算法,可以给开发者调用。

OpenCV应用领域

OpenCV涉及的技术

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'

加载全部内容

相关教程
猜你喜欢
用户评论