回答編集履歴
1
修正
test
CHANGED
@@ -1,15 +1,47 @@
|
|
1
1
|
```
|
2
2
|
|
3
|
+
import cv2
|
4
|
+
|
5
|
+
import numpy as np
|
6
|
+
|
7
|
+
import glob
|
8
|
+
|
9
|
+
import os
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
path = "user/../ocr/test_data"
|
14
|
+
|
15
|
+
file = os.listdir(path)
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
files_file = [im_n for im_n in file if os.path.isfile(os.path.join(path, im_n))]
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
print(files_file)
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
for im_n in files_file:
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
img = cv2.imread(im_n)
|
32
|
+
|
33
|
+
mark = np.zeros_like(img)
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
mark = cv2.putText(cv2.UMat(mark), 'ABCDEF', (50, 300), cv2.FONT_HERSHEY_SIMPLEX, 2.0, (255, 255, 255), 5, cv2.LINE_AA)
|
38
|
+
|
39
|
+
new_img = cv2.addWeighted(img, 1, mark, 0.3, 0)
|
40
|
+
|
3
|
-
cv2.imwrite('user/../ocr/output/im_n
|
41
|
+
cv2.imwrite('user/../ocr/output/' + im_n, new_img)
|
4
42
|
|
5
43
|
```
|
6
44
|
|
7
|
-
を
|
8
45
|
|
9
|
-
```
|
10
|
-
|
11
|
-
cv2.imwrite(f'user/../ocr/output/{im_n}.jpeg',new_img)
|
12
|
-
|
13
|
-
```
|
14
46
|
|
15
47
|
とした場合どうでしょうか?
|