diff --git a/augraphy/augmentations/noisetexturize.py b/augraphy/augmentations/noisetexturize.py index c3e96d2..69669c6 100644 --- a/augraphy/augmentations/noisetexturize.py +++ b/augraphy/augmentations/noisetexturize.py @@ -94,9 +94,14 @@ def __call__(self, image, layer=None, mask=None, keypoints=None, bounding_boxes= image, image_alpha = image[:, :, :3], image[:, :, 3] sigma = random.randint(self.sigma_range[0], self.sigma_range[1]) - turbulence = random.randint( - self.turbulence_range[0], - self.turbulence_range[1], + + # turbulence must > 1 to prevent endless while loop below + turbulence = max( + 2, + random.randint( + self.turbulence_range[0], + self.turbulence_range[1], + ), ) result = image.astype(float)