#include #include "libica.h" int run_main(int argc, char **argv) { mxArray *database_dir; mxArray *test_dir; mxArray *C = NULL; mxArray *Ctest = NULL; mxArray *F = NULL; mxArray *Ftest = NULL; mxArray *pc = NULL; double* data; /* Call the mclInitializeApplication routine. Make sure that the application * was initialized properly by checking the return status. This initialization * has to be done before calling any MATLAB API's or MATLAB Compiler generated * shared library functions. */ if( !mclInitializeApplication(NULL,0) ) { fprintf(stderr, "Could not initialize the application.\n"); return -1; } /* Create the input data */ database_dir = mxCreateString("/home/faurandrei/PPPP/aligned/"); test_dir = mxCreateString("/home/faurandrei/PPPP/aligned_test/"); /* Call the library intialization routine and make sure that the * library was initialized properly. */ if (!libicaInitialize()){ fprintf(stderr,"Could not initialize the library.\n"); return -2; } else { /* mark features mlfMarkFeats(in1, in2, in3); align faces mlfAlignFs(label_dir, img_dir, dest_dir, labelname);*/ /* load faces into matrix C */ mlfLoadFs(1, &C, database_dir); /* load test faces into matrix Ctest */ mlfLoadFs(1, &Ctest, test_dir); /* obtain ICA representation of database images */ mlfArch1_tmp(2, &F, &Ftest, C, Ctest); /* get percent correct */ mlfCompare(1, &pc, F, Ftest); data = mxGetPr(pc); printf("%f\n", *data); mxDestroyArray(C); C = 0; mxDestroyArray(Ctest); Ctest = 0; mxDestroyArray(F); F = 0; mxDestroyArray(Ftest); Ftest = 0; mxDestroyArray(pc); pc = 0; /* Call the library termination routine */ libicaTerminate(); /* Free the memory created */ /*mxDestroyArray(database_dir); database_dir = 0; mxDestroyArray(test_dir); test_dir = 0; mxDestroyArray(C); C = 0; mxDestroyArray(Ctest); Ctest = 0; mxDestroyArray(F); F = 0; mxDestroyArray(Ftest); Ftest = 0; mxDestroyArray(pc); pc = 0;*/ } /* Note that you should call mclTerminate application at the end of * your application. */ mclTerminateApplication(); return 0; } int main() { mclmcrInitialize(); return mclRunMain((mclMainFcnType)run_main,0,NULL); }