import glob as gb
import cv2
img_path = gb.glob("G:\\ZXWwork\\PYZ\\*\\*.jpg")
for path in img_path:
img = cv2.imread(path)
a=img.shape
height = a[0]
width = a[1]
##true = min(height, width)
res = cv2.resize(img, (24,24), interpolation=cv2.INTER_CUBIC)
cv2.imshow('Image', res)
cv2.imwrite(path, res)
cv2.waitKey(1000)
python选取图像的长和宽的最小值,把图像缩放成长和宽中最小的值
最新推荐文章于 2022-12-15 15:28:22 发布