diff --git a/utils.py b/utils.py index f9e0d6a..fdab317 100644 --- a/utils.py +++ b/utils.py @@ -97,7 +97,7 @@ def random_shadow(image): # as x2 == x1 causes zero-division problem, we'll write it in the below form: # (ym-y1)*(x2-x1) - (y2-y1)*(xm-x1) > 0 mask = np.zeros_like(image[:, :, 1]) - mask[(ym - y1) * (x2 - x1) - (y2 - y1) * (xm - x1) > 0] = 1 + mask[np.where((ym - y1) * (x2 - x1) - (y2 - y1) * (xm - x1) > 0)] = 1 # choose which side should have shadow and adjust saturation cond = mask == np.random.randint(2)