Hey. I do not have static photos, I want to train the model dynamically. So I need a method update.
In the original opencv_contrib, this method is present:
https://github.com/kyamagu/mexopencv/blob/master/opencv_contrib/%2Bcv/LBPHFaceRecognizer.m#L306
const lbph = new cv.LBPHFaceRecognizer()
lbph.update([resizeFaceImage], [0])
TypeError: lbph.update is not a function
I need something like that from face-recognition.js, only from the opencv4node.js package
fs.writeFileSync(trainedModelFilePath, JSON.stringify(recognizer.serialize()));
If I understand, then I need:
const faceImage = getFaceImage(grayImage) // new image to train
const lbph = new cv.LBPHFaceRecognizer();
lbph.load(trainedModelFilePath); // trainedModelFilePath -> path to "model.yml"
lbph.update([faceImage], [5]); // 5 - exists Id in model.yml (I want to add a new face)
lbph.save(trainedModelFilePath);
TypeError: lbph.update is not a function
The binding for lbph.update is not implemented currently. Load and save should work.
Just ran into this same issue here. You've got a +1 from me on this request! I need to have the ability to load an LBPH model, add training data, and save it. Loading the model and doing a .train overwrites rather than updates. :(
Most helpful comment
The binding for
lbph.updateis not implemented currently. Load and save should work.