from torchvision import transforms
import cv2 as cv
from PIL import Image
import matplotlib.pyplot as plt
rgb = Image.open("path")
rgb_transform = transforms.Compose([
transforms.ColorJitter(
brightness=0.25,
contrast=0.45,
saturation=0.3,
hue=0.45),
transforms.ToTensor(),
transforms.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]),
])
rgb = rgb_transform(rgb)
plt.figure("dog")
plt.imshow(rgb.permute(1, 2, 0))
plt.show()
改变rgb图像的brightness,contrast,saturation,hue
最新推荐文章于 2023-03-16 11:19:53 发布