Russian comments was removed. Error code was added as returned value inLatentSVM parser.

pull/13383/head
Evgeniy Kozinov 15 years ago
parent fbfccffbaa
commit 1cf405d8a4
  1. 19
      modules/objdetect/src/_lsvmparser.h
  2. 29
      modules/objdetect/src/lsvmparser.cpp

@ -47,20 +47,19 @@
#define EBTAG (STEP_END + BTAG) #define EBTAG (STEP_END + BTAG)
//extern "C" { //extern "C" {
void LSVMparser(const char * filename, filterObject *** model, int *last, int *max, int **comp, float **b, int *count, float * score); int LSVMparser(const char * filename, filterObject *** model, int *last, int *max, int **comp, float **b, int *count, float * score);
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
int loadModel( int loadModel(
// Âõîäíûå ïàðàìåòðû
const char *modelPath,// - ïóòü äî ôàéëà ñ ìîäåëüþ
// Âûõîäíûå ïàðàìåòðû const char *modelPath,
filterObject ***filters,// - ìàññèâ óêàçàòåëåé íà ôèëüòðû êîìïîíåíò
int *kFilters, //- îáùåå êîëè÷åñòâî ôèëüòðîâ âî âñåõ ìîäåëÿõ filterObject ***filters,
int *kComponents, //- êîëè÷åñòâî êîìïîíåíò int *kFilters,
int **kPartFilters, //- ìàññèâ, ñîäåðæàùèé êîëè÷åñòâî òî÷íûõ ôèëüòðîâ â êàæäîé êîìïîíåíòå int *kComponents,
float **b, //- ìàññèâ ëèíåéíûõ ÷ëåíîâ â îöåíî÷íîé ôóíêöèè int **kPartFilters,
float *scoreThreshold); //- ïîðîã äëÿ score) float **b,
float *scoreThreshold);
//}; //};
#endif #endif

@ -718,7 +718,7 @@ void parserModel(FILE * xmlf, filterObject *** model, int *last, int *max, int *
} }
} }
void LSVMparser(const char * filename, filterObject *** model, int *last, int *max, int **comp, float **b, int *count, float * score){ int LSVMparser(const char * filename, filterObject *** model, int *last, int *max, int **comp, float **b, int *count, float * score){
int st = 0; int st = 0;
int tag; int tag;
char ch; char ch;
@ -732,7 +732,11 @@ void LSVMparser(const char * filename, filterObject *** model, int *last, int *m
(*model) = (filterObject ** )malloc((sizeof(filterObject * )) * (*max)); (*model) = (filterObject ** )malloc((sizeof(filterObject * )) * (*max));
//printf("parse : %s\n", filename); //printf("parse : %s\n", filename);
xmlf = fopen(filename, "rb"); xmlf = fopen(filename, "rb");
if(xmlf == NULL){
return -1;
}
i = 0; i = 0;
j = 0; j = 0;
@ -762,28 +766,31 @@ void LSVMparser(const char * filename, filterObject *** model, int *last, int *m
} }
} }
} }
return 0;
} }
int loadModel( int loadModel(
// Âõîäíûå ïàðàìåòðû const char *modelPath,
const char *modelPath,// - ïóòü äî ôàéëà ñ ìîäåëüþ
// Âûõîäíûå ïàðàìåòðû filterObject ***filters,
filterObject ***filters,// - ìàññèâ óêàçàòåëåé íà ôèëüòðû êîìïîíåíò int *kFilters,
int *kFilters, //- îáùåå êîëè÷åñòâî ôèëüòðîâ âî âñåõ ìîäåëÿõ int *kComponents,
int *kComponents, //- êîëè÷åñòâî êîìïîíåíò int **kPartFilters,
int **kPartFilters, //- ìàññèâ, ñîäåðæàùèé êîëè÷åñòâî òî÷íûõ ôèëüòðîâ â êàæäîé êîìïîíåíòå float **b,
float **b, //- ìàññèâ ëèíåéíûõ ÷ëåíîâ â îöåíî÷íîé ôóíêöèè float *scoreThreshold){
float *scoreThreshold){ //- ïîðîã äëÿ score)
int last; int last;
int max; int max;
int *comp; int *comp;
int count; int count;
int i; int i;
int err;
float score; float score;
//printf("start_parse\n\n"); //printf("start_parse\n\n");
LSVMparser(modelPath, filters, &last, &max, &comp, b, &count, &score); err = LSVMparser(modelPath, filters, &last, &max, &comp, b, &count, &score);
if(err != 0){
return -1;
}
(*kFilters) = last + 1; (*kFilters) = last + 1;
(*kComponents) = count; (*kComponents) = count;
(*scoreThreshold) = (float) score; (*scoreThreshold) = (float) score;

Loading…
Cancel
Save