February 2020
Intermediate to advanced
372 pages
9h 26m
English
Now that we have an array of training images and an array of their labels, we can create and train a face recognizer with just two more lines of code:
model = cv2.face.EigenFaceRecognizer_create()model.train(training_images, training_labels)
What have we done here? We created the Eigenfaces face recognizer with OpenCV's cv2.EigenFaceRecognizer_create function, and we trained the recognizer by passing the arrays of images and labels (numeric IDs). Optionally, we could have passed two arguments to cv2.EigenFaceRecognizer_create: