I just recognized some faces with cv2.createEigenFaceRecognizer.
But what I want is to know how much the input face looks like the calculated eigenfaces.
The idea is that you can rerecognize persons that are not in the database.
EDIT:
for example: I have face A, B and C trained on my model, then I see face C and D. I want to be able to differentiate face C from D.
thank you!
You can find a section on setting thresholds in the documentation on
cv::FaceRecognizerat:It works just the same for the OpenCV Python Wrapper, which you can easily see when calling
help(cv2.createFaceRecognizer)in Python:So in the code you would create the model with a threshold, I’ll set it to
100.0. Anything below this will yield-1in the prediction, which means this face isunknown:As shown in the demo, you can get the prediction and associated confidence (which is the distance to the nearest neighbor in the your training dataset) with:
So if you train your model on the subjects
A,B,CAND you are using a threshold, then a prediction forDshould yield-1, whileA,BorCshould be recognized. Given the fact, that you are using a threshold.As for adding new faces iteratively without re-estimating the whole model. This is not possible for the Eigenfaces or Fisherfaces method. You always have to call
FaceRecognizer::trainfor these two algorithms to learn the model. The Local Binary Patterns Histograms (LBPH) model, which you can create withcv2.createLBPHFaceRecognizer, supports updating a model without recalculating the other training samples. See the API Documentation on this: