solarize¶
- torchvision.transforms.functional.solarize(img: Tensor, threshold: float) Tensor [source]¶
通过反转高于阈值的所有像素值来对 RGB/灰度图像进行曝光。 (Solarize an RGB/grayscale image by inverting all pixel values above a threshold.)
- 参数:
img (PIL Image 或 Tensor) – 要反转颜色的图像。如果 img 是 torch Tensor,则应为 [..., 1 或 3, H, W] 格式,其中 ... 表示它可以具有任意数量的前导维度。如果 img 是 PIL Image,则应为“L”或“RGB”模式。
threshold (float) – 所有等于或高于此值的所有像素都将被反转。
- 返回:
曝光的图像。
- 返回类型:
PIL 图像或张量
使用
solarize
的示例