We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bb30e09 commit a401eb1Copy full SHA for a401eb1
1 file changed
Face-Detection/v3/face_detect3.py
@@ -12,13 +12,13 @@ def detect():
12
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
13
14
face = face_cascade.detectMultiScale(gray, 1.1, 4)
15
- a=str(len(face))
+ a=len(face)
16
font = cv2.FONT_HERSHEY_SIMPLEX
17
- if int(a)==1:
18
- cv2.putText(img,a+"face detected",(15,350), font, 2,(255,0,0),2,cv2.LINE_AA)
+ if a<=1:
+ cv2.putText(img,str(a)+"face detected",(15,350), font, 2,(255,0,0),2,cv2.LINE_AA)
19
else:
20
- cv2.putText(img,a+"faces detected",(15,350), font, 2,(255,0,0),2,cv2.LINE_AA)
21
-
+ cv2.putText(img,str(a)+"faces detected",(15,350), font, 2,(255,0,0),2,cv2.LINE_AA)
+
22
for (x, y, w, h) in face:
23
cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), 2)
24
@@ -28,7 +28,6 @@ def detect():
28
break
29
30
cap.release()
31
- cv2.destroyAllWindows()
32
33
34
detect()
0 commit comments