質問編集履歴
1
編集中ソースコードの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -12,4 +12,29 @@
|
|
12
12
|
3.
|
13
13
|
処理1.2をa0.png, a1.png ... a9.pngまで繰り返す。
|
14
14
|
|
15
|
-
様々なモジュール等で試してはいたのですが、ドツボにはまり、コードも若干冗長になってしまったので質問させていただいた次第です。アドバイス等お持ちの方がいらっしゃればよろしくお願いいたします。
|
15
|
+
様々なモジュール等で試してはいたのですが、ドツボにはまり、コードも若干冗長になってしまったので質問させていただいた次第です。アドバイス等お持ちの方がいらっしゃればよろしくお願いいたします。作成中コードは以下になります。
|
16
|
+
|
17
|
+
```Python
|
18
|
+
import os
|
19
|
+
import os.path
|
20
|
+
import cv2
|
21
|
+
|
22
|
+
ImageDir_Path = u"../ImageDir/"
|
23
|
+
Image_List = os.listdir(r'../Image_Dir/')
|
24
|
+
|
25
|
+
for Image_Name in Image_List:
|
26
|
+
if os.path.isfile(ImageDir_Path + Image_List):
|
27
|
+
|
28
|
+
Image = cv2.imread(ImageDir_Path + Image_List)
|
29
|
+
Text = open('../TextDir/*.txt')
|
30
|
+
|
31
|
+
if(filecmp.cmp(Image, Text, shallow=True) = True):
|
32
|
+
"
|
33
|
+
処理
|
34
|
+
"
|
35
|
+
np.save('../ImageDir1/a0_[%d].png' % i,処理結果) # i = 0,1~9
|
36
|
+
|
37
|
+
else:
|
38
|
+
print("エラー")
|
39
|
+
|
40
|
+
```
|