Simulate color temperature variation via Planckian locus jitter. mode and magnitude control the shift. Good for robustness to different light sources.
This transform adjusts the color of an image to mimic the effect of different color temperatures of light sources, based on Planck's law of black body radiation. It can simulate the appearance of an image under various lighting conditions, from warm (reddish) to cool (bluish) color casts.
PlanckianJitter vs. ColorJitter: PlanckianJitter is fundamentally different from ColorJitter in its approach and use cases:
When to use PlanckianJitter:
The logic behind PlanckianJitter: As the color temperature increases:
modeThe mode of the transformation.
temperature_limitThe range of color temperatures (in Kelvin) to sample from.
sampling_methodMethod to sample the temperature.
pProbability of applying the transform. 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.PlanckianJitter(mode="blackbody",
... temperature_range=(3000, 9000),
... sampling_method="uniform",
... p=1.0)
>>> result = transform(image=image)
>>> jittered_image = result["image"]