#rgb转化为灰度图 from PIL import Image import os pic_path = 'F:/code/Pytorch-UNet-master (1)/Pytorch-UNet-master/kagg_train/masks/' # 需要修改的图片路径 save_path = 'F:/code/Pytorch-UNet-master (1)/Pytorch-UNet-master/kagg_train/masks_ruslt/ ' pic_name = os.listdir(pic_path) # 获取原路径下的图片 for i in range(len(pic_name)): name = pic_name.pop() print(name) img = Image.open(pic_path + name).convert('L') # 转换图片 img.save(save_path + name)
rgb转化为灰度图
最新推荐文章于 2024-03-30 09:06:37 发布