1 | #include <stdio.h> |
---|
2 | #include "libica.h" |
---|
3 | |
---|
4 | int run_main(int argc, char **argv) |
---|
5 | { |
---|
6 | mxArray *database_dir; |
---|
7 | mxArray *test_dir; |
---|
8 | mxArray *C = NULL; |
---|
9 | mxArray *Ctest = NULL; |
---|
10 | mxArray *F = NULL; |
---|
11 | mxArray *Ftest = NULL; |
---|
12 | mxArray *pc = NULL; |
---|
13 | |
---|
14 | double* data; |
---|
15 | |
---|
16 | /* Call the mclInitializeApplication routine. Make sure that the application |
---|
17 | * was initialized properly by checking the return status. This initialization |
---|
18 | * has to be done before calling any MATLAB API's or MATLAB Compiler generated |
---|
19 | * shared library functions. */ |
---|
20 | if( !mclInitializeApplication(NULL,0) ) |
---|
21 | { |
---|
22 | fprintf(stderr, "Could not initialize the application.\n"); |
---|
23 | return -1; |
---|
24 | } |
---|
25 | |
---|
26 | /* Create the input data */ |
---|
27 | database_dir = mxCreateString("/home/faurandrei/PPPP/aligned/"); |
---|
28 | test_dir = mxCreateString("/home/faurandrei/PPPP/aligned_test/"); |
---|
29 | |
---|
30 | /* Call the library intialization routine and make sure that the |
---|
31 | * library was initialized properly. */ |
---|
32 | if (!libicaInitialize()){ |
---|
33 | fprintf(stderr,"Could not initialize the library.\n"); |
---|
34 | return -2; |
---|
35 | } |
---|
36 | else |
---|
37 | { |
---|
38 | /* mark features |
---|
39 | mlfMarkFeats(in1, in2, in3); |
---|
40 | |
---|
41 | align faces |
---|
42 | mlfAlignFs(label_dir, img_dir, dest_dir, labelname);*/ |
---|
43 | |
---|
44 | /* load faces into matrix C */ |
---|
45 | mlfLoadFs(1, &C, database_dir); |
---|
46 | |
---|
47 | /* load test faces into matrix Ctest */ |
---|
48 | mlfLoadFs(1, &Ctest, test_dir); |
---|
49 | |
---|
50 | /* obtain ICA representation of database images */ |
---|
51 | mlfArch1_tmp(2, &F, &Ftest, C, Ctest); |
---|
52 | |
---|
53 | /* get percent correct */ |
---|
54 | mlfCompare(1, &pc, F, Ftest); |
---|
55 | |
---|
56 | data = mxGetPr(pc); |
---|
57 | printf("%f\n", *data); |
---|
58 | |
---|
59 | mxDestroyArray(C); C = 0; |
---|
60 | mxDestroyArray(Ctest); Ctest = 0; |
---|
61 | mxDestroyArray(F); F = 0; |
---|
62 | mxDestroyArray(Ftest); Ftest = 0; |
---|
63 | mxDestroyArray(pc); pc = 0; |
---|
64 | |
---|
65 | /* Call the library termination routine */ |
---|
66 | libicaTerminate(); |
---|
67 | |
---|
68 | /* Free the memory created */ |
---|
69 | /*mxDestroyArray(database_dir); database_dir = 0; |
---|
70 | mxDestroyArray(test_dir); test_dir = 0; |
---|
71 | |
---|
72 | mxDestroyArray(C); C = 0; |
---|
73 | mxDestroyArray(Ctest); Ctest = 0; |
---|
74 | |
---|
75 | mxDestroyArray(F); F = 0; |
---|
76 | mxDestroyArray(Ftest); Ftest = 0; |
---|
77 | |
---|
78 | mxDestroyArray(pc); pc = 0;*/ |
---|
79 | } |
---|
80 | |
---|
81 | /* Note that you should call mclTerminate application at the end of |
---|
82 | * your application. |
---|
83 | */ |
---|
84 | mclTerminateApplication(); |
---|
85 | return 0; |
---|
86 | } |
---|
87 | |
---|
88 | int main() |
---|
89 | { |
---|
90 | mclmcrInitialize(); |
---|
91 | return mclRunMain((mclMainFcnType)run_main,0,NULL); |
---|
92 | } |
---|