Integrate face registration and enrollment
This commit is contained in:
parent
2d1ee72eb7
commit
4d0d442ab6
5 changed files with 54 additions and 51 deletions
|
@ -9,6 +9,7 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import _pickle as cPickle # Python3.
|
import _pickle as cPickle # Python3.
|
||||||
|
|
||||||
|
def enroll_face_dataset():
|
||||||
pwd = sys.path[0]
|
pwd = sys.path[0]
|
||||||
PREDICTOR_PATH = pwd + '/Facial_models/shape_predictor_68_face_landmarks.dat'
|
PREDICTOR_PATH = pwd + '/Facial_models/shape_predictor_68_face_landmarks.dat'
|
||||||
FACE_RECOGNITION_MODEL_PATH = pwd + '/Facial_models/dlib_face_recognition_resnet_model_v1.dat'
|
FACE_RECOGNITION_MODEL_PATH = pwd + '/Facial_models/dlib_face_recognition_resnet_model_v1.dat'
|
||||||
|
|
|
@ -2,10 +2,11 @@ import sys
|
||||||
import os
|
import os
|
||||||
import math
|
import math
|
||||||
import cv2
|
import cv2
|
||||||
|
import Facial_Recognition_Enrollment
|
||||||
|
|
||||||
|
|
||||||
def register_your_face(label):
|
def register_your_face(label):
|
||||||
num_cap = 60
|
num_cap = 50
|
||||||
|
|
||||||
path = sys.path[0] + '/Facial_images/face_rec/train/' + label
|
path = sys.path[0] + '/Facial_images/face_rec/train/' + label
|
||||||
|
|
||||||
|
@ -14,7 +15,7 @@ def register_your_face(label):
|
||||||
if not folder:
|
if not folder:
|
||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
|
|
||||||
cap = cv2.VideoCapture(0)
|
cap = cv2.VideoCapture(1)
|
||||||
c = 0
|
c = 0
|
||||||
while c < num_cap:
|
while c < num_cap:
|
||||||
ret, frame = cap.read()
|
ret, frame = cap.read()
|
||||||
|
@ -33,3 +34,4 @@ def register_your_face(label):
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
label = input('Enter a label: ')
|
label = input('Enter a label: ')
|
||||||
register_your_face(label)
|
register_your_face(label)
|
||||||
|
Facial_Recognition_Enrollment.enroll_face_dataset()
|
||||||
|
|
Binary file not shown.
Binary file not shown.
BIN
__pycache__/Facial_Recognition_Enrollment.cpython-38.pyc
Normal file
BIN
__pycache__/Facial_Recognition_Enrollment.cpython-38.pyc
Normal file
Binary file not shown.
Loading…
Reference in a new issue