[Python数字图像处理]-环境搭建
1、系统与python安装
本文适用于Windows 64位系统下的Pthon3.7版本。python可在官网下载:
https://www.python.org/downloads/windows/ ,安装完毕后在操作系统的环境变量中配置好python的安装路径
2、扩展库安装
以管理员身份运行Cmd或Powershell,输入以下命令
pip install --upgrade setuptools
pip install scipy
pip install numpy
pip install Matplotlib
pip install opencv-python
pip install pillow
如果出现库安装出现超时或安装失败,可以设置国内源下载
清华源https://pypi.tuna.tsinghua.edu.cn/simple/
pip install --upgrade setuptools -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install scipy -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install Matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install pillow -i https://pypi.tuna.tsinghua.edu.cn/simple/
3、测试
#导入cv模块
import cv2 as cv
#读取图像,支持 bmp、jpg、png、tiff 等常用格式
img = cv.imread("test.jpg")
#创建窗口并显示图像
cv.namedWindow("Image")
cv.imshow("Image",img)
cv.waitKey(0)
#释放窗口
cv2.destroyAllWindows()
本文详细介绍在Windows64位系统下,如何为Python3.7版本安装必要的图像处理库,包括numpy、opencv-python等,并提供测试代码示例。
740

被折叠的 条评论
为什么被折叠?



