回答編集履歴

1

追記

2017/10/26 07:43

投稿

LouiS0616
LouiS0616

スコア35660

test CHANGED
@@ -1,3 +1,35 @@
1
1
  おそらくimreadに失敗しています。
2
2
 
3
3
  画像が正しいパスに存在するか確かめてください。
4
+
5
+ ```Python
6
+
7
+ >>> import cv2
8
+
9
+ >>>
10
+
11
+ >>> img1 = cv2.imread('UshiThunder.png')
12
+
13
+ >>> img1.shape
14
+
15
+ (442, 736, 3)
16
+
17
+ >>>
18
+
19
+ >>> img2 = cv2.imread('hogehoge') # 存在しないものは開けない
20
+
21
+ >>> img2.shape
22
+
23
+ Traceback (most recent call last):
24
+
25
+ File "<stdin>", line 1, in <module>
26
+
27
+ AttributeError: 'NoneType' object has no attribute 'shape'
28
+
29
+ >>>
30
+
31
+ >>> img2 is None
32
+
33
+ True
34
+
35
+ ```