質問編集履歴

1

書式の変更

2020/07/27 05:17

投稿

da_123
da_123

スコア3

test CHANGED
File without changes
test CHANGED
@@ -4,9 +4,13 @@
4
4
 
5
5
  ### 発生している問題・エラーメッセージ
6
6
 
7
+ ```python
8
+
7
- (-215:Assertion failed) !empty() in function 'cv::CascadeClassifier::detectMultiScale'
9
+ error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
10
+
11
+
12
+
8
-
13
+ ```
9
-
10
14
 
11
15
 
12
16
 
@@ -16,18 +20,24 @@
16
20
 
17
21
 
18
22
 
23
+ ```python
24
+
19
- gray = cv2.cvtColor(rgb, cv2.COLOR_RGB2GRAY)
25
+ gray = cv2.cvtColor(rgb, cv2.COLOR_RGB2GRAY)
20
26
 
21
27
  faces = face_cascade.detectMultiScale(
22
28
 
23
- gray, scaleFactor=1.11, minNeighbors=3, minSize=(100, 100))
29
+ gray, scaleFactor=1.11, minNeighbors=3, minSize=(100, 100))
30
+
31
+
32
+
24
-
33
+ ```
25
-
26
34
 
27
35
  ### 全体のソースコード
28
36
 
29
37
 
30
38
 
39
+ ```python
40
+
31
41
  import os,sys
32
42
 
33
43
  import cv2
@@ -40,9 +50,13 @@
40
50
 
41
51
 
42
52
 
53
+
54
+
55
+
56
+
43
57
  cap = cv2.VideoCapture(0)
44
58
 
45
- face_cascade = cv2.CascadeClassifier('Users/User/Documents/eye/opencv-master/data/haarcascadeshaarcascade_frontalface_alt2.xml')
59
+ face_cascade = cv2.CascadeClassifier('Users/User/Documents/eye/opencv-4.2.0/data/haarcascades/haarcascade_frontalface_alt2.xml')
46
60
 
47
61
  face_parts_detector = dlib.shape_predictor('shape_predictor_68_face_landmarks.dat')
48
62
 
@@ -84,7 +98,7 @@
84
98
 
85
99
  faces = face_cascade.detectMultiScale(
86
100
 
87
- gray, scaleFactor=1.11, minNeighbors=3, minSize=(100, 100))
101
+ gray, scaleFactor=1.11, minNeighbors=3, minSize=(100, 100))
88
102
 
89
103
 
90
104
 
@@ -142,7 +156,7 @@
142
156
 
143
157
  if (left_eye_ear + right_eye_ear) < 0.55:
144
158
 
145
- cv2.putText(rgb,"Sleepy eyes. Wake up!",
159
+ cv2.putText(rgb,"close",
146
160
 
147
161
  (10,180), cv2.FONT_HERSHEY_PLAIN, 3, (0,0,255), 3, 1)
148
162
 
@@ -172,7 +186,7 @@
172
186
 
173
187
  cv2.destroyAllWindows()
174
188
 
175
-
189
+ ```
176
190
 
177
191
  ### 試したこと
178
192