From 69396c78e88b68cb9f1546c81817c5171d5e318b Mon Sep 17 00:00:00 2001 From: Jamil Zakirov Date: Fri, 14 Jun 2024 22:49:18 +0300 Subject: [PATCH] Raise error if white light temperature is not included --- albumentations/augmentations/transforms.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/albumentations/augmentations/transforms.py b/albumentations/augmentations/transforms.py index c3f0d9d44..f24584761 100644 --- a/albumentations/augmentations/transforms.py +++ b/albumentations/augmentations/transforms.py @@ -3463,9 +3463,9 @@ class PlanckianJitter(ImageOnlyTransform): changes in the scene. Args: - mode: 'blackbody' or 'CIED'. + mode: 'blackbody' or 'cied'. temperature_limit: Temperature range to sample from. Should be in range [3000K, 15000K] for `blackbody` - and [4000K, 15000K] for 'CIED' mode. Higher temperatures produce cooler (bluish) images. + and [4000K, 15000K] for 'cied' mode. Higher temperatures produce cooler (bluish) images. Targets: image @@ -3498,6 +3498,11 @@ def __init__( if min(temperature_limit) < min_cied_temperature or max(temperature_limit) > max_cied_temperature: raise ValueError("Temperature limits for CIED should be in [4000, 15000] range") + # Make sure "white" color temperature (6000K) is always included + white_temperature = 6_000 + if temperature_limit[0] > white_temperature or temperature_limit[1] < white_temperature: + raise ValueError("Temperature limits should include 'white' light (6000K)") + self.mode = mode self.temperature_limit = temperature_limit self.sampling_method = sampling_method