ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Face Detection C++

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
gajendra Posted - Mar 10 2012 : 08:09:49
Hi, do you have coding for c++ for this delphi code :

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();

// loop among rectangles
for i:=0 to rects.size-1 do
begin
ImageEnView1.ObjPenWidth[-1] := 2;
with rects.getRect(i) do
begin
... do something with the rectangle coordinates and size
end;
end;

Thanks
2   L A T E S T    R E P L I E S    (Newest First)
gajendra Posted - Mar 10 2012 : 11:20:14
Thank you very much, great help.
fab Posted - Mar 10 2012 : 10:35:35
Hi,
some conversion rules:
- each interface is embedded inside a C++ template with "_di_" prefix. So, for example, TIEVisionObjectFind becomes _di_TIEVisionObjectFinder
- each method returns an HRESULT, so the actual return value is the last parameter
- the second-last parameter is always "false". This is an internal parameter.
- when a method expects a parent interface (like addClassifier that wants a TIEVisionBase, but we have a TIEVisionCascadeClassifier ), perform a cast, better a static_cast to avoid programming errors

Here is an example of conversion:

	// check if "ievision.dll" is available
	if (!IEVisionAvailable())
	{
		ShowMessage("ievision.dll not loaded!");
		exit;
	}

	// load two face detectors
	_di_TIEVisionObjectsFinder objectsFinder;
	IEVisionLib->createObjectsFinder(false, objectsFinder);

	_di_TIEVisionCascadeClassifier faceDetector1, faceDetector2;
	IEVisionLib->createCascadeClassifier(":FRONTALFACEALTTREE", false, faceDetector1);
	IEVisionLib->createCascadeClassifier(":FRONTALFACEDEFAULT", false, faceDetector2);
	objectsFinder->addClassifier("face detector 1", static_cast<TIEVisionBase *>(faceDetector1));
	objectsFinder->addClassifier("face detector 2", static_cast<TIEVisionBase *>(faceDetector2));

	// detect objects
	objectsFinder->findIn(ImageEnView1->IEBitmap->GetIEVisionImage());

	// merge intersecting rectangles of all searched objects
	_di_TIEVisionVectorRect rects;
	objectsFinder->mergeAllRects(false, rects);

	// loop among rectangles
	int rectCount;
	rects->size(false, rectCount);
	for (int i=0; i != rectCount; ++i)
	{
		TIEVisionRect rectangle;
		rects->getRect(i, false, rectangle);
		// ... do something with the rectangle coordinates and size
		ImageEnView1->IEBitmap->Canvas->Pen->Color = clRed;
		ImageEnView1->IEBitmap->Canvas->Brush->Style = bsClear;
		ImageEnView1->IEBitmap->Canvas->Rectangle(rectangle.x, rectangle.y, rectangle.x+rectangle.width, rectangle.y+rectangle.height);
	}