批量resize图片大小
import cv2import os.pathimport osimport numpy as npdef img_resize(img): height, width = img.shape[0], img.shape[1] # 设置新的图片分辨率框架,这里设置为长边像素大小为512 width_new = 640 height_new = 512 # 判断图片的长宽比率 if width / height >= width_new /.