import cv2 img = cv2.imread(’…/Lenna.png’) cv2.imshow(‘img’,img) k = cv2.waitKey(0) ord()获取某个字符的编码 if k == ord(‘s’): cv2.imwrite(‘len_save.bmp’,img)