回答編集履歴
2
さりげなく差し替え
test
CHANGED
@@ -30,12 +30,12 @@
|
|
30
30
|
|
31
31
|
>>>
|
32
32
|
|
33
|
-
>>> img.he
|
33
|
+
>>> img.shape
|
34
34
|
|
35
35
|
Traceback (most recent call last):
|
36
36
|
|
37
37
|
File "<stdin>", line 1, in <module>
|
38
38
|
|
39
|
-
AttributeError: 'NoneType' object has no attribute 'he
|
39
|
+
AttributeError: 'NoneType' object has no attribute 'shape'
|
40
40
|
|
41
41
|
```
|
1
追記
test
CHANGED
@@ -3,3 +3,39 @@
|
|
3
3
|
まずはcv2.imreadの引数を絶対パスにして試してみてください。
|
4
4
|
|
5
5
|
それで改善するなら、ファイルの配置が良くないということです。
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
実験コード
|
10
|
+
|
11
|
+
---
|
12
|
+
|
13
|
+
```Python
|
14
|
+
|
15
|
+
>>> import cv2
|
16
|
+
|
17
|
+
>>>
|
18
|
+
|
19
|
+
>>> # もちろん開けないが、エラーにはならない
|
20
|
+
|
21
|
+
... img = cv2.imread('hogehoge')
|
22
|
+
|
23
|
+
>>>
|
24
|
+
|
25
|
+
>>> # 中身は空っぽ
|
26
|
+
|
27
|
+
... print(img)
|
28
|
+
|
29
|
+
None
|
30
|
+
|
31
|
+
>>>
|
32
|
+
|
33
|
+
>>> img.height
|
34
|
+
|
35
|
+
Traceback (most recent call last):
|
36
|
+
|
37
|
+
File "<stdin>", line 1, in <module>
|
38
|
+
|
39
|
+
AttributeError: 'NoneType' object has no attribute 'height'
|
40
|
+
|
41
|
+
```
|