Louis Rädisch commited on
Commit
12e4d4b
1 Parent(s): a7ad983

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +4 -12
README.md CHANGED
@@ -40,25 +40,19 @@ def generate_noisy_images(num_images, image_size=(28, 28), output_dir='NoisyImag
40
 
41
  for i in range(num_images):
42
  variation_scale = abs(np.random.normal(30, 15))
43
- # Generate random noise with reduced strength
44
  noise = np.random.rand(image_size[0], image_size[1]) * 0.05
45
  noise = (noise * 255).astype(np.uint8)
46
 
47
- # Create a PIL image from the noise
48
- image = Image.fromarray(noise, mode='L') # 'L' for grayscale
49
 
50
- # Invert the image
51
  inverted_image = ImageOps.invert(image)
52
 
53
- # Enhance the contrast with increased amplitude
54
  enhancer = ImageEnhance.Contrast(inverted_image)
55
- contrast_enhanced_image = enhancer.enhance(variation_scale) # Increased amplitude (e.g., 3.0)
56
 
57
- # Save the image
58
  contrast_enhanced_image.save(os.path.join(output_dir, f'{i}.jpg'), format=image_format)
59
 
60
- # Generate 5000 noisy images
61
- generate_noisy_images(5000)
62
  ```
63
 
64
  ## ASCII Table
@@ -157,6 +151,4 @@ generate_noisy_images(5000)
157
  | 124 | \| |
158
  | 125 | } |
159
  | 126 | ~ |
160
- | 999 | null
161
-
162
- |
 
40
 
41
  for i in range(num_images):
42
  variation_scale = abs(np.random.normal(30, 15))
43
+
44
  noise = np.random.rand(image_size[0], image_size[1]) * 0.05
45
  noise = (noise * 255).astype(np.uint8)
46
 
47
+ image = Image.fromarray(noise, mode='L')
 
48
 
 
49
  inverted_image = ImageOps.invert(image)
50
 
 
51
  enhancer = ImageEnhance.Contrast(inverted_image)
52
+ contrast_enhanced_image = enhancer.enhance(variation_scale)
53
 
 
54
  contrast_enhanced_image.save(os.path.join(output_dir, f'{i}.jpg'), format=image_format)
55
 
 
 
56
  ```
57
 
58
  ## ASCII Table
 
151
  | 124 | \| |
152
  | 125 | } |
153
  | 126 | ~ |
154
+ | 999 | null |