Randomly jitter brightness/contrast/saturation/hue in random order. Separate _range per effect. Strong color augmentation for classification and detection.
This transform is similar to torchvision's ColorJitter but with some differences due to the use of OpenCV instead of Pillow. The main differences are:
These differences may result in slightly different output compared to torchvision's ColorJitter.
brightness_rangeRange for the brightness factor, sampled per image. Both ends should be non-negative. Default: (0.8, 1.2)
contrast_rangeRange for the contrast factor, sampled per image. Both ends should be non-negative. Default: (0.8, 1.2)
saturation_rangeRange for the saturation factor, sampled per image. Both ends should be non-negative. Default: (0.8, 1.2)
hue_rangeRange for the hue factor, sampled per image. Values should be in [-0.5, 0.5]. Default: (-0.5, 0.5)
p (float): Probability of applying the transform. Should be in the range [0, 1]. Default: 0.5
>>> import numpy as np
>>> import albumentations as A
>>> image = np.random.randint(0, 256, (100, 100, 3), dtype=np.uint8)
>>> transform = A.ColorJitter(
... brightness_range=(0.8, 1.2),
... contrast_range=(0.8, 1.2),
... saturation_range=(0.8, 1.2),
... hue_range=(-0.1, 0.1),
... p=1.0,
... )
>>> result = transform(image=image)
>>> jittered_image = result['image']