ImageEn, unit ievision

TIEVisionObjectsFinder


Declaration

TIEVisionObjectsFinder = interface(TIEVisionBase)


Description

An interface to find an object or a set of different objects.
It is possible to load more than one classifier (object detector). Each classifier is executed on a different thread.




Demos

Demo  Demos\IEVision\FaceDetection\FaceDetection.dpr
Demo  Demos\IEVision\GetFaces\GetFaces.dpr
Demo  Demos\IEVision\GetWithClassifier\GetMisc.dpr
Demo  Demos\IEVision\NumberPlateBlurring\GetPlate.dpr


Example

var
  objectsFinder: TIEVisionObjectsFinder;
  rects: TIEVisionVectorRect;
...
// load two face detectors
objectsFinder := IEVisionLib.createObjectsFinder();
objectsFinder.addClassifier('face detector 1', IEVisionLib.createCascadeClassifier(IEVC_FRONTAL_FACE_ALT_TREE));
objectsFinder.addClassifier('face detector 2', IEVisionLib.createCascadeClassifier(IEVC_FRONTAL_FACE_DEFAULT));

// detect objects
objectsFinder.findIn(ImageEnView1.IEBitmap.GetIEVisionImage());

// merge intersecting rectangles of all searched objects
rects := objectsFinder.mergeAllRects();

// Draw rects to image
for i := 0 to rects.size() - 1 do
begin
  with rects.getRect(i) do
  begin
    with ImageEnView1.IEBitmap.Canvas do
    begin
      Pen.Width := 2;
      Pen.Color := clRed;
      Rect( x, y, x + width, y + width );
    end;
  end;
end;
ImageEnView1.Proc.TextOut( Align_Text_Near_Left, Align_Text_Near_Top, Format( 'Found: %d', [ lines.size ]), 'Arial', 12, clYellow, [fsBold] );
ImageEnView1.Update();


Methods and Properties

Public Method  addClassifier
Public Method  classifierExists
Public Method  findIn
Public Method  getClassifier
Public Method  getFoundRect
Public Method  getFoundRectCount
Public Method  mergeAllRects
Public Method  mergeRects
Public Method  removeAllClassifiers
Public Method  removeClassifier
Public Method  setDivisor
Public Method  setEqualizeHistogram
Public Method  setHaarFlags
Public Method  setHaarMinNeighbors
Public Method  setHaarMaxSize
Public Method  setHaarMinSize
Public Method  setHaarScaleFactor


See Also

createObjectsFinder
IEVision Embedded Classifiers