Update app.py
Browse files
app.py
CHANGED
@@ -16,8 +16,8 @@ def add_noise(image, password):
|
|
16 |
"""Add Gaussian noise to the image based on the password."""
|
17 |
seed = hash_password(password) % (2**32)
|
18 |
np.random.seed(seed)
|
19 |
-
mean = np.random.uniform(-0.
|
20 |
-
var = np.random.uniform(0.
|
21 |
noisy_image = random_noise(np.array(image), mode='gaussian', mean=mean, var=var, clip=True)
|
22 |
noisy_image = (255 * noisy_image).astype(np.uint8) # Scale back to 0-255
|
23 |
return Image.fromarray(noisy_image)
|
|
|
16 |
"""Add Gaussian noise to the image based on the password."""
|
17 |
seed = hash_password(password) % (2**32)
|
18 |
np.random.seed(seed)
|
19 |
+
mean = np.random.uniform(-0.001, 0.1) # Wider range for mean
|
20 |
+
var = np.random.uniform(0.0005, 0.1) # Higher variance for stronger noise
|
21 |
noisy_image = random_noise(np.array(image), mode='gaussian', mean=mean, var=var, clip=True)
|
22 |
noisy_image = (255 * noisy_image).astype(np.uint8) # Scale back to 0-255
|
23 |
return Image.fromarray(noisy_image)
|