TIEVisionFaceRecognizer.train
Declaration
procedure train(update: bool32 = false); safecall;
Description
Start facial recognition training.
Applications need to call
addTrainImage before.
At the end it is possible to call
detect or
save.
Parameter | Description |
update | If true and supported by the algorithm (Local Binary Patterns Histograms (LBPH) only), this updates instead of re-training the recognizer |
// Train our dataset with faces from a multibitmap (where the name associated with each face has been stored in the image dictionary as "Name")
m_faceRecognizer.clear();
for i := 0 to m_faces.Count - 1 do
m_faceRecognizer.addTrainImage(mbitmap.GetTIEBitmap(i).GetIEVisionImage(), // Face image
PWideChar( mbitmap.ImageDictionary[i].GetString('Name') )); // Face name or label
if m_faces.Count > 0 then
m_faceRecognizer.train();
lblDBSize.Caption := format( 'Face DB Size: %d', [ m_faces.Count ]);