Skip to content

Commit

Permalink
Raise error if white light temperature is not included
Browse files Browse the repository at this point in the history
  • Loading branch information
zakajd committed Jun 14, 2024
1 parent 7571c18 commit 69396c7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions albumentations/augmentations/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 69396c7

Please sign in to comment.