BrightnessTransform¶
- class paddle.vision.transforms. BrightnessTransform ( value, keys=None ) [source]
-
Adjust brightness of the image.
- Parameters
-
value (float) – How much to adjust the brightness. Can be any non negative number. 0 gives the original image.
keys (list[str]|tuple[str], optional) – Same as
BaseTransform
. Default: None.
- Shape:
-
img(PIL.Image|np.ndarray|Paddle.Tensor): The input image with shape (H x W x C).
output(PIL.Image|np.ndarray|Paddle.Tensor): An image with a transform in brightness.
- Returns
-
A callable object of BrightnessTransform.
Examples
>>> import numpy as np >>> from PIL import Image >>> from paddle.vision.transforms import BrightnessTransform >>> np.random.seed(2023) >>> transform = BrightnessTransform(0.4) >>> fake_img = Image.fromarray((np.random.rand(224, 224, 3) * 255.).astype(np.uint8)) >>> print(fake_img.load()[1,1]) (60, 169, 34) >>> >>> fake_img = transform(fake_img) >>> print(fake_img.load()[1,1]) (68, 192, 38)