opencv 存储不同压缩率的JPG图像(python)

import cv2
from glob import glob
jpg_path="D:/DataSet/zezheng_data/mask_finally/mask_no/mask_no_crop_new/*.jpg"
dst_path="D:/DataSet/zezheng_data/mask_finally/mask_no/mask_no_crop_new_10/"
for i in glob(jpg_path):
    src=cv2.imread(i)
    dst_jpg=dst_path+i.split("\\")[-1]
    cv2.imwrite(dst_jpg,src,[int(cv2.IMWRITE_JPEG_QUALITY),10])

详见https://www.cnblogs.com/sunshenggang/p/9279373.html

你可能感兴趣的:(opencv 存储不同压缩率的JPG图像(python))