update (cv.BasicFaceRecognizer) - MATLAB File Help |
Updates a FaceRecognizer with given data and associated labels
obj.update(src, labels)
This method updates a (probably trained) FaceRecognizer, but only if the algorithm supports it. The Local Binary Patterns Histograms (LBPH) recognizer (see cv.LBPHFaceRecognizer) can be updated. For the Eigenfaces and Fisherfaces method, this is algorithmically not possible and you have to re-estimate the model with cv.BasicFaceRecognizer.train. In any case, a call to train empties the existing model and learns a new model, while update does not delete any model data.
% Create a new LBPH model (it can be updated) and use the
% default parameters, this is the most common usage of this
% specific FaceRecognizer:
model = cv.LBPHFaceRecognizer();
% This is the common interface to train all of the available
% FaceRecognizer implementations:
model.train(images, labels);
% Some containers to hold new image.
% You should add some images to the containers:
newImages = {..};
newLabels = [..];
% Now updating the model is as easy as calling:
model.update(newImages,newLabels);
% This will preserve the old model data and extend the
% existing model with the new features extracted from
% newImages!
Calling update on an Eigenfaces model (see cv.BasicFaceRecognizer), which doesn't support updating, will throw an error similar to:
OpenCV Error: The function/feature is not implemented (This
FaceRecognizer (FaceRecognizer.Eigenfaces) does not support
updating, you have to use FaceRecognizer::train to update it.)
NOTE: The FaceRecognizer does not store your training images, because this would be very memory intense and it's not the responsibility of te FaceRecognizer to do so. The caller is responsible for maintaining the dataset, he want to work with.
Access | public |
Sealed | false |
Static | false |