Vehicle-Anti-Theft-Face-Rec.../Facial_Recognition_Registration.py

33 lines
474 B
Python
Raw Normal View History

2020-11-08 21:57:59 +00:00
import sys
import os
import math
import cv2
2020-11-08 22:44:15 +00:00
label = "Feier_Zhang"
num_cap = 20
2020-11-08 21:57:59 +00:00
path = sys.path[0]+'/Facial_images/face_rec/train/'+label
folder = os.path.exists(path)
if not folder:
os.makedirs(path)
cap = cv2.VideoCapture(1)
c=0
while(c < num_cap):
ret, frame = cap.read()
cv2.imshow("capture", frame)
cv2.imwrite(path+'/'+str(c) + '.jpg', frame)
c=c+1
cv2.waitKey(500)
cap.release()
cv2.destroyAllWindows()