-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.py
38 lines (34 loc) · 838 Bytes
/
main.py
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
31
32
33
34
35
36
37
38
import cv2
import numpy as np
import face_detection.face_detection as face_detection
import os
import sys
def Image(path):
face_detector = face_detection.FaceDetector()
frame = cv2.imread(path)
annotated_frame = face_detector.draw(frame)
cv2.imshow('faces',annotated_frame)
cv2.waitKey(0)
def Video():
face_detector = face_detection.FaceDetector()
cap = cv2.VideoCapture(0)
while not cap.isOpened():
cap = cv2.VideoCapture(0)
cv2.waitKey(1000)
label = ''
cntr = 1
while True:
flag, frame = cap.read()
if flag:
frame = cv2.flip(frame,1)
annotated_frame = face_detector.draw(frame)
cv2.imshow('camera_feed',annotated_frame)
#cv2.imshow('input',frame[100:300,400:600])
else:
cv2.waitKey(1000)
k = cv2.waitKey(5)
if k == 27:
break
if __name__ == "__main__":
Video()
cv2.destroyAllWindows()