#导入opencv-python
import cv2
import sys
#读入图片文件
img = cv2.imread('logo.jpg')
#判断文件是否成功读入
if img is None:
sys.exit("Culd not read the image.")
#在窗口中显示图片
cv2.imshow("Diskplay Window",img)
#获取键盘动作,如果按下S键就将图像保存到本地 参数0表示永久等待 其它数值以毫秒为单位
k = cv2.waitKey(0)
if k == ord("s"):
cv2.imwrite("saved_img.png",img)
#关闭窗口
cv2.destroyAllWindows()
« ubuntu arduino上传失败解决方法
|
opencv调用摄像头»
|