python onencv 图片另存为地址

5 阅读1分钟
import cv2

cv2.namedWindow('image', cv2.WINDOW_NORMAL)
img = cv2.imread('C:\Users\shaog\Pictures\45b6ecbf34b48f66f8a1ee77311c4ddd.jpeg')
# 设置窗口大小
cv2.resizeWindow('image', 500, 500)
# 窗口的显示时长

# 退出与显示逻辑
print(ord('q'))
while True:
    cv2.imshow('image', img)
    key = cv2.waitKey(0)
    if key & 0xFF == ord('q'):
        break
    elif key & 0xFF == ord('s'):
        # cv2.destroyAllWindows()
        cv2.imwrite('C:\Users\shaog\Pictures\12333333.jpeg', img)
    else:
        print(key)

cv2.destroyAllWindows()