Spaces:
Runtime error
Runtime error
Update utils8.py
Browse files
utils8.py
CHANGED
|
@@ -109,6 +109,7 @@ def anim_frame_warp_2d(prev_img, args, border_mode_str):
|
|
| 109 |
def add_noise(img, noise_amt):
|
| 110 |
if noise_amt <= 0: return img
|
| 111 |
img_np = np.array(img).astype(np.float32)
|
|
|
|
| 112 |
noise = np.random.normal(0, noise_amt * 255, img_np.shape).astype(np.float32)
|
| 113 |
noisy = np.clip(img_np + noise, 0, 255).astype(np.uint8)
|
| 114 |
return Image.fromarray(noisy)
|
|
|
|
| 109 |
def add_noise(img, noise_amt):
|
| 110 |
if noise_amt <= 0: return img
|
| 111 |
img_np = np.array(img).astype(np.float32)
|
| 112 |
+
# np.random.normal will use the seed set in the engine loop
|
| 113 |
noise = np.random.normal(0, noise_amt * 255, img_np.shape).astype(np.float32)
|
| 114 |
noisy = np.clip(img_np + noise, 0, 255).astype(np.uint8)
|
| 115 |
return Image.fromarray(noisy)
|