Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TVLHaarDetectObject
05-21-2012, 03:42 PM
Post: #1
TVLHaarDetectObject
Hi all,
I downloaded Face Detection Demo and try to rewrite pascal into c++ builder.
In OnDetectedObjects event handler in c++ code, I wrote below.

// code starts
void __fastcall TForm1::VLHaarDetectObjects1DetectedObjects(TObject *Sender, TVLDetectedObjects *Objects)

{
int i,j;
TVLImageRect ARectangle;
TVLBitmap* ABitmap;


CodeSite->Send("Objects->Count:"+IntToStr(Objects->Count));
ABitmap = new TVLBitmap();
VLHaarDetectObjects1->CurrentImage->ToBitmap(ABitmap);

ABitmap->Canvas->Font->Color = clWhite;
for(i=0;i<Objects->Count;i++){
ARectangle = Objects->Items[i]->Rectangle;
ABitmap->Canvas->Brush->Style = bsClear;
ABitmap->Canvas->Pen->Color = clRed;
ABitmap->Canvas->Ellipse(ARectangle.X,ARectangle.Y,ARectangle.X+ARectangle.Width,ARectangle.Y+​ARectangle.Height);
ABitmap->Canvas->TextOutW(ARectangle.X+ARectangle.Width/2,ARectangle.Y+ARectangle.Height/2,Objects->Items[i]->Name);

ABitmap->Canvas->Pen->Color = clYellow;
for(j=0;j<Objects->Items[i]->Objects->Count;j++){
ARectangle = Objects->Items[i]->Objects->Items[j]->Rectangle;
ABitmap->Canvas->Ellipse(ARectangle.X,ARectangle.Y,ARectangle.X+ARectangle.Width,ARectangle.Y+​ARectangle.Height);
ABitmap->Canvas->TextOutW(ARectangle.X+ARectangle.Width/2,ARectangle.Y+ARectangle.Height/2,
Objects->Items[i]->Objects->Items[j]->Name);
}
}

VLImageDisplay2->DisplayBitmap(ABitmap);
delete ABitmap;

}
// code ends.

It seems the event handler is called, but "Objects->Count" is always equal to zero. Objects->Count should have a value more than 0.
Suggestions and advice are appreciated.
Thanks in advance.

Compiler: RadStudio XE2(c++ Builder) update4
Component ver: 5.02
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
TVLHaarDetectObject - yuki - 05-21-2012 03:42 PM
RE: TVLHaarDetectObject - Dave - 05-22-2012, 07:13 PM
RE: TVLHaarDetectObject - yuki - 05-31-2012, 10:41 AM

Forum Jump:


User(s) browsing this thread: 2 Guest(s)