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

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +108 -100
README.md CHANGED
@@ -40,115 +40,123 @@ 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
-
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
59
- | ASCII Value | Character |
60
- |-------------|-----------|
61
- | 33 | ! |
62
- | 34 | " |
63
- | 35 | # |
64
- | 36 | $ |
65
- | 37 | % |
66
- | 38 | & |
67
- | 39 | ' |
68
- | 40 | ( |
69
- | 41 | ) |
70
- | 42 | * |
71
- | 43 | + |
72
- | 44 | , |
73
- | 45 | - |
74
- | 46 | . |
75
- | 47 | / |
76
- | 48 | 0 |
77
- | 49 | 1 |
78
- | 50 | 2 |
79
- | 51 | 3 |
80
- | 52 | 4 |
81
- | 53 | 5 |
82
- | 54 | 6 |
83
- | 55 | 7 |
84
- | 56 | 8 |
85
- | 57 | 9 |
86
- | 58 | : |
87
- | 59 | ; |
88
- | 60 | < |
89
- | 61 | = |
90
- | 62 | > |
91
- | 63 | ? |
92
- | 64 | @ |
93
- | 65 | A |
94
- | 66 | B |
95
- | 67 | C |
96
- | 68 | D |
97
- | 69 | E |
98
- | 70 | F |
99
- | 71 | G |
100
- | 72 | H |
101
- | 73 | I |
102
- | 74 | J |
103
- | 75 | K |
104
- | 76 | L |
105
- | 77 | M |
106
- | 78 | N |
107
- | 79 | O |
108
- | 80 | P |
109
- | 81 | Q |
110
- | 82 | R |
111
- | 83 | S |
112
- | 84 | T |
113
- | 85 | U |
114
- | 86 | V |
115
- | 87 | W |
116
- | 88 | X |
117
- | 89 | Y |
118
- | 90 | Z |
119
- | 91 | [ |
120
- | 93 | ] |
121
- | 94 | ^ |
122
- | 95 | _ |
123
- | 96 | ` |
124
- | 97 | a |
125
- | 98 | b |
126
- | 99 | c |
127
- | 100 | d |
128
- | 101 | e |
129
- | 102 | f |
130
- | 103 | g |
131
- | 104 | h |
132
- | 105 | i |
133
- | 106 | j |
134
- | 107 | k |
135
- | 108 | l |
136
- | 109 | m |
137
- | 110 | n |
138
- | 111 | o |
139
- | 112 | p |
140
- | 113 | q |
141
- | 114 | r |
142
- | 115 | s |
143
- | 116 | t |
144
- | 117 | u |
145
- | 118 | v |
146
- | 119 | w |
147
- | 120 | x |
148
- | 121 | y |
149
- | 122 | z |
150
- | 123 | { |
151
- | 124 | \| |
152
- | 125 | } |
153
- | 126 | ~ |
154
- | 999 | null |
 
 
 
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 and Corresponding File Counts
65
+ | ASCII Value | Character | Number of Files |
66
+ |-------------|-----------|-----------------|
67
+ | 33 | ! | 207 |
68
+ | 34 | " | 267 |
69
+ | 35 | # | 152 |
70
+ | 36 | $ | 192 |
71
+ | 37 | % | 190 |
72
+ | 38 | & | 104 |
73
+ | 39 | ' | 276 |
74
+ | 40 | ( | 346 |
75
+ | 41 | ) | 359 |
76
+ | 42 | * | 128 |
77
+ | 43 | + | 146 |
78
+ | 44 | , | 320 |
79
+ | 45 | - | 447 |
80
+ | 46 | . | 486 |
81
+ | 47 | / | 259 |
82
+ | 48 | 0 | 2664 |
83
+ | 49 | 1 | 2791 |
84
+ | 50 | 2 | 2564 |
85
+ | 51 | 3 | 2671 |
86
+ | 52 | 4 | 2530 |
87
+ | 53 | 5 | 2343 |
88
+ | 54 | 6 | 2503 |
89
+ | 55 | 7 | 2679 |
90
+ | 56 | 8 | 2544 |
91
+ | 57 | 9 | 2617 |
92
+ | 58 | : | 287 |
93
+ | 59 | ; | 223 |
94
+ | 60 | < | 168 |
95
+ | 61 | = | 254 |
96
+ | 62 | > | 162 |
97
+ | 63 | ? | 194 |
98
+ | 64 | @ | 83 |
99
+ | 65 | A | 1923 |
100
+ | 66 | B | 1505 |
101
+ | 67 | C | 1644 |
102
+ | 68 | D | 1553 |
103
+ | 69 | E | 2171 |
104
+ | 70 | F | 1468 |
105
+ | 71 | G | 1443 |
106
+ | 72 | H | 1543 |
107
+ | 73 | I | 1888 |
108
+ | 74 | J | 1470 |
109
+ | 75 | K | 1504 |
110
+ | 76 | L | 1692 |
111
+ | 77 | M | 1484 |
112
+ | 78 | N | 1683 |
113
+ | 79 | O | 2097 |
114
+ | 80 | P | 1605 |
115
+ | 81 | Q | 1409 |
116
+ | 82 | R | 1811 |
117
+ | 83 | S | 1786 |
118
+ | 84 | T | 1729 |
119
+ | 85 | U | 1458 |
120
+ | 86 | V | 1405 |
121
+ | 87 | W | 1521 |
122
+ | 88 | X | 1366 |
123
+ | 89 | Y | 1456 |
124
+ | 90 | Z | 1451 |
125
+ | 91 | [
126
+
127
+ | 111 |
128
+ | 93 | ] | 104 |
129
+ | 94 | ^ | 88 |
130
+ | 95 | _ | 80 |
131
+ | 96 | ` | 42 |
132
+ | 97 | a | 2219 |
133
+ | 98 | b | 624 |
134
+ | 99 | c | 880 |
135
+ | 100 | d | 1074 |
136
+ | 101 | e | 2962 |
137
+ | 102 | f | 608 |
138
+ | 103 | g | 760 |
139
+ | 104 | h | 990 |
140
+ | 105 | i | 2035 |
141
+ | 106 | j | 427 |
142
+ | 107 | k | 557 |
143
+ | 108 | l | 1415 |
144
+ | 109 | m | 879 |
145
+ | 110 | n | 1906 |
146
+ | 111 | o | 2048 |
147
+ | 112 | p | 786 |
148
+ | 113 | q | 427 |
149
+ | 114 | r | 1708 |
150
+ | 115 | s | 1557 |
151
+ | 116 | t | 1781 |
152
+ | 117 | u | 1319 |
153
+ | 118 | v | 555 |
154
+ | 119 | w | 680 |
155
+ | 120 | x | 463 |
156
+ | 121 | y | 680 |
157
+ | 122 | z | 505 |
158
+ | 123 | { | 73 |
159
+ | 124 | \| | 91 |
160
+ | 125 | } | 77 |
161
+ | 126 | ~ | 59 |
162
+ | 999 | null | 4949 |