TIEVisionObjectsFinder.addClassifier
Declaration
procedure addClassifier(name: PAnsiChar; classifier: TIEVisionBase); safecall;
Description
Add a new
classifier (object detector) to the classifiers set.
You can use the
built-in classifiers or load from file (e.g. that you created using
TIEVisionCascadeClassifierTrainer).
Note: Ensure you use a unique name for each classifier
Parameter | Description |
name | Name of the classifier. This name is used only for the user convenience |
classifier | Actual object detector |
// Find Faces in image
objectsFinder := IEVisionLib.createObjectsFinder();
objectsFinder.addClassifier('face detector 1', IEVisionLib.createCascadeClassifier(IEVC_FRONTAL_FACE_DEFAULT));
objectsFinder.addClassifier('face detector 2', IEVisionLib.createCascadeClassifier(IEVC_FRONTAL_FACE_ALT_TREE));
objectsFinder.addClassifier('face detector 3', IEVisionLib.createCascadeClassifier(IEVC_FRONTAL_FACE_ALT));
objectsFinder.addClassifier('face detector 4', IEVisionLib.createCascadeClassifier(IEVC_FRONTAL_FACE_ALT_2));
objectsFinder.addClassifier('face detector 5', IEVisionLib.createCascadeClassifier(IEVC_PROFILE_FACE));
objectsFinder.findIn(ImageEnView1.IEBitmap.GetIEVisionImage());
rects := objectsFinder.mergeAllRects(); // merge intersecting rectangles
// Draw rects to image
for i := 0 to rects.size() - 1 do
begin
r := rects.getRect(i);
with ImageEnView1.IEBitmap.Canvas do
begin
Pen.Width := 2;
Pen.Color := clRed;
Brush.Style := bsClear;
Rectangle( r.x, r.y, r.x + r.width, r.y + r.width );
end;
end;
ImageEnView1.Proc.TextOut( Align_Text_Near_Left, Align_Text_Near_Top, Format( 'Found: %d', [ rects.size ]), 'Arial', 12, Text_Color, [fsBold] );
ImageEnView1.Update();
See Also
◼createCascadeClassifier
◼removeClassifier
◼IEVision Embedded Classifiers