From bddaa00e035b4cb6c4d17c628290465553420a26 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Mon, 18 Oct 2010 08:49:18 +0000 Subject: [PATCH] renamed filterObject -> CvLSVMFilterObject, position -> CvLSVMFilterPosition etc. --- .../include/opencv2/objdetect/objdetect.hpp | 8 +-- modules/objdetect/src/_latentsvm.h | 24 ++++---- modules/objdetect/src/_lsvm_matching.h | 34 +++++----- modules/objdetect/src/_lsvm_routine.h | 16 ++--- modules/objdetect/src/_lsvm_types.h | 18 +++--- modules/objdetect/src/_lsvmparser.h | 5 +- modules/objdetect/src/featurepyramid.cpp | 12 ++-- modules/objdetect/src/latentsvm.cpp | 20 +++--- modules/objdetect/src/latentsvmdetector.cpp | 8 +-- modules/objdetect/src/lsvmparser.cpp | 29 +++++---- modules/objdetect/src/matching.cpp | 72 +++++++++++----------- modules/objdetect/src/routine.cpp | 26 ++++---- 12 files changed, 137 insertions(+), 135 deletions(-) diff --git a/modules/objdetect/include/opencv2/objdetect/objdetect.hpp b/modules/objdetect/include/opencv2/objdetect/objdetect.hpp index 8a64c27..ae86b61 100644 --- a/modules/objdetect/include/opencv2/objdetect/objdetect.hpp +++ b/modules/objdetect/include/opencv2/objdetect/objdetect.hpp @@ -153,7 +153,7 @@ typedef struct 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 @@ -173,14 +173,14 @@ typedef struct // 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 @@ -195,7 +195,7 @@ typedef struct CvLatentSvmDetector int num_filters; int num_components; int* num_part_filters; - filterObject** filters; + CvLSVMFilterObject** filters; float* b; float score_threshold; } diff --git a/modules/objdetect/src/_latentsvm.h b/modules/objdetect/src/_latentsvm.h index c49c2aa..e7cfc9c 100644 --- a/modules/objdetect/src/_latentsvm.h +++ b/modules/objdetect/src/_latentsvm.h @@ -40,7 +40,7 @@ int getFeaturePyramid(IplImage * image, const int lambda, const int k, const int startX, const int startY, - const int W, const int H, featurePyramid **maps); + const int W, const int H, CvLSVMFeaturePyramid **maps); /* // Getting feature map for the selected subimage @@ -55,7 +55,7 @@ int getFeaturePyramid(IplImage * image, // RESULT // Error status */ -int getFeatureMaps_dp(const IplImage * image, const int k, featureMap **map); +int getFeatureMaps_dp(const IplImage * image, const int k, CvLSVMFeatureMap **map); /* @@ -71,7 +71,7 @@ int getFeatureMaps_dp(const IplImage * image, const int k, featureMap **map); // RESULT // Error status */ -int normalizationAndTruncationFeatureMaps(featureMap *map, const float alfa); +int normalizationAndTruncationFeatureMaps(CvLSVMFeatureMap *map, const float alfa); /* // Feature map reduction @@ -87,7 +87,7 @@ int normalizationAndTruncationFeatureMaps(featureMap *map, const float alfa); // RESULT // Error status */ -int PCAFeatureMaps(featureMap *map); +int PCAFeatureMaps(CvLSVMFeatureMap *map); ////////////////////////////////////////////////////////////// // search object @@ -172,7 +172,7 @@ int clippingBoxes(int width, int height, #ifdef __cplusplus extern "C" #endif -featurePyramid* createFeaturePyramidWithBorder(IplImage *image, +CvLSVMFeaturePyramid* createFeaturePyramidWithBorder(IplImage *image, int maxXBorder, int maxYBorder); /* @@ -204,7 +204,7 @@ featurePyramid* createFeaturePyramidWithBorder(IplImage *image, // RESULT // Error status */ -int searchObject(const featurePyramid *H, const filterObject **all_F, int n, +int searchObject(const CvLSVMFeaturePyramid *H, const CvLSVMFilterObject **all_F, int n, float b, int maxXBorder, int maxYBorder, @@ -242,8 +242,8 @@ int searchObject(const featurePyramid *H, const filterObject **all_F, int n, // RESULT // Error status */ -int searchObjectThreshold(const featurePyramid *H, - const filterObject **all_F, int n, +int searchObjectThreshold(const CvLSVMFeaturePyramid *H, + const CvLSVMFilterObject **all_F, int n, float b, int maxXBorder, int maxYBorder, float scoreThreshold, @@ -278,8 +278,8 @@ int searchObjectThreshold(const featurePyramid *H, #ifdef __cplusplus extern "C" #endif -int searchObjectThresholdSomeComponents(const featurePyramid *H, - const filterObject **filters, +int searchObjectThresholdSomeComponents(const CvLSVMFeaturePyramid *H, + const CvLSVMFilterObject **filters, int kComponents, const int *kPartFilters, const float *b, float scoreThreshold, CvPoint **points, CvPoint **oppPoints, @@ -336,7 +336,7 @@ int getOppositePoint(CvPoint point, // Error status */ int showRootFilterBoxes(IplImage *image, - const filterObject *filter, + const CvLSVMFilterObject *filter, CvPoint *points, int *levels, int kPoints, CvScalar color, int thickness, int line_type, int shift); @@ -367,7 +367,7 @@ int showRootFilterBoxes(IplImage *image, // Error status */ int showPartFilterBoxes(IplImage *image, - const filterObject **filters, + const CvLSVMFilterObject **filters, int n, CvPoint **partsDisplacement, int *levels, int kPoints, CvScalar color, int thickness, diff --git a/modules/objdetect/src/_lsvm_matching.h b/modules/objdetect/src/_lsvm_matching.h index 85e5dc5..2c60cee 100644 --- a/modules/objdetect/src/_lsvm_matching.h +++ b/modules/objdetect/src/_lsvm_matching.h @@ -25,7 +25,7 @@ // 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 @@ -97,9 +97,9 @@ int addNullableBars(float *rot2PIFilter, int dimX, int dimY, // 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 @@ -111,7 +111,7 @@ int getFFTImageFilterObject(const filterObject *filter, // RESULT // Error status */ -int getFFTImageFeatureMap(const featureMap *map, fftImage **image); +int getFFTImageFeatureMap(const CvLSVMFeatureMap *map, CvLSVMFftImage **image); /* // Function for convolution computation using FFT @@ -128,7 +128,7 @@ int getFFTImageFeatureMap(const featureMap *map, fftImage **image); // 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); /* @@ -149,7 +149,7 @@ int convFFTConv2d(const fftImage *featMapImage, const fftImage *filterImage, // 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); @@ -171,7 +171,7 @@ int filterDispositionLevel(const filterObject *Fi, const featureMap *pyramid, // 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); @@ -204,7 +204,7 @@ int computeBorderSize(int maxXBorder, int maxYBorder, int *bx, int *by); // 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 @@ -234,8 +234,8 @@ int addNullableBorder(featureMap *map, int bx, int by); // 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, @@ -271,8 +271,8 @@ int maxFunctionalScoreFixedLevel(const filterObject **all_F, int n, // 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, @@ -306,8 +306,8 @@ int thresholdFunctionalScoreFixedLevel(const filterObject **all_F, int n, // 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, @@ -343,8 +343,8 @@ int maxFunctionalScore(const filterObject **all_F, int n, // 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, @@ -389,7 +389,7 @@ int nonMaximumSuppression(int numBoxes, const CvPoint *points, #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); //} diff --git a/modules/objdetect/src/_lsvm_routine.h b/modules/objdetect/src/_lsvm_routine.h index 05c8333..815389d 100644 --- a/modules/objdetect/src/_lsvm_routine.h +++ b/modules/objdetect/src/_lsvm_routine.h @@ -12,24 +12,24 @@ // 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 diff --git a/modules/objdetect/src/_lsvm_types.h b/modules/objdetect/src/_lsvm_types.h index 5479f45..28ad1b6 100644 --- a/modules/objdetect/src/_lsvm_types.h +++ b/modules/objdetect/src/_lsvm_types.h @@ -1,17 +1,19 @@ #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 @@ -46,7 +48,7 @@ typedef struct{ int p; int xp; float *Map; -} featureMap; +} CvLSVMFeatureMap; // DataType: STRUCT featurePyramid // @@ -56,8 +58,8 @@ typedef struct{ typedef struct{ int countLevel; int lambda; - featureMap **pyramid; -} featurePyramid; + CvLSVMFeatureMap **pyramid; +} CvLSVMFeaturePyramid; // DataType: STRUCT filterDisposition // The structure stores preliminary results in optimization process @@ -70,7 +72,7 @@ typedef struct{ float *score; int *x; int *y; -} filterDisposition; +} CvLSVMFilterDisposition; // DataType: STRUCT fftImage // The structure stores FFT image @@ -84,6 +86,6 @@ typedef struct{ unsigned int dimX; unsigned int dimY; float **channels; -} fftImage; +} CvLSVMFftImage; #endif diff --git a/modules/objdetect/src/_lsvmparser.h b/modules/objdetect/src/_lsvmparser.h index 58804b7..7f92678 100644 --- a/modules/objdetect/src/_lsvmparser.h +++ b/modules/objdetect/src/_lsvmparser.h @@ -46,7 +46,8 @@ #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 @@ -54,7 +55,7 @@ extern "C" const char *modelPath, - filterObject ***filters, + CvLSVMFilterObject ***filters, int *kFilters, int *kComponents, int **kPartFilters, diff --git a/modules/objdetect/src/featurepyramid.cpp b/modules/objdetect/src/featurepyramid.cpp index b05874f..e5e314c 100644 --- a/modules/objdetect/src/featurepyramid.cpp +++ b/modules/objdetect/src/featurepyramid.cpp @@ -29,7 +29,7 @@ int sign(float r){ // RESULT // Error status */ -int getFeatureMaps_dp(const IplImage * image,const int k, featureMap **map) +int getFeatureMaps_dp(const IplImage * image,const int k, CvLSVMFeatureMap **map) { int sizeX, sizeY; int p, px, strsz; @@ -226,7 +226,7 @@ int getFeatureMaps_dp(const IplImage * image,const int k, featureMap **map) // RESULT // Error status */ -int normalizationAndTruncationFeatureMaps(featureMap *map, const float alfa) +int normalizationAndTruncationFeatureMaps(CvLSVMFeatureMap *map, const float alfa) { int i,j, ii; int sizeX, sizeY, p, pos, pp, xp, pos1, pos2; @@ -351,7 +351,7 @@ int normalizationAndTruncationFeatureMaps(featureMap *map, const float alfa) // RESULT // Error status */ -int PCAFeatureMaps(featureMap *map) +int PCAFeatureMaps(CvLSVMFeatureMap *map) { int i,j, ii, jj, k; int sizeX, sizeY, p, pp, xp, yp, pos1, pos2; @@ -447,7 +447,7 @@ int PCAFeatureMaps(featureMap *map) int getFeaturePyramid(IplImage * image, const int lambda, const int k, const int startX, const int startY, - const int W, const int H, featurePyramid **maps) + const int W, const int H, CvLSVMFeaturePyramid **maps) { IplImage *img2, *imgTmp, *imgResize; float step, tmp; @@ -455,7 +455,7 @@ int getFeaturePyramid(IplImage * image, int maxcall; int i; int err; - featureMap *map; + CvLSVMFeatureMap *map; //geting subimage cvSetImageROI(image, cvRect(startX, startY, W, H)); @@ -534,7 +534,7 @@ int getFeaturePyramid(IplImage * image, // RESULT // Error status */ -int addBordersToFeatureMaps(featureMap *map, const int bX, const int bY){ +int addBordersToFeatureMaps(CvLSVMFeatureMap *map, const int bX, const int bY){ int i,j, jj; int sizeX, sizeY, p, pos1, pos2; float * new_data; diff --git a/modules/objdetect/src/latentsvm.cpp b/modules/objdetect/src/latentsvm.cpp index 0b5a5fc..5a08514 100644 --- a/modules/objdetect/src/latentsvm.cpp +++ b/modules/objdetect/src/latentsvm.cpp @@ -118,13 +118,13 @@ int clippingBoxes(int width, int height, // RESULT // Feature pyramid with nullable border */ -featurePyramid* createFeaturePyramidWithBorder(IplImage *image, +CvLSVMFeaturePyramid* createFeaturePyramidWithBorder(IplImage *image, int maxXBorder, int maxYBorder) { int opResult; int bx, by; int level; - featurePyramid *H; + CvLSVMFeaturePyramid *H; // Obtaining feature pyramid opResult = getFeaturePyramid(image, LAMBDA, SIDE_LENGTH, 0, 0, @@ -175,7 +175,7 @@ featurePyramid* createFeaturePyramidWithBorder(IplImage *image, // RESULT // Error status */ -int searchObject(const featurePyramid *H, const filterObject **all_F, +int searchObject(const CvLSVMFeaturePyramid *H, const CvLSVMFilterObject **all_F, int n, float b, int maxXBorder, int maxYBorder, @@ -265,8 +265,8 @@ int estimateBoxes(CvPoint *points, int *levels, int kPoints, // RESULT // Error status */ -int searchObjectThreshold(const featurePyramid *H, - const filterObject **all_F, int n, +int searchObjectThreshold(const CvLSVMFeaturePyramid *H, + const CvLSVMFilterObject **all_F, int n, float b, int maxXBorder, int maxYBorder, float scoreThreshold, @@ -356,7 +356,7 @@ int getOppositePoint(CvPoint point, // Error status */ int showRootFilterBoxes(IplImage *image, - const filterObject *filter, + const CvLSVMFilterObject *filter, CvPoint *points, int *levels, int kPoints, CvScalar color, int thickness, int line_type, int shift) @@ -404,7 +404,7 @@ int showRootFilterBoxes(IplImage *image, // Error status */ int showPartFilterBoxes(IplImage *image, - const filterObject **filters, + const CvLSVMFilterObject **filters, int n, CvPoint **partsDisplacement, int *levels, int kPoints, CvScalar color, int thickness, @@ -484,7 +484,7 @@ int showBoxes(IplImage *img, // RESULT // Error status */ -int getMaxFilterDims(const filterObject **filters, int kComponents, +int getMaxFilterDims(const CvLSVMFilterObject **filters, int kComponents, const int *kPartFilters, unsigned int *maxXBorder, unsigned int *maxYBorder) { @@ -532,8 +532,8 @@ int getMaxFilterDims(const filterObject **filters, int kComponents, // RESULT // Error status */ -int searchObjectThresholdSomeComponents(const featurePyramid *H, - const filterObject **filters, +int searchObjectThresholdSomeComponents(const CvLSVMFeaturePyramid *H, + const CvLSVMFilterObject **filters, int kComponents, const int *kPartFilters, const float *b, float scoreThreshold, CvPoint **points, CvPoint **oppPoints, diff --git a/modules/objdetect/src/latentsvmdetector.cpp b/modules/objdetect/src/latentsvmdetector.cpp index 336a360..f0f1d79 100644 --- a/modules/objdetect/src/latentsvmdetector.cpp +++ b/modules/objdetect/src/latentsvmdetector.cpp @@ -16,7 +16,7 @@ CvLatentSvmDetector* cvLoadLatentSvmDetector(const char* filename) { CvLatentSvmDetector* detector = 0; - filterObject** filters = 0; + CvLSVMFilterObject** filters = 0; int kFilters = 0; int kComponents = 0; int* kPartFilters = 0; @@ -84,7 +84,7 @@ CvSeq* cvLatentSvmDetectObjects(IplImage* image, CvMemStorage* storage, float overlap_threshold) { - featurePyramid *H = 0; + CvLSVMFeaturePyramid *H = 0; CvPoint *points = 0, *oppPoints = 0; int kPoints = 0; float *score = 0; @@ -97,11 +97,11 @@ CvSeq* cvLatentSvmDetectObjects(IplImage* image, cvConvertImage(image, image, CV_CVTIMG_SWAP_RB); // Getting maximum filter dimensions - getMaxFilterDims((const filterObject**)(detector->filters), detector->num_components, detector->num_part_filters, &maxXBorder, &maxYBorder); + getMaxFilterDims((const CvLSVMFilterObject**)(detector->filters), detector->num_components, detector->num_part_filters, &maxXBorder, &maxYBorder); // Create feature pyramid with nullable border H = createFeaturePyramidWithBorder(image, maxXBorder, maxYBorder); // Search object - searchObjectThresholdSomeComponents(H, (const filterObject**)(detector->filters), detector->num_components, + searchObjectThresholdSomeComponents(H, (const CvLSVMFilterObject**)(detector->filters), detector->num_components, detector->num_part_filters, detector->b, detector->score_threshold, &points, &oppPoints, &score, &kPoints); // Clipping boxes diff --git a/modules/objdetect/src/lsvmparser.cpp b/modules/objdetect/src/lsvmparser.cpp index a87416f..30f0591 100644 --- a/modules/objdetect/src/lsvmparser.cpp +++ b/modules/objdetect/src/lsvmparser.cpp @@ -163,23 +163,23 @@ int getTeg(char *str){ return sum; } -void addFilter(filterObject *** model, int *last, int *max){ - filterObject ** nmodel; +void addFilter(CvLSVMFilterObject *** model, int *last, int *max){ + CvLSVMFilterObject ** nmodel; int i; (*last) ++; if((*last) >= (*max)){ (*max) += 10; - nmodel = (filterObject **)malloc(sizeof(filterObject *) * (*max)); + nmodel = (CvLSVMFilterObject **)malloc(sizeof(CvLSVMFilterObject *) * (*max)); for(i = 0; i < *last; i++){ nmodel[i] = (* model)[i]; } free(* model); (*model) = nmodel; } - (*model) [(*last)] = (filterObject *)malloc(sizeof(filterObject)); + (*model) [(*last)] = (CvLSVMFilterObject *)malloc(sizeof(CvLSVMFilterObject)); } -void parserRFilter (FILE * xmlf, int p, filterObject * model, float *b){ +void parserRFilter (FILE * xmlf, int p, CvLSVMFilterObject * model, float *b){ int st = 0; int sizeX, sizeY; int tag; @@ -278,7 +278,7 @@ void parserRFilter (FILE * xmlf, int p, filterObject * model, float *b){ } } -void parserV (FILE * xmlf, int p, filterObject * model){ +void parserV (FILE * xmlf, int p, CvLSVMFilterObject * model){ int st = 0; int tag; int tagVal; @@ -341,7 +341,7 @@ void parserV (FILE * xmlf, int p, filterObject * model){ } } } -void parserD (FILE * xmlf, int p, filterObject * model){ +void parserD (FILE * xmlf, int p, CvLSVMFilterObject * model){ int st = 0; int tag; int tagVal; @@ -430,7 +430,7 @@ void parserD (FILE * xmlf, int p, filterObject * model){ } } -void parserPFilter (FILE * xmlf, int p, int N_path, filterObject * model){ +void parserPFilter (FILE * xmlf, int p, int N_path, CvLSVMFilterObject * model){ int st = 0; int sizeX, sizeY; int tag; @@ -524,7 +524,7 @@ void parserPFilter (FILE * xmlf, int p, int N_path, filterObject * model){ } } } -void parserPFilterS (FILE * xmlf, int p, filterObject *** model, int *last, int *max){ +void parserPFilterS (FILE * xmlf, int p, CvLSVMFilterObject *** model, int *last, int *max){ int st = 0; int N_path = 0; int tag; @@ -573,7 +573,7 @@ void parserPFilterS (FILE * xmlf, int p, filterObject *** model, int *last, int } } } -void parserComp (FILE * xmlf, int p, int *N_comp, filterObject *** model, float *b, int *last, int *max){ +void parserComp (FILE * xmlf, int p, int *N_comp, CvLSVMFilterObject *** model, float *b, int *last, int *max){ int st = 0; int tag; int tagVal; @@ -623,7 +623,7 @@ void parserComp (FILE * xmlf, int p, int *N_comp, filterObject *** model, float } } } -void parserModel(FILE * xmlf, filterObject *** model, int *last, int *max, int **comp, float **b, int *count, float * score){ +void parserModel(FILE * xmlf, CvLSVMFilterObject *** model, int *last, int *max, int **comp, float **b, int *count, float * score){ int p = 0; int N_comp = 0; int * cmp; @@ -720,7 +720,7 @@ void parserModel(FILE * xmlf, filterObject *** model, int *last, int *max, int * } } -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){ int st = 0; int tag; char ch; @@ -731,7 +731,7 @@ int LSVMparser(const char * filename, filterObject *** model, int *last, int *ma (*max) = 10; (*last) = -1; - (*model) = (filterObject ** )malloc((sizeof(filterObject * )) * (*max)); + (*model) = (CvLSVMFilterObject ** )malloc((sizeof(CvLSVMFilterObject * )) * (*max)); //printf("parse : %s\n", filename); @@ -773,8 +773,7 @@ int LSVMparser(const char * filename, filterObject *** model, int *last, int *ma int loadModel( const char *modelPath, - - filterObject ***filters, + CvLSVMFilterObject ***filters, int *kFilters, int *kComponents, int **kPartFilters, diff --git a/modules/objdetect/src/matching.cpp b/modules/objdetect/src/matching.cpp index 6396178..94170f9 100644 --- a/modules/objdetect/src/matching.cpp +++ b/modules/objdetect/src/matching.cpp @@ -21,7 +21,7 @@ // RESULT // Error status */ -int convolution(const filterObject *Fi, const featureMap *map, float *f) +int convolution(const CvLSVMFilterObject *Fi, const CvLSVMFeatureMap *map, float *f) { int n1, m1, n2, m2, p, size, diff1, diff2; int i1, i2, j1, j2, k; @@ -161,7 +161,7 @@ int addNullableBars(float *rot2PIFilter, int dimX, int dimY, // Computation FFT image for filter object // // API -// int getFFTImageFilterObject(const filterObject *filter, +// int getFFTImageFilterObject(const CvLSVMFilterObject *filter, int mapDimX, int mapDimY, fftImage **image); // INPUT @@ -172,9 +172,9 @@ int addNullableBars(float *rot2PIFilter, int dimX, int dimY, // RESULT // Error status */ -int getFFTImageFilterObject(const filterObject *filter, +int getFFTImageFilterObject(const CvLSVMFilterObject *filter, int mapDimX, int mapDimY, - fftImage **image) + CvLSVMFftImage **image) { unsigned int i, mapSize, filterSize; int res; @@ -211,7 +211,7 @@ int getFFTImageFilterObject(const filterObject *filter, // RESULT // Error status */ -int getFFTImageFeatureMap(const featureMap *map, fftImage **image) +int getFFTImageFeatureMap(const CvLSVMFeatureMap *map, CvLSVMFftImage **image) { int i, j, size; float *buf; @@ -246,7 +246,7 @@ int getFFTImageFeatureMap(const featureMap *map, fftImage **image) // 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) { int i, j, size, diffX, diffY, index; @@ -289,7 +289,7 @@ int convFFTConv2d(const fftImage *featMapImage, const fftImage *filterImage, // Computation objective function D according the original paper // // API -// int filterDispositionLevel(const filterObject *Fi, const featurePyramid *H, +// int filterDispositionLevel(const CvLSVMFilterObject *Fi, const featurePyramid *H, int level, float **scoreFi, int **pointsX, int **pointsY); // INPUT @@ -304,7 +304,7 @@ int convFFTConv2d(const fftImage *featMapImage, const fftImage *filterImage, // 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) { @@ -375,7 +375,7 @@ int filterDispositionLevel(const filterObject *Fi, const featureMap *pyramid, // Computation objective function D according the original paper using FFT // // API -// int filterDispositionLevelFFT(const filterObject *Fi, const fftImage *featMapImage, +// int filterDispositionLevelFFT(const CvLSVMFilterObject *Fi, const fftImage *featMapImage, float **scoreFi, int **pointsX, int **pointsY); // INPUT @@ -389,7 +389,7 @@ int filterDispositionLevel(const filterObject *Fi, const featureMap *pyramid, // 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) { @@ -397,7 +397,7 @@ int filterDispositionLevelFFT(const filterObject *Fi, const fftImage *featMapIma float *f; int i1, j1; int res; - fftImage *filterImage; + CvLSVMFftImage *filterImage; n1 = featMapImage->dimY; m1 = featMapImage->dimX; @@ -493,7 +493,7 @@ int computeBorderSize(int maxXBorder, int maxYBorder, int *bx, int *by) // RESULT // Error status */ -int addNullableBorder(featureMap *map, int bx, int by) +int addNullableBorder(CvLSVMFeatureMap *map, int bx, int by) { int sizeX, sizeY, i, j, k; float *new_map; @@ -522,12 +522,12 @@ int addNullableBorder(featureMap *map, int bx, int by) return LATENT_SVM_OK; } -featureMap* featureMapBorderPartFilter(featureMap *map, +CvLSVMFeatureMap* featureMapBorderPartFilter(CvLSVMFeatureMap *map, int maxXBorder, int maxYBorder) { int bx, by; int sizeX, sizeY, i, j, k; - featureMap *new_map; + CvLSVMFeatureMap *new_map; computeBorderSize(maxXBorder, maxYBorder, &bx, &by); sizeX = map->sizeX + 2 * bx; @@ -555,7 +555,7 @@ featureMap* featureMapBorderPartFilter(featureMap *map, // Computation the maximum of the score function at the level // // API -// int maxFunctionalScoreFixedLevel(const filterObject **all_F, int n, +// int maxFunctionalScoreFixedLevel(const CvLSVMFilterObject **all_F, int n, const featurePyramid *H, int level, float b, int maxXBorder, int maxYBorder, @@ -579,8 +579,8 @@ featureMap* featureMapBorderPartFilter(featureMap *map, // 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, @@ -588,14 +588,14 @@ int maxFunctionalScoreFixedLevel(const filterObject **all_F, int n, { int i, j, k, dimX, dimY, nF0, mF0, p; int diff1, diff2, index, last, partsLevel; - filterDisposition **disposition; + CvLSVMFilterDisposition **disposition; float *f; float *scores; float sumScorePartDisposition, maxScore; int res; - featureMap *map; + CvLSVMFeatureMap *map; #ifdef FFT_CONV - fftImage *rootFilterImage, *mapImage; + CvLSVMFftImage *rootFilterImage, *mapImage; #else #endif @@ -631,10 +631,10 @@ int maxFunctionalScoreFixedLevel(const filterObject **all_F, int n, // Allocation memory for saving values of function D // on the level for each part filter - disposition = (filterDisposition **)malloc(sizeof(filterDisposition *) * n); + disposition = (CvLSVMFilterDisposition **)malloc(sizeof(CvLSVMFilterDisposition *) * n); for (i = 0; i < n; i++) { - disposition[i] = (filterDisposition *)malloc(sizeof(filterDisposition)); + disposition[i] = (CvLSVMFilterDisposition *)malloc(sizeof(CvLSVMFilterDisposition)); } // Allocation memory for values of score function for each block on the level @@ -801,7 +801,7 @@ int maxFunctionalScoreFixedLevel(const filterObject **all_F, int n, // Computation score function at the level that exceed threshold // // API -// int thresholdFunctionalScoreFixedLevel(const filterObject **all_F, int n, +// int thresholdFunctionalScoreFixedLevel(const CvLSVMFilterObject **all_F, int n, const featurePyramid *H, int level, float b, int maxXBorder, int maxYBorder, @@ -827,8 +827,8 @@ int maxFunctionalScoreFixedLevel(const filterObject **all_F, int n, // 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, @@ -837,14 +837,14 @@ int thresholdFunctionalScoreFixedLevel(const filterObject **all_F, int n, { int i, j, k, dimX, dimY, nF0, mF0, p; int diff1, diff2, index, last, partsLevel; - filterDisposition **disposition; + CvLSVMFilterDisposition **disposition; float *f; float *scores; float sumScorePartDisposition; int res; - featureMap *map; + CvLSVMFeatureMap *map; #ifdef FFT_CONV - fftImage *rootFilterImage, *mapImage; + CvLSVMFftImage *rootFilterImage, *mapImage; #else #endif /* @@ -879,10 +879,10 @@ int thresholdFunctionalScoreFixedLevel(const filterObject **all_F, int n, // Allocation memory for saving values of function D // on the level for each part filter - disposition = (filterDisposition **)malloc(sizeof(filterDisposition *) * n); + disposition = (CvLSVMFilterDisposition **)malloc(sizeof(CvLSVMFilterDisposition *) * n); for (i = 0; i < n; i++) { - disposition[i] = (filterDisposition *)malloc(sizeof(filterDisposition)); + disposition[i] = (CvLSVMFilterDisposition *)malloc(sizeof(CvLSVMFilterDisposition)); } // Allocation memory for values of score function for each block on the level @@ -1038,7 +1038,7 @@ int thresholdFunctionalScoreFixedLevel(const filterObject **all_F, int n, // Computation the maximum of the score function // // API -// int maxFunctionalScore(const filterObject **all_F, int n, +// int maxFunctionalScore(const CvLSVMFilterObject **all_F, int n, const featurePyramid *H, float b, int maxXBorder, int maxYBorder, float *score, @@ -1061,8 +1061,8 @@ int thresholdFunctionalScoreFixedLevel(const filterObject **all_F, int n, // 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, @@ -1197,7 +1197,7 @@ int maxFunctionalScore(const filterObject **all_F, int n, // Computation score function that exceed threshold // // API -// int thresholdFunctionalScore(const filterObject **all_F, int n, +// int thresholdFunctionalScore(const CvLSVMFilterObject **all_F, int n, const featurePyramid *H, float b, int maxXBorder, int maxYBorder, @@ -1223,8 +1223,8 @@ int maxFunctionalScore(const filterObject **all_F, int n, // 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, diff --git a/modules/objdetect/src/routine.cpp b/modules/objdetect/src/routine.cpp index 5cb3a88..fbf8d98 100644 --- a/modules/objdetect/src/routine.cpp +++ b/modules/objdetect/src/routine.cpp @@ -1,9 +1,9 @@ #include "precomp.hpp" #include "_lsvm_routine.h" -int allocFilterObject(filterObject **obj, const int sizeX, const int sizeY, const int p, const int xp){ +int allocFilterObject(CvLSVMFilterObject **obj, const int sizeX, const int sizeY, const int p, const int xp){ int i; - (*obj) = (filterObject *)malloc(sizeof(filterObject)); + (*obj) = (CvLSVMFilterObject *)malloc(sizeof(CvLSVMFilterObject)); (*obj)->sizeX = sizeX; (*obj)->sizeY = sizeY; (*obj)->p = p ; @@ -21,7 +21,7 @@ int allocFilterObject(filterObject **obj, const int sizeX, const int sizeY, cons } return LATENT_SVM_OK; } -int freeFilterObject (filterObject **obj){ +int freeFilterObject (CvLSVMFilterObject **obj){ if(*obj == NULL) return 0; free((*obj)->H); free(*obj); @@ -29,9 +29,9 @@ int freeFilterObject (filterObject **obj){ return LATENT_SVM_OK; } -int allocFeatureMapObject(featureMap **obj, const int sizeX, const int sizeY, const int p, const int xp){ +int allocFeatureMapObject(CvLSVMFeatureMap **obj, const int sizeX, const int sizeY, const int p, const int xp){ int i; - (*obj) = (featureMap *)malloc(sizeof(featureMap)); + (*obj) = (CvLSVMFeatureMap *)malloc(sizeof(CvLSVMFeatureMap)); (*obj)->sizeX = sizeX; (*obj)->sizeY = sizeY; (*obj)->p = p ; @@ -42,7 +42,7 @@ int allocFeatureMapObject(featureMap **obj, const int sizeX, const int sizeY, co } return LATENT_SVM_OK; } -int freeFeatureMapObject (featureMap **obj){ +int freeFeatureMapObject (CvLSVMFeatureMap **obj){ if(*obj == NULL) return 0; free((*obj)->Map); free(*obj); @@ -50,15 +50,15 @@ int freeFeatureMapObject (featureMap **obj){ return LATENT_SVM_OK; } -int allocFeaturePyramidObject(featurePyramid **obj, const int lambda, const int countLevel){ - (*obj) = (featurePyramid *)malloc(sizeof(featurePyramid)); +int allocFeaturePyramidObject(CvLSVMFeaturePyramid **obj, const int lambda, const int countLevel){ + (*obj) = (CvLSVMFeaturePyramid *)malloc(sizeof(CvLSVMFeaturePyramid)); (*obj)->countLevel = countLevel; - (*obj)->pyramid = (featureMap **)malloc(sizeof(featureMap *) * countLevel); + (*obj)->pyramid = (CvLSVMFeatureMap **)malloc(sizeof(CvLSVMFeatureMap *) * countLevel); (*obj)->lambda = lambda; return LATENT_SVM_OK; } -int freeFeaturePyramidObject (featurePyramid **obj){ +int freeFeaturePyramidObject (CvLSVMFeaturePyramid **obj){ int i; if(*obj == NULL) return 0; for(i = 0; i < (*obj)->countLevel; i++) @@ -69,10 +69,10 @@ int freeFeaturePyramidObject (featurePyramid **obj){ return LATENT_SVM_OK; } -int allocFFTImage(fftImage **image, int p, int dimX, int dimY) +int allocFFTImage(CvLSVMFftImage **image, int p, int dimX, int dimY) { int i, j, size; - *image = (fftImage *)malloc(sizeof(fftImage)); + *image = (CvLSVMFftImage *)malloc(sizeof(CvLSVMFftImage)); (*image)->p = p; (*image)->dimX = dimX; (*image)->dimY = dimY; @@ -89,7 +89,7 @@ int allocFFTImage(fftImage **image, int p, int dimX, int dimY) return LATENT_SVM_OK; } -int freeFFTImage(fftImage **image) +int freeFFTImage(CvLSVMFftImage **image) { unsigned int i; if (*image == NULL) return LATENT_SVM_OK; -- 2.7.4