回答編集履歴
1
d
test
CHANGED
@@ -1,21 +1,27 @@
|
|
1
1
|
```python
|
2
2
|
|
3
|
-
imp
|
3
|
+
def read_image(file_path):
|
4
4
|
|
5
|
-
i
|
5
|
+
import os
|
6
6
|
|
7
|
-
|
7
|
+
if not os.path.exists(file_path):
|
8
8
|
|
9
|
+
print('File not fould. {}'.format(file_path))
|
10
|
+
|
9
|
-
return
|
11
|
+
return
|
10
12
|
|
11
13
|
|
12
14
|
|
13
|
-
img = cv2.imread(file_path, cv2.IMREAD_COLOR)
|
15
|
+
img = cv2.imread(file_path, cv2.IMREAD_COLOR)
|
14
16
|
|
15
|
-
if img is None:
|
17
|
+
if img is None:
|
16
18
|
|
17
|
-
print('Failed to load image.')
|
19
|
+
print('Failed to load image.')
|
18
20
|
|
19
|
-
return
|
21
|
+
return
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
return cv2.resize(img, (ROWS, COLS), interpolation=cv2.INTER_CUBIC)
|
20
26
|
|
21
27
|
```
|