transforms.ColorJitter(brightness=0, contrast=0, saturation=0, hue=0)
brightness:亮度
contrast:对比度
saturation :饱和度
hue:明度 取值必须在(-0.5, 0.5)
取值:单值(float) or元组(min,max),非负值
img0=Image.open('lin-xiao-xun-000003.jpg')
img1=transform.ColorJitter(brightness=(0.5,0.9), contrast=0, saturation=0, hue=0)(img0)
img2=transform.ColorJitter(brightness=0, contrast=(0.1,0.9), saturation=0, hue=0)(img0)
img3=transform.ColorJitter(brightness=0, contrast=0, saturation=(0.1,0.9), hue=0)(img0)
img4=transform.ColorJitter(brightness=0, contrast=0, saturation=0, hue=(-0.2,0.2))(img0)
axs = plt.figure().subplots(1, 5)
axs[0].imshow(img0);axs[0].set_title('src');axs[0].axis('off')
axs[1].imshow(img1);axs[1].set_title('brightness');axs[1].axis('off')
axs[2].imshow(img2);axs[2].set_title('contrast');axs[2].axis('off')
axs[3].imshow(img3);axs[3].set_title('saturation');axs[3].axis('off')
axs[4].imshow(img4);axs[4].set_title('hue');axs[4].axis('off')
plt.show()
实图演示: