Call us at 562 537 4424
   About Contact Us Other Services Customer Login
 

   

Sample Code

Full documentation and technical support will be provided to you when you integrate the code below into your existing application. This code will call the cropping application.

Create an instance of the cropping tool object:


private ObjFaceCrop.FaceCrop m_ObjFaceCrop;

- Assuming that you have created a web application called "FinderLib", set the following variables:
string _workingPath = "C:\\Inetpub\\wwwroot\\FinderLib";
string _uploadsPath = "Uploads\\";
string _temporaryPath = "Temp\\";
string _cropedPath = "Results\\";

Object constructor:

m_ObjFaceCrop = new ObjFaceCrop.FaceCrop(_workingPath,_uploadsPath,_temporaryPath,_cropedPath);
- Set object instance properties here:
m_ObjFaceCrop.AroundFace = false;
m_ObjFaceCrop.Width = 100;
m_ObjFaceCrop.Height = 120;
m_ObjFaceCrop.RecurseRotateAngle = 20.0F;

The code below crops faces from an image:

string fileName = "";
fileName = "C:\\your file.jpg";
DataTable dtObjects = m_ObjFaceCrop.DetectAndCrop(fileName);

The cropped images are stored in the dtObjects datatable as jpg format images:


-The datatable can be later bound in a structure like this:

<asp:Repeater Runat=server ID="rpThis" Visible=True>
<ItemTemplate>
<img src="Results\<%#DataBinder.Eval(Container,"DataItem.FileName")%>">
<\ItemTemplate>
<\asp:Repeater>

Questions about this code? Contact us.