OpenCV-Python学习笔记(第一篇)

使用pip install opencv-python 安装opencv-python

import cv2

img = cv2.imread('tx.png', 1) #,加载图片,1为彩色 0为灰度
cv2.imshow('tx', img) #显示图片,定义窗口的名字tx
key = cv2.waitKey(0)#等待按键输入,0为一直等待,参数单位为毫秒

if key == ord('k'):
    cv2.imwrite('image_processed.jpg', img) #如果按下's',就保存图片为'image_processed.jpg'

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

超出时限。 请再次填写验证码。