Skip to content

Commit 1bbb631

Browse files
authored
My files
1 parent f3bf945 commit 1bbb631

19 files changed

+357076
-0
lines changed

Open Cv/Face Detect/completed.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import cv2
2+
3+
cascade_classifier = cv2.CascadeClassifier('haarcascades/haarcascade_eye.xml')
4+
cap = cv2.VideoCapture(0)
5+
6+
while True:
7+
# Capture frame-by-frame
8+
ret, frame = cap.read()
9+
# Our operations on the frame come here
10+
gray = cv2.cvtColor(frame, 0)
11+
detections = cascade_classifier.detectMultiScale(gray,scaleFactor=1.3,minNeighbors=5)
12+
if(len(detections) > 0):
13+
(x,y,w,h) = detections[0]
14+
frame = cv2.rectangle(frame,(x,y),(x+w,y+h),(255,0,0),2)
15+
16+
# for (x,y,w,h) in detections:
17+
# frame = cv2.rectangle(frame,(x,y),(x+w,y+h),(255,0,0),2)
18+
19+
# Display the resulting frame
20+
cv2.imshow('frame',frame)
21+
if cv2.waitKey(1) & 0xFF == ord('q'):
22+
break
23+
24+
# When everything done, release the capture
25+
cap.release()
26+
cv2.destroyAllWindows()

0 commit comments

Comments
 (0)