opencv教程CV2模块系列——窗口显示图片、按键盘指定s键保存
import cv2
img = cv2.imread('./imgg/1.jpeg',cv2.IMREAD_UNCHANGED)
# 复制图片
imgcopy = img.copy()
cv2.imshow('image',imgcopy)
k = cv2.waitKey(0)
if k == ord('s'): # wait for 's' key to save and exit
cv2.imwrite('./out/1_5.jpg',imgcopy)
cv2.destroyAllWindows()
else:
cv2.destroyAllWindows()