Skip to content

Commit 5fc81f6

Browse files
authored
Update face-detect.py
1 parent f146173 commit 5fc81f6

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

Face-Detection/face-detect.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,16 @@ def detect():
1212
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
1313

1414
face = face_cascade.detectMultiScale(gray, 1.1, 4)
15-
a=str(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)
19-
else:
20-
cv2.putText(img,a+"faces detected",(15,350), font, 2,(255,0,0),2,cv2.LINE_AA)
2115

2216
for (x, y, w, h) in face:
2317
cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), 2)
2418

2519
cv2.imshow("Face Detect", img)
2620

27-
if cv2.waitKey(1) & 0xFF == ord('q'):# Press q to quit
21+
if cv2.waitKey(1) == 27:
2822
break
2923

3024
cap.release()
31-
cv2.destroyAllWindows()
3225

3326

3427
detect()

0 commit comments

Comments
 (0)