unsigned int x;
unsigned int y;
unsigned int l;
-} position;
+} CvLSVMFilterPosition;
// DataType: STRUCT filterObject
// Description of the filter, which corresponds to the part of the object
// size of row in feature vectors
// (yp = (int) (p / xp); p = xp * yp)
typedef struct{
- position V;
+ CvLSVMFilterPosition V;
float fineFunction[4];
unsigned int sizeX;
unsigned int sizeY;
unsigned int p;
unsigned int xp;
float *H;
-} filterObject;
+} CvLSVMFilterObject;
// data type: STRUCT CvLatentSvmDetector
// structure contains internal representation of trained Latent SVM detector
int num_filters;
int num_components;
int* num_part_filters;
- filterObject** filters;
+ CvLSVMFilterObject** filters;
float* b;
float score_threshold;
}
int getFeaturePyramid(IplImage * image, \r
const int lambda, const int k, \r
const int startX, const int startY, \r
- const int W, const int H, featurePyramid **maps);\r
+ const int W, const int H, CvLSVMFeaturePyramid **maps);\r
\r
/*\r
// Getting feature map for the selected subimage \r
// RESULT\r
// Error status\r
*/\r
-int getFeatureMaps_dp(const IplImage * image, const int k, featureMap **map);\r
+int getFeatureMaps_dp(const IplImage * image, const int k, CvLSVMFeatureMap **map);\r
\r
\r
/*\r
// RESULT\r
// Error status\r
*/\r
-int normalizationAndTruncationFeatureMaps(featureMap *map, const float alfa);\r
+int normalizationAndTruncationFeatureMaps(CvLSVMFeatureMap *map, const float alfa);\r
\r
/*\r
// Feature map reduction\r
// RESULT\r
// Error status\r
*/\r
-int PCAFeatureMaps(featureMap *map);\r
+int PCAFeatureMaps(CvLSVMFeatureMap *map);\r
\r
//////////////////////////////////////////////////////////////\r
// search object\r
#ifdef __cplusplus\r
extern "C"\r
#endif\r
-featurePyramid* createFeaturePyramidWithBorder(IplImage *image,\r
+CvLSVMFeaturePyramid* createFeaturePyramidWithBorder(IplImage *image,\r
int maxXBorder, int maxYBorder);\r
\r
/*\r
// RESULT\r
// Error status\r
*/\r
-int searchObject(const featurePyramid *H, const filterObject **all_F, int n, \r
+int searchObject(const CvLSVMFeaturePyramid *H, const CvLSVMFilterObject **all_F, int n, \r
float b, \r
int maxXBorder,\r
int maxYBorder, \r
// RESULT\r
// Error status\r
*/\r
-int searchObjectThreshold(const featurePyramid *H, \r
- const filterObject **all_F, int n,\r
+int searchObjectThreshold(const CvLSVMFeaturePyramid *H, \r
+ const CvLSVMFilterObject **all_F, int n,\r
float b, \r
int maxXBorder, int maxYBorder, \r
float scoreThreshold,\r
#ifdef __cplusplus\r
extern "C"\r
#endif\r
-int searchObjectThresholdSomeComponents(const featurePyramid *H,\r
- const filterObject **filters, \r
+int searchObjectThresholdSomeComponents(const CvLSVMFeaturePyramid *H,\r
+ const CvLSVMFilterObject **filters, \r
int kComponents, const int *kPartFilters,\r
const float *b, float scoreThreshold,\r
CvPoint **points, CvPoint **oppPoints,\r
// Error status\r
*/\r
int showRootFilterBoxes(IplImage *image,\r
- const filterObject *filter, \r
+ const CvLSVMFilterObject *filter, \r
CvPoint *points, int *levels, int kPoints,\r
CvScalar color, int thickness, \r
int line_type, int shift);\r
// Error status\r
*/\r
int showPartFilterBoxes(IplImage *image,\r
- const filterObject **filters,\r
+ const CvLSVMFilterObject **filters,\r
int n, CvPoint **partsDisplacement, \r
int *levels, int kPoints,\r
CvScalar color, int thickness, \r
// RESULT
// Error status
*/
-int convolution(const filterObject *Fi, const featureMap *map, float *f);
+int convolution(const CvLSVMFilterObject *Fi, const CvLSVMFeatureMap *map, float *f);
/*
// Computation multiplication of FFT images
// RESULT
// Error status
*/
-int getFFTImageFilterObject(const filterObject *filter,
+int getFFTImageFilterObject(const CvLSVMFilterObject *filter,
int mapDimX, int mapDimY,
- fftImage **image);
+ CvLSVMFftImage **image);
/*
// Computation FFT image for feature map
// RESULT
// Error status
*/
-int getFFTImageFeatureMap(const featureMap *map, fftImage **image);
+int getFFTImageFeatureMap(const CvLSVMFeatureMap *map, CvLSVMFftImage **image);
/*
// Function for convolution computation using FFT
// RESULT
// Error status
*/
-int convFFTConv2d(const fftImage *featMapImage, const fftImage *filterImage,
+int convFFTConv2d(const CvLSVMFftImage *featMapImage, const CvLSVMFftImage *filterImage,
int filterDimX, int filterDimY, float **conv);
/*
// RESULT
// Error status
*/
-int filterDispositionLevel(const filterObject *Fi, const featureMap *pyramid,
+int filterDispositionLevel(const CvLSVMFilterObject *Fi, const CvLSVMFeatureMap *pyramid,
float **scoreFi,
int **pointsX, int **pointsY);
// RESULT
// Error status
*/
-int filterDispositionLevelFFT(const filterObject *Fi, const fftImage *featMapImage,
+int filterDispositionLevelFFT(const CvLSVMFilterObject *Fi, const CvLSVMFftImage *featMapImage,
float **scoreFi,
int **pointsX, int **pointsY);
// RESULT
// Error status
*/
-int addNullableBorder(featureMap *map, int bx, int by);
+int addNullableBorder(CvLSVMFeatureMap *map, int bx, int by);
/*
// Computation the maximum of the score function at the level
// RESULT
// Error status
*/
-int maxFunctionalScoreFixedLevel(const filterObject **all_F, int n,
- const featurePyramid *H,
+int maxFunctionalScoreFixedLevel(const CvLSVMFilterObject **all_F, int n,
+ const CvLSVMFeaturePyramid *H,
int level, float b,
int maxXBorder, int maxYBorder,
float *score, CvPoint **points, int *kPoints,
// RESULT
// Error status
*/
-int thresholdFunctionalScoreFixedLevel(const filterObject **all_F, int n,
- const featurePyramid *H,
+int thresholdFunctionalScoreFixedLevel(const CvLSVMFilterObject **all_F, int n,
+ const CvLSVMFeaturePyramid *H,
int level, float b,
int maxXBorder, int maxYBorder,
float scoreThreshold,
// RESULT
// Error status
*/
-int maxFunctionalScore(const filterObject **all_F, int n,
- const featurePyramid *H, float b,
+int maxFunctionalScore(const CvLSVMFilterObject **all_F, int n,
+ const CvLSVMFeaturePyramid *H, float b,
int maxXBorder, int maxYBorder,
float *score,
CvPoint **points, int **levels, int *kPoints,
// RESULT
// Error status
*/
-int thresholdFunctionalScore(const filterObject **all_F, int n,
- const featurePyramid *H,
+int thresholdFunctionalScore(const CvLSVMFilterObject **all_F, int n,
+ const CvLSVMFeaturePyramid *H,
float b,
int maxXBorder, int maxYBorder,
float scoreThreshold,
#ifdef __cplusplus
extern "C"
#endif
-int getMaxFilterDims(const filterObject **filters, int kComponents,
+int getMaxFilterDims(const CvLSVMFilterObject **filters, int kComponents,
const int *kPartFilters,
unsigned int *maxXBorder, unsigned int *maxYBorder);
//}
// with all fields including arrays
// Error status is return value
//////////////////////////////////////////////////////////////
-int allocFilterObject(filterObject **obj, const int sizeX, const int sizeY,
+int allocFilterObject(CvLSVMFilterObject **obj, const int sizeX, const int sizeY,
const int p, const int xp);
-int freeFilterObject (filterObject **obj);
+int freeFilterObject (CvLSVMFilterObject **obj);
-int allocFeatureMapObject(featureMap **obj, const int sizeX, const int sizeY,
+int allocFeatureMapObject(CvLSVMFeatureMap **obj, const int sizeX, const int sizeY,
const int p, const int xp);
-int freeFeatureMapObject (featureMap **obj);
+int freeFeatureMapObject (CvLSVMFeatureMap **obj);
#ifdef __cplusplus
extern "C"
#endif
-int allocFeaturePyramidObject(featurePyramid **obj,
+int allocFeaturePyramidObject(CvLSVMFeaturePyramid **obj,
const int lambda, const int countLevel);
#ifdef __cplusplus
extern "C"
#endif
-int freeFeaturePyramidObject (featurePyramid **obj);
-int allocFFTImage(fftImage **image, int p, int dimX, int dimY);
-int freeFFTImage(fftImage **image);
+int freeFeaturePyramidObject (CvLSVMFeaturePyramid **obj);
+int allocFFTImage(CvLSVMFftImage **image, int p, int dimX, int dimY);
+int freeFFTImage(CvLSVMFftImage **image);
#endif
\ No newline at end of file
#ifndef SVM_TYPE
#define SVM_TYPE
+#include "float.h"
+
//#define FFT_CONV
// ÇÃà ÷åÃèå ÷èñëà PI
-#define PI 3.1415926535897932384626433832795
+#define PI CV_PI
// Òî÷Ãîñòü ñðà âÃÃ¥Ãèÿ ïà ðû âåùåñòâåÃÃûõ ÷èñåë
#define EPS 0.000001
// ÌèÃèìà ëüÃîå è ìà êñèìà ëüÃîå çÃà ÷åÃèå äëÿ âåùåñòâåÃÃîãî òèïà äà ÃÃûõ
-#define F_MAX 3.402823466e+38
-#define F_MIN -3.402823465e+38
+#define F_MAX FLT_MAX
+#define F_MIN -FLT_MAX
// The number of elements in bin
// The number of sectors in gradient histogram building
int p;
int xp;
float *Map;
-} featureMap;
+} CvLSVMFeatureMap;
// DataType: STRUCT featurePyramid
//
typedef struct{
int countLevel;
int lambda;
- featureMap **pyramid;
-} featurePyramid;
+ CvLSVMFeatureMap **pyramid;
+} CvLSVMFeaturePyramid;
// DataType: STRUCT filterDisposition
// The structure stores preliminary results in optimization process
float *score;
int *x;
int *y;
-} filterDisposition;
+} CvLSVMFilterDisposition;
// DataType: STRUCT fftImage
// The structure stores FFT image
unsigned int dimX;
unsigned int dimY;
float **channels;
-} fftImage;
+} CvLSVMFftImage;
#endif
#define EBTAG (STEP_END + BTAG)
//extern "C" {
- int LSVMparser(const char * filename, filterObject *** model, int *last, int *max, int **comp, float **b, int *count, float * score);
+ int LSVMparser(const char * filename, CvLSVMFilterObject *** model, int *last, int *max,
+ int **comp, float **b, int *count, float * score);
#ifdef __cplusplus
extern "C"
#endif
const char *modelPath,
- filterObject ***filters,
+ CvLSVMFilterObject ***filters,
int *kFilters,
int *kComponents,
int **kPartFilters,
// RESULT\r
// Error status\r
*/\r
-int getFeatureMaps_dp(const IplImage * image,const int k, featureMap **map)\r
+int getFeatureMaps_dp(const IplImage * image,const int k, CvLSVMFeatureMap **map)\r
{\r
int sizeX, sizeY;\r
int p, px, strsz;\r
// RESULT\r
// Error status\r
*/\r
-int normalizationAndTruncationFeatureMaps(featureMap *map, const float alfa)\r
+int normalizationAndTruncationFeatureMaps(CvLSVMFeatureMap *map, const float alfa)\r
{\r
int i,j, ii;\r
int sizeX, sizeY, p, pos, pp, xp, pos1, pos2;\r
// RESULT\r
// Error status\r
*/\r
-int PCAFeatureMaps(featureMap *map)\r
+int PCAFeatureMaps(CvLSVMFeatureMap *map)\r
{ \r
int i,j, ii, jj, k;\r
int sizeX, sizeY, p, pp, xp, yp, pos1, pos2;\r
int getFeaturePyramid(IplImage * image,\r
const int lambda, const int k, \r
const int startX, const int startY, \r
- const int W, const int H, featurePyramid **maps)\r
+ const int W, const int H, CvLSVMFeaturePyramid **maps)\r
{\r
IplImage *img2, *imgTmp, *imgResize;\r
float step, tmp;\r
int maxcall;\r
int i;\r
int err;\r
- featureMap *map;\r
+ CvLSVMFeatureMap *map;\r
\r
//geting subimage\r
cvSetImageROI(image, cvRect(startX, startY, W, H));\r
// RESULT\r
// Error status\r
*/\r
-int addBordersToFeatureMaps(featureMap *map, const int bX, const int bY){\r
+int addBordersToFeatureMaps(CvLSVMFeatureMap *map, const int bX, const int bY){\r
int i,j, jj;\r
int sizeX, sizeY, p, pos1, pos2;\r
float * new_data;\r
// RESULT\r
// Feature pyramid with nullable border\r
*/\r
-featurePyramid* createFeaturePyramidWithBorder(IplImage *image,\r
+CvLSVMFeaturePyramid* createFeaturePyramidWithBorder(IplImage *image,\r
int maxXBorder, int maxYBorder)\r
{\r
int opResult;\r
int bx, by;\r
int level;\r
- featurePyramid *H;\r
+ CvLSVMFeaturePyramid *H;\r
\r
// Obtaining feature pyramid\r
opResult = getFeaturePyramid(image, LAMBDA, SIDE_LENGTH, 0, 0, \r
// RESULT\r
// Error status\r
*/\r
-int searchObject(const featurePyramid *H, const filterObject **all_F, \r
+int searchObject(const CvLSVMFeaturePyramid *H, const CvLSVMFilterObject **all_F, \r
int n, float b, \r
int maxXBorder,\r
int maxYBorder, \r
// RESULT\r
// Error status\r
*/\r
-int searchObjectThreshold(const featurePyramid *H, \r
- const filterObject **all_F, int n,\r
+int searchObjectThreshold(const CvLSVMFeaturePyramid *H, \r
+ const CvLSVMFilterObject **all_F, int n,\r
float b, \r
int maxXBorder, int maxYBorder, \r
float scoreThreshold,\r
// Error status\r
*/\r
int showRootFilterBoxes(IplImage *image,\r
- const filterObject *filter, \r
+ const CvLSVMFilterObject *filter, \r
CvPoint *points, int *levels, int kPoints,\r
CvScalar color, int thickness, \r
int line_type, int shift)\r
// Error status\r
*/\r
int showPartFilterBoxes(IplImage *image,\r
- const filterObject **filters,\r
+ const CvLSVMFilterObject **filters,\r
int n, CvPoint **partsDisplacement, \r
int *levels, int kPoints,\r
CvScalar color, int thickness, \r
// RESULT\r
// Error status\r
*/\r
-int getMaxFilterDims(const filterObject **filters, int kComponents,\r
+int getMaxFilterDims(const CvLSVMFilterObject **filters, int kComponents,\r
const int *kPartFilters, \r
unsigned int *maxXBorder, unsigned int *maxYBorder)\r
{\r
// RESULT\r
// Error status\r
*/\r
-int searchObjectThresholdSomeComponents(const featurePyramid *H,\r
- const filterObject **filters, \r
+int searchObjectThresholdSomeComponents(const CvLSVMFeaturePyramid *H,\r
+ const CvLSVMFilterObject **filters, \r
int kComponents, const int *kPartFilters,\r
const float *b, float scoreThreshold,\r
CvPoint **points, CvPoint **oppPoints,\r
CvLatentSvmDetector* cvLoadLatentSvmDetector(const char* filename)\r
{\r
CvLatentSvmDetector* detector = 0;\r
- filterObject** filters = 0;\r
+ CvLSVMFilterObject** filters = 0;\r
int kFilters = 0;\r
int kComponents = 0;\r
int* kPartFilters = 0;\r
CvMemStorage* storage, \r
float overlap_threshold)\r
{\r
- featurePyramid *H = 0;\r
+ CvLSVMFeaturePyramid *H = 0;\r
CvPoint *points = 0, *oppPoints = 0;\r
int kPoints = 0;\r
float *score = 0; \r
\r
cvConvertImage(image, image, CV_CVTIMG_SWAP_RB);\r
// Getting maximum filter dimensions\r
- getMaxFilterDims((const filterObject**)(detector->filters), detector->num_components, detector->num_part_filters, &maxXBorder, &maxYBorder);\r
+ getMaxFilterDims((const CvLSVMFilterObject**)(detector->filters), detector->num_components, detector->num_part_filters, &maxXBorder, &maxYBorder);\r
// Create feature pyramid with nullable border\r
H = createFeaturePyramidWithBorder(image, maxXBorder, maxYBorder);\r
// Search object\r
- searchObjectThresholdSomeComponents(H, (const filterObject**)(detector->filters), detector->num_components, \r
+ searchObjectThresholdSomeComponents(H, (const CvLSVMFilterObject**)(detector->filters), detector->num_components, \r
detector->num_part_filters, detector->b, detector->score_threshold, \r
&points, &oppPoints, &score, &kPoints);\r
// Clipping boxes\r
return sum;\r
}\r
\r
-void addFilter(filterObject *** model, int *last, int *max){\r
- filterObject ** nmodel;\r
+void addFilter(CvLSVMFilterObject *** model, int *last, int *max){\r
+ CvLSVMFilterObject ** nmodel;\r
int i;\r
(*last) ++;\r
if((*last) >= (*max)){\r
(*max) += 10;\r
- nmodel = (filterObject **)malloc(sizeof(filterObject *) * (*max));\r
+ nmodel = (CvLSVMFilterObject **)malloc(sizeof(CvLSVMFilterObject *) * (*max));\r
for(i = 0; i < *last; i++){\r
nmodel[i] = (* model)[i];\r
}\r
free(* model);\r
(*model) = nmodel;\r
}\r
- (*model) [(*last)] = (filterObject *)malloc(sizeof(filterObject));\r
+ (*model) [(*last)] = (CvLSVMFilterObject *)malloc(sizeof(CvLSVMFilterObject));\r
}\r
\r
-void parserRFilter (FILE * xmlf, int p, filterObject * model, float *b){\r
+void parserRFilter (FILE * xmlf, int p, CvLSVMFilterObject * model, float *b){\r
int st = 0;\r
int sizeX, sizeY;\r
int tag;\r
}\r
}\r
\r
-void parserV (FILE * xmlf, int p, filterObject * model){\r
+void parserV (FILE * xmlf, int p, CvLSVMFilterObject * model){\r
int st = 0;\r
int tag;\r
int tagVal;\r
} \r
}\r
}\r
-void parserD (FILE * xmlf, int p, filterObject * model){\r
+void parserD (FILE * xmlf, int p, CvLSVMFilterObject * model){\r
int st = 0;\r
int tag;\r
int tagVal;\r
}\r
}\r
\r
-void parserPFilter (FILE * xmlf, int p, int N_path, filterObject * model){\r
+void parserPFilter (FILE * xmlf, int p, int N_path, CvLSVMFilterObject * model){\r
int st = 0;\r
int sizeX, sizeY;\r
int tag;\r
} \r
}\r
}\r
-void parserPFilterS (FILE * xmlf, int p, filterObject *** model, int *last, int *max){\r
+void parserPFilterS (FILE * xmlf, int p, CvLSVMFilterObject *** model, int *last, int *max){\r
int st = 0;\r
int N_path = 0;\r
int tag;\r
} \r
}\r
}\r
-void parserComp (FILE * xmlf, int p, int *N_comp, filterObject *** model, float *b, int *last, int *max){\r
+void parserComp (FILE * xmlf, int p, int *N_comp, CvLSVMFilterObject *** model, float *b, int *last, int *max){\r
int st = 0;\r
int tag;\r
int tagVal;\r
} \r
}\r
}\r
-void parserModel(FILE * xmlf, filterObject *** model, int *last, int *max, int **comp, float **b, int *count, float * score){\r
+void parserModel(FILE * xmlf, CvLSVMFilterObject *** model, int *last, int *max, int **comp, float **b, int *count, float * score){\r
int p = 0;\r
int N_comp = 0;\r
int * cmp;\r
}\r
}\r
\r
-int LSVMparser(const char * filename, filterObject *** model, int *last, int *max, int **comp, float **b, int *count, float * score){\r
+int LSVMparser(const char * filename, CvLSVMFilterObject *** model, int *last, int *max, int **comp, float **b, int *count, float * score){\r
int st = 0;\r
int tag;\r
char ch;\r
\r
(*max) = 10;\r
(*last) = -1;\r
- (*model) = (filterObject ** )malloc((sizeof(filterObject * )) * (*max));\r
+ (*model) = (CvLSVMFilterObject ** )malloc((sizeof(CvLSVMFilterObject * )) * (*max));\r
\r
//printf("parse : %s\n", filename);\r
\r
\r
int loadModel(\r
const char *modelPath,\r
- \r
- filterObject ***filters,\r
+ CvLSVMFilterObject ***filters,\r
int *kFilters, \r
int *kComponents, \r
int **kPartFilters, \r
// RESULT\r
// Error status\r
*/\r
-int convolution(const filterObject *Fi, const featureMap *map, float *f)\r
+int convolution(const CvLSVMFilterObject *Fi, const CvLSVMFeatureMap *map, float *f)\r
{\r
int n1, m1, n2, m2, p, size, diff1, diff2;\r
int i1, i2, j1, j2, k; \r
// Computation FFT image for filter object\r
//\r
// API\r
-// int getFFTImageFilterObject(const filterObject *filter, \r
+// int getFFTImageFilterObject(const CvLSVMFilterObject *filter, \r
int mapDimX, int mapDimY,\r
fftImage **image);\r
// INPUT\r
// RESULT\r
// Error status\r
*/\r
-int getFFTImageFilterObject(const filterObject *filter, \r
+int getFFTImageFilterObject(const CvLSVMFilterObject *filter, \r
int mapDimX, int mapDimY,\r
- fftImage **image)\r
+ CvLSVMFftImage **image)\r
{\r
unsigned int i, mapSize, filterSize;\r
int res;\r
// RESULT\r
// Error status\r
*/\r
-int getFFTImageFeatureMap(const featureMap *map, fftImage **image)\r
+int getFFTImageFeatureMap(const CvLSVMFeatureMap *map, CvLSVMFftImage **image)\r
{\r
int i, j, size;\r
float *buf; \r
// RESULT\r
// Error status\r
*/\r
-int convFFTConv2d(const fftImage *featMapImage, const fftImage *filterImage, \r
+int convFFTConv2d(const CvLSVMFftImage *featMapImage, const CvLSVMFftImage *filterImage, \r
int filterDimX, int filterDimY, float **conv)\r
{\r
int i, j, size, diffX, diffY, index;\r
// Computation objective function D according the original paper\r
//\r
// API\r
-// int filterDispositionLevel(const filterObject *Fi, const featurePyramid *H, \r
+// int filterDispositionLevel(const CvLSVMFilterObject *Fi, const featurePyramid *H, \r
int level, float **scoreFi, \r
int **pointsX, int **pointsY);\r
// INPUT\r
// RESULT\r
// Error status\r
*/\r
-int filterDispositionLevel(const filterObject *Fi, const featureMap *pyramid,\r
+int filterDispositionLevel(const CvLSVMFilterObject *Fi, const CvLSVMFeatureMap *pyramid,\r
float **scoreFi, \r
int **pointsX, int **pointsY)\r
{\r
// Computation objective function D according the original paper using FFT\r
//\r
// API\r
-// int filterDispositionLevelFFT(const filterObject *Fi, const fftImage *featMapImage,\r
+// int filterDispositionLevelFFT(const CvLSVMFilterObject *Fi, const fftImage *featMapImage,\r
float **scoreFi, \r
int **pointsX, int **pointsY);\r
// INPUT\r
// RESULT\r
// Error status\r
*/\r
-int filterDispositionLevelFFT(const filterObject *Fi, const fftImage *featMapImage,\r
+int filterDispositionLevelFFT(const CvLSVMFilterObject *Fi, const CvLSVMFftImage *featMapImage,\r
float **scoreFi, \r
int **pointsX, int **pointsY)\r
{\r
float *f; \r
int i1, j1;\r
int res;\r
- fftImage *filterImage;\r
+ CvLSVMFftImage *filterImage;\r
\r
n1 = featMapImage->dimY;\r
m1 = featMapImage->dimX;\r
// RESULT\r
// Error status\r
*/\r
-int addNullableBorder(featureMap *map, int bx, int by)\r
+int addNullableBorder(CvLSVMFeatureMap *map, int bx, int by)\r
{\r
int sizeX, sizeY, i, j, k;\r
float *new_map;\r
return LATENT_SVM_OK;\r
}\r
\r
-featureMap* featureMapBorderPartFilter(featureMap *map, \r
+CvLSVMFeatureMap* featureMapBorderPartFilter(CvLSVMFeatureMap *map, \r
int maxXBorder, int maxYBorder)\r
{\r
int bx, by;\r
int sizeX, sizeY, i, j, k;\r
- featureMap *new_map;\r
+ CvLSVMFeatureMap *new_map;\r
\r
computeBorderSize(maxXBorder, maxYBorder, &bx, &by);\r
sizeX = map->sizeX + 2 * bx;\r
// Computation the maximum of the score function at the level\r
//\r
// API\r
-// int maxFunctionalScoreFixedLevel(const filterObject **all_F, int n, \r
+// int maxFunctionalScoreFixedLevel(const CvLSVMFilterObject **all_F, int n, \r
const featurePyramid *H, \r
int level, float b, \r
int maxXBorder, int maxYBorder, \r
// RESULT\r
// Error status\r
*/\r
-int maxFunctionalScoreFixedLevel(const filterObject **all_F, int n, \r
- const featurePyramid *H, \r
+int maxFunctionalScoreFixedLevel(const CvLSVMFilterObject **all_F, int n, \r
+ const CvLSVMFeaturePyramid *H, \r
int level, float b, \r
int maxXBorder, int maxYBorder, \r
float *score, CvPoint **points, \r
{\r
int i, j, k, dimX, dimY, nF0, mF0, p;\r
int diff1, diff2, index, last, partsLevel;\r
- filterDisposition **disposition;\r
+ CvLSVMFilterDisposition **disposition;\r
float *f;\r
float *scores;\r
float sumScorePartDisposition, maxScore;\r
int res;\r
- featureMap *map;\r
+ CvLSVMFeatureMap *map;\r
#ifdef FFT_CONV\r
- fftImage *rootFilterImage, *mapImage;\r
+ CvLSVMFftImage *rootFilterImage, *mapImage;\r
#else\r
#endif\r
\r
\r
// Allocation memory for saving values of function D \r
// on the level for each part filter\r
- disposition = (filterDisposition **)malloc(sizeof(filterDisposition *) * n);\r
+ disposition = (CvLSVMFilterDisposition **)malloc(sizeof(CvLSVMFilterDisposition *) * n);\r
for (i = 0; i < n; i++)\r
{\r
- disposition[i] = (filterDisposition *)malloc(sizeof(filterDisposition));\r
+ disposition[i] = (CvLSVMFilterDisposition *)malloc(sizeof(CvLSVMFilterDisposition));\r
} \r
\r
// Allocation memory for values of score function for each block on the level\r
// Computation score function at the level that exceed threshold\r
//\r
// API\r
-// int thresholdFunctionalScoreFixedLevel(const filterObject **all_F, int n, \r
+// int thresholdFunctionalScoreFixedLevel(const CvLSVMFilterObject **all_F, int n, \r
const featurePyramid *H, \r
int level, float b, \r
int maxXBorder, int maxYBorder,\r
// RESULT\r
// Error status\r
*/\r
-int thresholdFunctionalScoreFixedLevel(const filterObject **all_F, int n, \r
- const featurePyramid *H, \r
+int thresholdFunctionalScoreFixedLevel(const CvLSVMFilterObject **all_F, int n, \r
+ const CvLSVMFeaturePyramid *H, \r
int level, float b, \r
int maxXBorder, int maxYBorder,\r
float scoreThreshold,\r
{\r
int i, j, k, dimX, dimY, nF0, mF0, p;\r
int diff1, diff2, index, last, partsLevel;\r
- filterDisposition **disposition;\r
+ CvLSVMFilterDisposition **disposition;\r
float *f;\r
float *scores;\r
float sumScorePartDisposition;\r
int res;\r
- featureMap *map;\r
+ CvLSVMFeatureMap *map;\r
#ifdef FFT_CONV\r
- fftImage *rootFilterImage, *mapImage;\r
+ CvLSVMFftImage *rootFilterImage, *mapImage;\r
#else\r
#endif\r
/*\r
\r
// Allocation memory for saving values of function D \r
// on the level for each part filter\r
- disposition = (filterDisposition **)malloc(sizeof(filterDisposition *) * n);\r
+ disposition = (CvLSVMFilterDisposition **)malloc(sizeof(CvLSVMFilterDisposition *) * n);\r
for (i = 0; i < n; i++)\r
{\r
- disposition[i] = (filterDisposition *)malloc(sizeof(filterDisposition));\r
+ disposition[i] = (CvLSVMFilterDisposition *)malloc(sizeof(CvLSVMFilterDisposition));\r
} \r
\r
// Allocation memory for values of score function for each block on the level\r
// Computation the maximum of the score function\r
//\r
// API\r
-// int maxFunctionalScore(const filterObject **all_F, int n, \r
+// int maxFunctionalScore(const CvLSVMFilterObject **all_F, int n, \r
const featurePyramid *H, float b, \r
int maxXBorder, int maxYBorder,\r
float *score, \r
// RESULT\r
// Error status\r
*/\r
-int maxFunctionalScore(const filterObject **all_F, int n, \r
- const featurePyramid *H, float b, \r
+int maxFunctionalScore(const CvLSVMFilterObject **all_F, int n, \r
+ const CvLSVMFeaturePyramid *H, float b, \r
int maxXBorder, int maxYBorder,\r
float *score, \r
CvPoint **points, int **levels, int *kPoints,\r
// Computation score function that exceed threshold\r
//\r
// API\r
-// int thresholdFunctionalScore(const filterObject **all_F, int n, \r
+// int thresholdFunctionalScore(const CvLSVMFilterObject **all_F, int n, \r
const featurePyramid *H, \r
float b, \r
int maxXBorder, int maxYBorder,\r
// RESULT\r
// Error status\r
*/\r
-int thresholdFunctionalScore(const filterObject **all_F, int n, \r
- const featurePyramid *H, \r
+int thresholdFunctionalScore(const CvLSVMFilterObject **all_F, int n, \r
+ const CvLSVMFeaturePyramid *H, \r
float b, \r
int maxXBorder, int maxYBorder,\r
float scoreThreshold,\r
#include "precomp.hpp"\r
#include "_lsvm_routine.h"\r
\r
-int allocFilterObject(filterObject **obj, const int sizeX, const int sizeY, const int p, const int xp){\r
+int allocFilterObject(CvLSVMFilterObject **obj, const int sizeX, const int sizeY, const int p, const int xp){\r
int i;\r
- (*obj) = (filterObject *)malloc(sizeof(filterObject));\r
+ (*obj) = (CvLSVMFilterObject *)malloc(sizeof(CvLSVMFilterObject));\r
(*obj)->sizeX = sizeX;\r
(*obj)->sizeY = sizeY;\r
(*obj)->p = p ;\r
}\r
return LATENT_SVM_OK;\r
}\r
-int freeFilterObject (filterObject **obj){\r
+int freeFilterObject (CvLSVMFilterObject **obj){\r
if(*obj == NULL) return 0;\r
free((*obj)->H);\r
free(*obj);\r
return LATENT_SVM_OK;\r
}\r
\r
-int allocFeatureMapObject(featureMap **obj, const int sizeX, const int sizeY, const int p, const int xp){\r
+int allocFeatureMapObject(CvLSVMFeatureMap **obj, const int sizeX, const int sizeY, const int p, const int xp){\r
int i;\r
- (*obj) = (featureMap *)malloc(sizeof(featureMap));\r
+ (*obj) = (CvLSVMFeatureMap *)malloc(sizeof(CvLSVMFeatureMap));\r
(*obj)->sizeX = sizeX;\r
(*obj)->sizeY = sizeY;\r
(*obj)->p = p ;\r
}\r
return LATENT_SVM_OK;\r
}\r
-int freeFeatureMapObject (featureMap **obj){\r
+int freeFeatureMapObject (CvLSVMFeatureMap **obj){\r
if(*obj == NULL) return 0;\r
free((*obj)->Map);\r
free(*obj);\r
return LATENT_SVM_OK;\r
}\r
\r
-int allocFeaturePyramidObject(featurePyramid **obj, const int lambda, const int countLevel){\r
- (*obj) = (featurePyramid *)malloc(sizeof(featurePyramid));\r
+int allocFeaturePyramidObject(CvLSVMFeaturePyramid **obj, const int lambda, const int countLevel){\r
+ (*obj) = (CvLSVMFeaturePyramid *)malloc(sizeof(CvLSVMFeaturePyramid));\r
(*obj)->countLevel = countLevel;\r
- (*obj)->pyramid = (featureMap **)malloc(sizeof(featureMap *) * countLevel);\r
+ (*obj)->pyramid = (CvLSVMFeatureMap **)malloc(sizeof(CvLSVMFeatureMap *) * countLevel);\r
(*obj)->lambda = lambda;\r
return LATENT_SVM_OK;\r
}\r
\r
-int freeFeaturePyramidObject (featurePyramid **obj){\r
+int freeFeaturePyramidObject (CvLSVMFeaturePyramid **obj){\r
int i; \r
if(*obj == NULL) return 0;\r
for(i = 0; i < (*obj)->countLevel; i++)\r
return LATENT_SVM_OK;\r
}\r
\r
-int allocFFTImage(fftImage **image, int p, int dimX, int dimY)\r
+int allocFFTImage(CvLSVMFftImage **image, int p, int dimX, int dimY)\r
{\r
int i, j, size;\r
- *image = (fftImage *)malloc(sizeof(fftImage));\r
+ *image = (CvLSVMFftImage *)malloc(sizeof(CvLSVMFftImage));\r
(*image)->p = p;\r
(*image)->dimX = dimX;\r
(*image)->dimY = dimY;\r
return LATENT_SVM_OK;\r
}\r
\r
-int freeFFTImage(fftImage **image)\r
+int freeFFTImage(CvLSVMFftImage **image)\r
{\r
unsigned int i;\r
if (*image == NULL) return LATENT_SVM_OK;\r