adjust_gamma
- torchvision.transforms.functional.adjust_gamma(img: Tensor, gamma: float, gain: float = 1) Tensor [source]
Perform gamma correction on an image.
Also known as Power Law Transform. Intensities in RGB mode are adjusted based on the following equation:
See Gamma Correction for more details.
- Parameters:
img (PIL Image or Tensor) – PIL Image to be adjusted. If img is torch Tensor, it is expected to be in […, 1 or 3, H, W] format, where … means it can have an arbitrary number of leading dimensions. If img is PIL Image, modes with transparency (alpha channel) are not supported.
gamma (float) – Non negative real number, same as
in the equation. gamma larger than 1 make the shadows darker, while gamma smaller than 1 make dark regions lighter.gain (float) – The constant multiplier.
- Returns:
Gamma correction adjusted image.
- Return type:
PIL Image or Tensor