Shortcuts

自动对比度

torchvision.transforms.functional.autocontrast(img: Tensor) Tensor[source]

通过重新映射每个通道的像素来最大化图像的对比度,使最暗的部分变为黑色,最亮的部分变为白色。

Parameters:

img (PIL ImageTensor) – 应用自动对比度的图像。 如果 img 是 torch Tensor,则期望其格式为 […, 1 或 3, H, W], 其中 … 表示它可以有任意数量的前导维度。 如果 img 是 PIL Image,则期望其模式为 “L” 或 “RGB”。

Returns:

一张自动对比度调整后的图片。

Return type:

PIL 图像或张量

使用 autocontrast 的示例:

变换的图示

Illustration of transforms