TIEVisionLibrary.createObjectsFinder
Declaration
function createObjectsFinder(): TIEVisionObjectsFinder; safecall;
Description
Create an object finder.
var
objectsFinder: TIEVisionObjectsFinder;
rects: TIEVisionVectorRect;
...
// 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();
Note: A shortcut method for this is available: FindObjects