OpenCV 轉存圖片檔
1 min readJun 3, 2020
匯入為JPG格式,轉存為PNG格式
import cv2 as cv
import sys
img = cv.imread(“img.jpg”)
if img is None:
sys.exit(“Could not read the image.”)
cv.imshow(“Display window”, img)
k = cv.waitKey(0)
if k == ord(“s”):
cv.imwrite(“car.png”, img)