adjust_contrast¶
- torchvision.transforms.functional.adjust_contrast(img: Tensor, contrast_factor: float) Tensor [源代码]¶
调整图像的对比度。
- 参数:
img (PIL Image 或 Tensor) – 要调整的图像。如果 img 是 torch Tensor,则预期格式为 […, 1 或 3, H, W],其中 … 表示它可以有任意数量的前导维度。
contrast_factor (float) – 对比度的调整量。可以是任何非负数。0 表示全灰图像,1 表示原始图像,而 2 表示将对比度增加一倍。
- 返回:
对比度调整后的图像。
- 返回类型:
PIL Image 或 Tensor