6 #include "VisageFeaturesDetector.h" 7 #include "visageVision.h" 9 #include "VisageDrawing.h" 10 #include "LicenseString.h" 13 #define MAX_IMAGE_SIZE 1000.0f 40 IplImage* frame_resized = 0;
41 frame = cvLoadImage(fileName);
45 printf(
"Cannot open %s\n",fileName);
50 IplImage *logo = cvLoadImage(
"../Linux/data/images/logo.png", CV_LOAD_IMAGE_UNCHANGED);
53 if( frame->height > MAX_IMAGE_SIZE || frame->width > MAX_IMAGE_SIZE )
56 if( frame->height >= frame->width )
57 step = MAX_IMAGE_SIZE/
static_cast<float>(frame->height);
59 step = MAX_IMAGE_SIZE/
static_cast<float>(frame->width);
60 int w =
static_cast<int>(
static_cast<float>(frame->width)*step);
61 int h =
static_cast<int>(
static_cast<float>(frame->height)*step);
62 frame_resized = cvCreateImage(cvSize(w, h), frame->depth, frame->nChannels);
63 cvResize(frame, frame_resized);
64 cvReleaseImage(&frame);
66 else frame_resized = frame;
78 for(
int i = 0; i < value; i++)
80 char tmpFileName[200];
81 strcpy(tmpFileName,fileName);
82 if(strlen(tmpFileName)>4)
84 tmpFileName[strlen(tmpFileName)-4] = 0;
87 sprintf(idx,
"%d", i);
88 strcat(tmpFileName,
"_");
89 strcat(tmpFileName, idx);
90 strcat(tmpFileName,
".fdp");
93 VisageDrawing::drawResults((
VsImage*)frame_resized, &data[i]);
94 imageBGRA = cvCreateImage(cvSize(frame_resized->
width, frame_resized->
height), IPL_DEPTH_8U, 4);
95 cvCvtColor(frame_resized, imageBGRA, CV_BGR2BGRA);
107 const char help[500] = \
109 "./runDetector imageName.jpg\n" \
110 "*Working directory is being set to Samples/data folder*";
219 int main(
int argc,
const char* argv[] ){
221 initializeLicenseManager(licenseKey.c_str());
224 if (chdir(
"../Samples/data")!=0){
225 printf(
"Unable to change current directory.");
232 char imageName[200] =
"../Linux/data/images/faces1.jpg";
236 printf(
"Default image will be used - faces1.jpg\n");
239 printf(
"Detecting faces on %s ...\n",argv[1]);
240 strcpy(imageName,argv[1]);
244 printf(
"Could not load required data files.\n");
248 cvNamedWindow(
"FaceDetector");
249 cvShowImage(
"FaceDetector", detected);
251 cvDestroyWindow(
"FaceDetector");
252 cvReleaseImage(&frame);
VisageFeaturesDetector * m_Detector
VisageFeaturesDetector instance.
IplImage * DetectFeatures(char *fileName)
Performs facial features detection on a file.
int detectFacialFeatures(VsImage *frame, FaceData *output, int maxFaces=1, float minFaceScale=0.1f, float maxFaceScale=1.0f, bool outputOnly2DFeatures=false)