python对文件夹下有中文命名图片的resize代码

代码如下

import os
import cv2 
import numpy as np
for filename in os.listdir(r"license_plate/green/"):
    print (filename)
    img = cv2.imdecode(np.fromfile('license_plate/green/'+filename, dtype=np.uint8), 1)
    img_new = cv2.resize(img,(92,24))
    cv2.imencode('.jpg', img_new)[1].tofile('license_plate/green/'+filename)

你可能感兴趣的:(python,numpy,深度学习)