ImageEn, unit ievision

TIEVisionVectorRect


Declaration

TIEVisionVectorRect = interface(TIEVisionBaseVector)


Description

An object that exposes this interface can store a vector of rectangles (TIEVisionRect).


Methods and Properties

Public Method  getRect
Public Method  push_back
Public Method  setRect

Note: You can draw the rects to a canvas using DrawRects


Examples

// Draw rects to image
var
  i: Integer;
  r: TIEVisionRect;
begin
  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, clYellow, [fsBold] );
  ImageEnView1.Update();
end;

// Output all rects as image files
for i := 0 to rects.size - 1 do
  with rects.getRect(i) do
  begin
    bmp := TIEBitmap.Create( width, height );
    ImageEnView1.IEBitmap.RenderToTIEBitmapEx( bmp, 0, 0, width, height, x, y, width, height );
    bmp.Write( format( 'D:\Face_%d.jpg', [ i+1 ]));
    bmp.Free;
  end;