python 批量旋转 数据增强

#piliangxuanzhuan.py
from PIL import Image
 
# 加载原始图片
for i in range(1,6):
	img = Image.open("E:\\CCF_competition\\remote_sensing_image\\unet_buildings\\unet_buildings\\label\\{}.png".format(i))
	img2 = img.transpose(Image.ROTATE_90)#img2 = img.rotate(90*zzz)#print(img2.size)
	img2.save("E:\\CCF_competition\\remote_sensing_image\\unet_buildings\\unet_buildings\\src\\jpg\\{}.png".format(i+30))
	img2 = img.transpose(Image.ROTATE_180)#img2 = img.rotate(90*zzz)#print(img2.size)
	img2.save("E:\\CCF_competition\\remote_sensing_image\\unet_buildings\\unet_buildings\\src\\jpg\\{}.png".format(i+35))
	img2 = img.transpose(Image.ROTATE_270)#img2 = img.rotate(90*zzz)#print(img2.size)
	img2.save("E:\\CCF_competition\\remote_sensing_image\\unet_buildings\\unet_buildings\\src\\jpg\\{}.png".format(i+40))

 

你可能感兴趣的:(python)