-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvid.py
More file actions
30 lines (25 loc) · 759 Bytes
/
vid.py
File metadata and controls
30 lines (25 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import cv2
face_cascade = cv2.CascadeClassifier(r"/home/aiktc/Desktop/u/haarcascade_frontalface_default.xml")
video=cv2.VideoCapture(r"/home/aiktc/Desktop/faceDetection.mp4")
#print(type(video))
check,frame=video.read()
while(check==True):
check,frame=video.read()
#frame_count+=1
img=frame.copy()
grey=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
face=face_cascade.detectMultiScale(grey,
scaleFactor=1.25,
minNeighbors=14)
for x,y ,w, h in face:
frame=cv2.rectangle(img,(x,y),(x+w,y+w),(255,0,0),3)
cv2.imshow("face detector ",frame)
print(type(face))
print(face)
cv2.imshow("first",frame)
key=cv2.waitKey(1)
if(key==ord('q')):
break
cv2.destroyAllWIndows()
#print(video)
video.release()