質問編集履歴
1
コードの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -19,8 +19,7 @@
|
|
19
19
|
|
20
20
|
files = sorted(glob.glob('./in/*.jpg'), key=natural_keys)
|
21
21
|
for i, f in enumerate(files):
|
22
|
-
|
23
|
-
|
22
|
+
#1枚目の画像読み込み
|
24
23
|
img_0 = cv2.imread(f, cv2.IMREAD_GRAYSCALE)
|
25
24
|
img_0 = img_0.astype(int)
|
26
25
|
#2枚目の画像読み込み
|
@@ -35,20 +34,26 @@
|
|
35
34
|
|
36
35
|
save_path = './bg2/_%d.jpg' %i
|
37
36
|
cv2.imwrite(save_path, img_sad)
|
37
|
+
|
38
38
|
コード
|
39
39
|
```
|
40
40
|
```
|
41
41
|
エラー
|
42
|
+
TypeError Traceback (most recent call last)
|
42
|
-
|
43
|
+
<ipython-input-22-a23488329142> in <module>
|
44
|
+
16 img_0 = img_0.astype(int)
|
43
|
-
|
45
|
+
17 #2枚目の画像読み込み
|
44
|
-
|
46
|
+
---> 18 F=f+1
|
47
|
+
19 img_1 = cv2.imread(F, cv2.IMREAD_GRAYSCALE)
|
45
|
-
|
48
|
+
20 img_1 = img_0.astype(int)
|
46
49
|
|
50
|
+
TypeError: must be str, not int
|
47
51
|
|
48
52
|
|
53
|
+
|
49
54
|
fの確認
|
50
55
|
print(f)
|
51
56
|
出力結果
|
52
|
-
./in\
|
57
|
+
./in\1.JPG
|
53
58
|
コード
|
54
59
|
```
|