from PIL import Image
data_root = './DIV2K_train_HR'
data_save = './DIV2K_gray'
for i in range(800):
img_index = i + 1
print(img_index)
img_rgb = Image.open(data_root + "/" + str(img_index).zfill(4)+'.png')
img_gray = img_rgb.convert('L')
img_gray.save(data_save + "/" + str(img_index)+'.png')
rgb转gray
最新推荐文章于 2024-04-16 08:12:13 发布