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

40 lines
729 B
Python
Raw Permalink Normal View History

2021-02-04 22:41:59 +00:00
import sys
import os
import math
import cv2
def register_your_face(label):
2021-04-10 22:44:45 +00:00
num_cap = 10
2021-02-04 22:41:59 +00:00
path = sys.path[0] + '/Photos_of_Thieves/' + label
folder = os.path.exists(path)
if not folder:
os.makedirs(path)
cap = cv2.VideoCapture(0)
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()
if __name__ == "__main__":
print("Face registration start...")
print()
label = input('Pleas enter your Name/Label: ')
register_your_face(label)
print("Data is successfully saved.")
print()