]> rtime.felk.cvut.cz Git - opencv.git/commitdiff
fixed several compiler warnings
authorvp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Wed, 2 Aug 2006 17:05:56 +0000 (17:05 +0000)
committervp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Wed, 2 Aug 2006 17:05:56 +0000 (17:05 +0000)
git-svn-id: https://code.ros.org/svn/opencv/trunk@686 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08

14 files changed:
opencv/include/opencv/cvvidsurv.hpp
opencv/include/opencv/ml.h
opencv/src/cv/cvhough.cpp
opencv/src/cvaux/cvlee.cpp
opencv/src/cxcore/cxpersistence.cpp
opencv/src/cxcore/cxswitcher.cpp
opencv/src/ml/ml_inner_functions.cpp
opencv/src/ml/mlann_mlp.cpp
opencv/src/ml/mlem.cpp
opencv/src/ml/mlrtrees.cpp
opencv/src/ml/mlsvm.cpp
opencv/src/ml/mltree.cpp
opencv/tests/cv/src/afloodfill.cpp
opencv/tests/cxcore/src/amath.cpp

index 8d2ce5a59422a1add943c692a33588eb167a2a94..de18d5fa3dd7c314d3043c3384b82f46453d038e 100644 (file)
@@ -434,7 +434,7 @@ inline CvBlob cvBlob(float x,float y, float w, float h)
 {
     CvBlob B = {x,y,w,h,0}; 
     return B;
-};
+}
 #define CV_BLOB_MINW 5
 #define CV_BLOB_MINH 5
 #define CV_BLOB_ID(pB) (((CvBlob*)(pB))->ID)
@@ -792,7 +792,7 @@ public:
         CvBlob* pB;
         int ID = 0;
         assert(pBlob);
-        pBlob->ID;
+        //pBlob->ID;
         pB = GetBlob(BlobIndex);
         if(pB)
             pBlob[0] = pB[0];
@@ -1026,7 +1026,7 @@ inline void cvReleaseBlobTrackAnalysis(CvBlobTrackAnalysis** pBTPP)
 }
 
 /* feature vector generation module */
-class CV_EXPORTS CvBlobTrackFVGen:CvVSModule
+class CV_EXPORTS CvBlobTrackFVGen : public CvVSModule
 {
 public:
     virtual void    AddBlob(CvBlob* pBlob) = 0;
@@ -1180,7 +1180,7 @@ public:
     virtual void Scale(float factor = 0, int x = -1, int y = -1) = 0;
     virtual void Release() = 0;
 };
-inline void cvReleaseProb(CvProb** ppProb){ppProb[0]->Release();ppProb[0]=NULL;};
+inline void cvReleaseProb(CvProb** ppProb){ppProb[0]->Release();ppProb[0]=NULL;}
 /* HIST API */
 
 /* some Prob */
@@ -1200,7 +1200,7 @@ inline CvProb* cvCreateProb(int type, int dim, CvSize size = cvSize(1,1), void*
     if(type == CV_BT_HIST_TYPE_MG2) return cvCreateProbMG2(dim, size, -1);
     if(type == CV_BT_HIST_TYPE_H) return cvCreateProbHist(dim, size);
     return NULL;
-};
+}
 
 
 
index 6f3ce24234709b9dffee983ba5f98595bb5666b6..c1c1df7d404cd826d1e889a12bb179a4538b2f0c 100644 (file)
@@ -858,6 +858,10 @@ public:
 
     virtual void read( CvFileStorage* fs, CvFileNode* node );
     virtual void write( CvFileStorage* fs, const char* name );
+    
+    const CvDTreeNode* get_root() const;
+    int get_pruned_tree_idx() const;
+    CvDTreeTrainData* get_data();
 
 protected:
 
index a5ddef178ec3cfd4df2b7670bf561403305546e0..2f95fc19400fee2d9e43710f76d538f60766ab3c 100644 (file)
@@ -556,7 +556,7 @@ icvHoughLinesProbabalistic( CvMat* image,
     {
         // choose random point out of the remaining ones
         int idx = cvRandInt(&rng) % count;
-        int max_val = threshold-1, max_r = 0, max_n = 0;
+        int max_val = threshold-1, max_n = 0;
         CvPoint* pt = (CvPoint*)cvGetSeqElem( seq, idx );
         CvPoint line_end[2] = {{0,0}, {0,0}};
         float a, b;
@@ -584,7 +584,6 @@ icvHoughLinesProbabalistic( CvMat* image,
             if( max_val < val )
             {
                 max_val = val;
-                max_r = r;
                 max_n = n;
             }
         }
@@ -755,7 +754,6 @@ cvHoughLines2( CvArr* src_image, void* lineStorage, int method,
     CvSeqBlock lines_block;
     int lineType, elemSize;
     int linesMax = INT_MAX;
-    CvSize size;
     int iparam1, iparam2;
 
     CV_CALL( img = cvGetMat( img, &stub ));
@@ -806,7 +804,6 @@ cvHoughLines2( CvArr* src_image, void* lineStorage, int method,
         CV_ERROR( CV_StsBadArg, "Destination is not CvMemStorage* nor CvMat*" );
     }
 
-    size = cvGetMatSize(img);
     iparam1 = cvRound(param1);
     iparam2 = cvRound(param2);
 
@@ -871,7 +868,6 @@ icvHoughCirclesGradient( CvMat* img, float dp, float min_dist,
     int rows, cols, arows, acols;
     int astep, *adata;
     float* ddata;
-    CvSize asize;
     CvSeq *nz, *centers;
     float idp, dr;
     CvSeqReader reader;
@@ -889,7 +885,6 @@ icvHoughCirclesGradient( CvMat* img, float dp, float min_dist,
     idp = 1.f/dp;
     CV_CALL( accum = cvCreateMat( cvCeil(img->rows*idp)+2, cvCeil(img->cols*idp)+2, CV_32SC1 ));
     CV_CALL( cvZero(accum));
-    asize = cvGetMatSize(accum);
 
     CV_CALL( storage = cvCreateMemStorage() );
     CV_CALL( nz = cvCreateSeq( CV_32SC2, sizeof(CvSeq), sizeof(CvPoint), storage ));
@@ -1000,7 +995,7 @@ icvHoughCirclesGradient( CvMat* img, float dp, float min_dist,
         x = ofs - (y+1)*(acols+2) - 1;
         float cx = (float)(x*dp), cy = (float)(y*dp);
         int start_idx = nz_count - 1;
-        float start_dist, prev_dist, dist_sum;
+        float start_dist, dist_sum;
         float r_best = 0, c[3];
         int max_count = R_THRESH;
 
@@ -1028,7 +1023,7 @@ icvHoughCirclesGradient( CvMat* img, float dp, float min_dist,
         cvPow( dist_buf, dist_buf, 0.5 );
         icvHoughSortDescent32s( sort_buf, nz_count, (int*)ddata );
         
-        dist_sum = prev_dist = start_dist = ddata[sort_buf[nz_count-1]];
+        dist_sum = start_dist = ddata[sort_buf[nz_count-1]];
         for( j = nz_count - 2; j >= 0; j-- )
         {
             float d = ddata[sort_buf[j]];
@@ -1044,7 +1039,6 @@ icvHoughCirclesGradient( CvMat* img, float dp, float min_dist,
                 dist_sum = 0;
             }
             dist_sum += d;
-            prev_dist = d;
         }
 
         if( max_count > R_THRESH )
@@ -1088,7 +1082,6 @@ cvHoughCircles( CvArr* src_image, void* circle_storage,
     int circles_max = INT_MAX;
     int canny_threshold = cvRound(param1);
     int acc_threshold = cvRound(param2);
-    CvSize size;
 
     CV_CALL( img = cvGetMat( img, &stub ));
 
@@ -1125,8 +1118,6 @@ cvHoughCircles( CvArr* src_image, void* circle_storage,
         CV_ERROR( CV_StsBadArg, "Destination is not CvMemStorage* nor CvMat*" );
     }
 
-    size = cvGetMatSize(img);
-
     switch( method )
     {
     case CV_HOUGH_GRADIENT:
index 2b61e477f4c2c80ba14759dbd72245523084b53f..58db0d020d300ee8627cf38e70d3c7ca5ec96da6 100644 (file)
@@ -541,9 +541,9 @@ pVoronoiDiagram : in, pointer to struct, which contains the
 static int _cvMergeVD(pCvVoronoiHole pHole,CvVoronoiDiagramInt* pVoronoiDiagram);
 
 
-/*////////////////////////////////////////////////////////////////////////////////////////
+/* ///////////////////////////////////////////////////////////////////////////////////////
 //                               Computation of bisectors                               //
-////////////////////////////////////////////////////////////////////////////////////////*/
+/////////////////////////////////////////////////////////////////////////////////////// */
 
 /*--------------------------------------------------------------------------
     Author      : Andrey Sobolev
@@ -663,9 +663,9 @@ void _cvCalcEdgeLP(pCvVoronoiSite pDirectrice,
                   pCvVoronoiEdge pEdge,
                   CvVoronoiDiagramInt* pVoronoiDiagram);
 
-/*////////////////////////////////////////////////////////////////////////////////////////
+/* ///////////////////////////////////////////////////////////////////////////////////////
 //                  Computation of intersections of bisectors                           //
-////////////////////////////////////////////////////////////////////////////////////////*/
+/////////////////////////////////////////////////////////////////////////////////////// */
 
 /*--------------------------------------------------------------------------
     Author      : Andrey Sobolev
@@ -908,9 +908,9 @@ float _cvPar_CloseParIntersection(pCvVoronoiEdge pEdge1,
                             pCvPointFloat  pPoint,
                             float &Radius);
 
-/*////////////////////////////////////////////////////////////////////////////////////////
+/* ///////////////////////////////////////////////////////////////////////////////////////
 //                           Subsidiary functions                                       //
-////////////////////////////////////////////////////////////////////////////////////////*/
+/////////////////////////////////////////////////////////////////////////////////////// */
 
 /*--------------------------------------------------------------------------
     Author      : Andrey Sobolev
@@ -1112,9 +1112,9 @@ pCvVoronoiEdge _cvDivideLeftEdge(pCvVoronoiEdge pEdge,
 template<class T> CV_INLINE
 T _cvWriteSeqElem(T pElem, CvSeqWriter &writer);
 
-/*////////////////////////////////////////////////////////////////////////////////////////
+/* ///////////////////////////////////////////////////////////////////////////////////////
 //                           Mathematical functions                                     //
-////////////////////////////////////////////////////////////////////////////////////////*/
+/////////////////////////////////////////////////////////////////////////////////////// */
 
 /*--------------------------------------------------------------------------
     Author      : Andrey Sobolev
@@ -3350,9 +3350,9 @@ RESULTHANDLING:
 }// end of _cvMergeVD
 
 
-/*////////////////////////////////////////////////////////////////////////////////////////
+/* ///////////////////////////////////////////////////////////////////////////////////////
 //                               Computation of bisectors                               //
-////////////////////////////////////////////////////////////////////////////////////////*/
+/////////////////////////////////////////////////////////////////////////////////////// */
 
 void _cvCalcEdge(pCvVoronoiSite pSite_left, 
                  pCvVoronoiSite pSite_right,
@@ -3493,9 +3493,9 @@ void _cvCalcEdgeLP(pCvVoronoiSite pDirectrice,
     pEdge->parabola = pParabola;
 }//end of _cvCalcEdgeLP
 
-/*////////////////////////////////////////////////////////////////////////////////////////
+/* ///////////////////////////////////////////////////////////////////////////////////////
 //                  Computation of intersections of bisectors                           //
-////////////////////////////////////////////////////////////////////////////////////////*/
+/////////////////////////////////////////////////////////////////////////////////////// */
 
 static 
 float _cvCalcEdgeIntersection(pCvVoronoiEdge pEdge1,
@@ -4347,9 +4347,9 @@ float _cvPar_CloseParIntersection(pCvVoronoiEdge pEdge1,
         return dist;
 }// end of _cvPar_CloseParIntersection
 
-/*////////////////////////////////////////////////////////////////////////////////////////
+/* ///////////////////////////////////////////////////////////////////////////////////////
 //                           Subsidiary functions                                       //
-////////////////////////////////////////////////////////////////////////////////////////*/
+/////////////////////////////////////////////////////////////////////////////////////// */
 
 CV_INLINE
 void _cvMakeTwinEdge(pCvVoronoiEdge pEdge2,
@@ -4573,9 +4573,9 @@ T _cvWriteSeqElem(T pElem, CvSeqWriter &writer)
     return ptr;
 }//end of _cvWriteSeqElem
 
-/*////////////////////////////////////////////////////////////////////////////////////////
+/* ///////////////////////////////////////////////////////////////////////////////////////
 //                           Mathematical functions                                     //
-////////////////////////////////////////////////////////////////////////////////////////*/
+/////////////////////////////////////////////////////////////////////////////////////// */
 
 template<class T> CV_INLINE
 void _cvCalcPointImage(pCvPointFloat pImgPoint,pCvPointFloat pPoint,T* A)
index b4f2ea8b8dd7550e68a638c098653e4940a4ff30..067a165dec97a07cee27ce48283d0945d0c35613 100644 (file)
@@ -4917,17 +4917,7 @@ cvUnregisterType( const char* type_name )
 CV_IMPL CvTypeInfo*
 cvFirstType( void )
 {
-    CvTypeInfo* info = 0;
-
-    CV_FUNCNAME("cvFirstType" );
-
-    __BEGIN__;
-
-    info = CvType::first;
-
-    __END__;
-
-    return info;
+    return CvType::first;
 }
 
 
@@ -4936,16 +4926,10 @@ cvFindType( const char* type_name )
 {
     CvTypeInfo* info = 0;
 
-    //CV_FUNCNAME("cvFindType" );
-
-    __BEGIN__;
-
     for( info = CvType::first; info != 0; info = info->next )
         if( strcmp( info->type_name, type_name ) == 0 )
             break;
 
-    __END__;
-
     return info;
 }
 
@@ -4955,16 +4939,10 @@ cvTypeOf( const void* struct_ptr )
 {
     CvTypeInfo* info = 0;
 
-    /*CV_FUNCNAME("cvFindType" );*/
-
-    __BEGIN__;
-
     for( info = CvType::first; info != 0; info = info->next )
         if( info->is_instance( struct_ptr ))
             break;
 
-    __END__;
-
     return info;
 }
 
@@ -5119,13 +5097,13 @@ cvSave( const char* filename, const void* struct_ptr,
         ptr++;
         if( ptr == ptr2 )
             CV_ERROR( CV_StsBadArg, "Invalid filename" );
-               
-               name=name_buf;
+        
+        name=name_buf;
 
-               // name must start with letter or '_'
-               if( !isalpha(*ptr) && *ptr!= '_' ){
-                       *name++ = '_';
-               }
+        // name must start with letter or '_'
+        if( !isalpha(*ptr) && *ptr!= '_' ){
+            *name++ = '_';
+        }
 
         while( ptr < ptr2 )
         {
index f7c89dbf247f6352e457fc540fa0eee045d4fb7d..5167c09a7f4e0e5124753900f46ecaa9cd05e04e 100644 (file)
@@ -80,6 +80,22 @@ typedef struct CvProcessorInfo
 }
 CvProcessorInfo;
 
+#undef MASM_INLINE_ASSEMBLY
+
+#if defined WIN32 && !defined  WIN64
+
+#if defined _MSC_VER
+#define MASM_INLINE_ASSEMBLY 1
+#elif defined __BORLANDC__
+
+#if __BORLANDC__ >= 0x560
+#define MASM_INLINE_ASSEMBLY 1
+#endif
+
+#endif
+
+#endif
+
 /*
    determine processor type
 */
@@ -122,7 +138,7 @@ icvInitProcessorInfo( CvProcessorInfo* cpu_info )
             RegCloseKey( key );
         }
 
-#if defined WIN32 && !defined WIN64 && (defined _MSC_VER || defined __BORLANDC__ && __BORLANDC__>=0x560)
+#ifdef MASM_INLINE_ASSEMBLY
         __asm
         {
             /* use CPUID to determine the features supported */
@@ -674,7 +690,7 @@ CV_IMPL  int64  cvGetTickCount( void )
 
     if( CV_GET_PROC_ARCH(cpu_info->model) == CV_PROC_IA32_GENERIC )
     {
-#if defined WIN32 && !defined WIN64 && (defined _MSC_VER || defined __BORLANDC__ && __BORLANDC__>=0x560)
+#ifdef MASM_INLINE_ASSEMBLY
     #ifdef __BORLANDC__
         __asm db 0fh
         __asm db 31h
index bf374adb612a9a8a015578230b6885b75a3c385e..87065185aabd80995be11710716fd7b5dad0f16c 100644 (file)
@@ -635,7 +635,7 @@ cvPreprocessOrderedResponses( const CvMat* responses, const CvMat* sample_idx, i
 
     __BEGIN__;
 
-    int i, r_type, r_size, r_step;
+    int i, r_type, r_step;
     const int* map = 0;
     float* dst;
     int sample_count = sample_all;
@@ -655,7 +655,6 @@ cvPreprocessOrderedResponses( const CvMat* responses, const CvMat* sample_idx, i
         CV_ERROR( CV_StsUnsupportedFormat, "Unsupported response type" );
 
     r_step = responses->step ? responses->step / CV_ELEM_SIZE(responses->type) : 1;
-    r_size = sample_count;
 
     if( r_type == CV_32FC1 && CV_IS_MAT_CONT(responses->type) && !sample_idx )
     {
@@ -683,7 +682,7 @@ cvPreprocessOrderedResponses( const CvMat* responses, const CvMat* sample_idx, i
         for( i = 0; i < sample_count; i++ )
         {
             int idx = map ? map[i] : i;
-            assert( (unsigned)idx < (unsigned)r_size );
+            assert( (unsigned)idx < (unsigned)sample_all );
             dst[i] = src[idx*r_step];
         }
     }
@@ -693,7 +692,7 @@ cvPreprocessOrderedResponses( const CvMat* responses, const CvMat* sample_idx, i
         for( i = 0; i < sample_count; i++ )
         {
             int idx = map ? map[i] : i;
-            assert( (unsigned)idx < (unsigned)r_size );
+            assert( (unsigned)idx < (unsigned)sample_all );
             dst[i] = (float)src[idx*r_step];
         }
     }
@@ -721,7 +720,7 @@ cvPreprocessCategoricalResponses( const CvMat* responses,
 
     __BEGIN__;
 
-    int i, r_type, r_size, r_step;
+    int i, r_type, r_step;
     int cls_count = 1, prev_cls, prev_i;
     const int* map = 0;
     const int* srci;
@@ -746,7 +745,6 @@ cvPreprocessCategoricalResponses( const CvMat* responses,
         CV_ERROR( CV_StsUnsupportedFormat, "Unsupported response type" );
 
     r_step = responses->step ? responses->step / CV_ELEM_SIZE(responses->type) : 1;
-    r_size = sample_count;
 
     if( sample_idx )
     {
@@ -773,7 +771,7 @@ cvPreprocessCategoricalResponses( const CvMat* responses,
     for( i = 0; i < sample_count; i++ )
     {
         int idx = map ? map[i] : i;
-        assert( (unsigned)idx < (unsigned)r_size );
+        assert( (unsigned)idx < (unsigned)sample_all );
         if( r_type == CV_32SC1 )
             dst[i] = srci[idx*r_step];
         else
index ebdee82c8f009c566f9c4fc64a676a833fbfda0c..4d06bb626e6e1c8504219a1282370f9ab7af2cf2 100644 (file)
@@ -831,13 +831,12 @@ int CvANN_MLP::train( const CvMat* _inputs, const CvMat* _outputs,
 
     __BEGIN__;
 
-    int count, max_iter;
+    int max_iter;
     double epsilon;
 
     // initialize training data
     CV_CALL( prepare_to_train( _inputs, _outputs, _sample_weights,
                                _sample_idx, _params, &x0, &u, &sw, flags ));
-    count = x0.count;
 
     // ... and link weights
     if( !(flags & UPDATE_WEIGHTS) )
@@ -1301,7 +1300,7 @@ int CvANN_MLP::train_rprop( CvVectors x0, CvVectors u, const double* sw )
 
 void CvANN_MLP::write_params( CvFileStorage* fs )
 {
-    CV_FUNCNAME( "CvANN_MLP::write_params" );
+    //CV_FUNCNAME( "CvANN_MLP::write_params" );
 
     __BEGIN__;
 
@@ -1400,7 +1399,7 @@ void CvANN_MLP::write( CvFileStorage* fs, const char* name )
 
 void CvANN_MLP::read_params( CvFileStorage* fs, CvFileNode* node )
 {
-    CV_FUNCNAME( "CvANN_MLP::read_params" );
+    //CV_FUNCNAME( "CvANN_MLP::read_params" );
 
     __BEGIN__;
 
index 695e99872673102d31b9370fd86799c79ce233fa..42504bac1aabb6efdac8dab8ec756a25b01c547f 100644 (file)
@@ -209,20 +209,11 @@ CvEM::predict( const CvMat* _sample, CvMat* _probs ) const
 
     int i, k, dims;
     int nclusters;
-    int is_general = 0, is_diagonal = 0, is_spherical = 0;
+    int cov_mat_type = params.cov_mat_type;
     double opt = FLT_MAX;
     size_t size;
     CvMat diff, expo;
 
-    if( params.cov_mat_type == COV_MAT_GENERIC )
-        is_general  = 1;
-    else if( params.cov_mat_type == COV_MAT_DIAGONAL )
-        is_diagonal = 1;
-    else if( params.cov_mat_type == COV_MAT_SPHERICAL )
-        is_spherical  = 1;
-    else
-        CV_ERROR( CV_StsBadArg,"Invalid value of <cov_mat_type>" );
-
     dims = means->cols;
     nclusters = params.nclusters;
 
@@ -248,7 +239,7 @@ CvEM::predict( const CvMat* _sample, CvMat* _probs ) const
         double cur = log_weight_div_det->data.db[k];
         CvMat* u = cov_rotate_mats[k];
         // cov = u w u'  -->  cov^(-1) = u w^(-1) u'
-        if( is_spherical )
+        if( cov_mat_type == COV_MAT_SPHERICAL )
         {
             double w0 = w[0];
             for( i = 0; i < dims; i++ )
@@ -261,7 +252,7 @@ CvEM::predict( const CvMat* _sample, CvMat* _probs ) const
         {
             for( i = 0; i < dims; i++ )
                 diff.data.db[i] = sample_data[i] - mean_k[i];
-            if( is_general )
+            if( cov_mat_type == COV_MAT_GENERIC )
                 cvGEMM( &diff, u, 1, 0, 0, &diff, CV_GEMM_B_T );
             for( i = 0; i < dims; i++ )
             {
index 285ebb4aa223f69a914f0a68a6c07f316940ea3d..c89163019ae1b444708b908e4aeb0cff09495a09 100644 (file)
@@ -40,9 +40,6 @@
 
 #include "_ml.h"
 
-const float ord_var_epsilon = FLT_EPSILON*2;
-const float ord_nan = FLT_MAX*0.5f;
-
 CvForestTree::CvForestTree()
 {
     forest = NULL;
index 9a7524117c92cf4f006ce23caff5f057dce68455..8ab1cc38ea1dacd70ef3ad1c51219d4d86696b18 100644 (file)
 #pragma warning( disable: 4514 ) /* unreferenced inline functions */
 #endif
 
+#if 1
 typedef float Qfloat;
+#define QFLOAT_TYPE CV_32F
+#else
+typedef double Qfloat;
+#define QFLOAT_TYPE CV_64F
+#endif
 
 // SVM training parameters
 CvSVMParams::CvSVMParams() :
@@ -184,7 +190,7 @@ void CvSVMKernel::calc_linear( int vcount, int var_count, const float** vecs,
 void CvSVMKernel::calc_poly( int vcount, int var_count, const float** vecs,
                              const float* another, Qfloat* results )
 {
-    CvMat R = cvMat( 1, vcount, sizeof(Qfloat)==sizeof(float) ? CV_32F : CV_64F, results );
+    CvMat R = cvMat( 1, vcount, QFLOAT_TYPE, results );
     calc_non_rbf_base( vcount, var_count, vecs, another, results, params->gamma, params->coef0 );
     cvPow( &R, &R, params->degree );
 }
@@ -212,7 +218,7 @@ void CvSVMKernel::calc_sigmoid( int vcount, int var_count, const float** vecs,
 void CvSVMKernel::calc_rbf( int vcount, int var_count, const float** vecs,
                             const float* another, Qfloat* results )
 {
-    CvMat R = cvMat( 1, vcount, sizeof(Qfloat)==sizeof(float) ? CV_32F : CV_64F, results );
+    CvMat R = cvMat( 1, vcount, QFLOAT_TYPE, results );
     double gamma = -params->gamma;
     int j, k;
 
index 0ecc7f0d000b0d60a9d3ecc016d7c2834173b201..a1fd3e2bc0ac4629b6395baefe81d2d0d725974b 100644 (file)
@@ -40,7 +40,6 @@
 
 #include "_ml.h"
 
-static const float ord_var_epsilon = FLT_EPSILON*2;
 static const float ord_nan = FLT_MAX*0.5f;
 static const int min_block_size = 1 << 16;
 static const int block_size_delta = 1 << 10;
@@ -300,7 +299,7 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag,
         if( vi < var_count && ci >= 0 ||
             vi == var_count && is_classifier ) // process categorical variable or response
         {
-            int c_count, prev_label, prev_i;
+            int c_count, prev_label;
             int* c_map, *dst = get_cat_var_data( data_root, vi );
 
             // copy data
@@ -369,14 +368,11 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag,
             prev_label = ~*int_ptr[0];
             c_count = -1;
 
-            for( i = 0, prev_i = -1; i < num_valid; i++ )
+            for( i = 0; i < num_valid; i++ )
             {
                 int cur_label = *int_ptr[i];
                 if( cur_label != prev_label )
-                {
                     c_map[++c_count] = prev_label = cur_label;
-                    prev_i = i;
-                }
                 *int_ptr[i] = c_count;
             }
 
@@ -993,6 +989,24 @@ CvDTree::~CvDTree()
 }
 
 
+const CvDTreeNode* CvDTree::get_root() const
+{
+    return root;
+}
+
+
+int CvDTree::get_pruned_tree_idx() const
+{
+    return pruned_tree_idx;
+}
+
+
+CvDTreeTrainData* CvDTree::get_data()
+{
+    return data;
+}
+
+
 bool CvDTree::train( const CvMat* _train_data, int _tflag,
                      const CvMat* _responses, const CvMat* _var_idx,
                      const CvMat* _sample_idx, const CvMat* _var_type,
@@ -1039,16 +1053,16 @@ bool CvDTree::do_train( const CvMat* _subsample_idx )
 {
     bool result = false;
 
-    CV_FUNCNAME( "CvDTree::train" );
+    CV_FUNCNAME( "CvDTree::do_train" );
 
     __BEGIN__;
 
     root = data->subsample_data( _subsample_idx );
 
-    try_split_node(root);
+    CV_CALL( try_split_node(root));
     
     if( data->params.cv_folds > 0 )
-        prune_cv();
+        CV_CALL( prune_cv());
 
     if( !data->shared )
         data->free_train_data();
@@ -2744,6 +2758,8 @@ const CvMat* CvDTree::get_var_importance()
 
             node = parent->right;
         }
+
+        cvNormalize( var_importance, var_importance, 1., 0, CV_L1 );
     }
 
     return var_importance;
@@ -2884,7 +2900,7 @@ void CvDTree::write_node( CvFileStorage* fs, CvDTreeNode* node )
 
 void CvDTree::write_tree_nodes( CvFileStorage* fs )
 {
-    CV_FUNCNAME( "CvDTree::write_tree_nodes" );
+    //CV_FUNCNAME( "CvDTree::write_tree_nodes" );
 
     __BEGIN__;
 
@@ -2918,7 +2934,7 @@ void CvDTree::write_tree_nodes( CvFileStorage* fs )
 
 void CvDTree::write( CvFileStorage* fs, const char* name )
 {
-    CV_FUNCNAME( "CvDTree::write" );
+    //CV_FUNCNAME( "CvDTree::write" );
 
     __BEGIN__;
 
index 47620052084354f7ba2e1223202306fc99a3304d..76d6693d29b53de67f2a26c3140d14f0e6fc4414 100644 (file)
@@ -44,7 +44,7 @@
 static const char* floodfill_param_names[] = { "size", "channels", "depth", "dist_type", "labels", 0 };
 static const CvSize floodfill_sizes[] = {{320, 240}, {720,480}, {-1,-1}};
 static const CvSize floodfill_whole_sizes[] = {{320, 240}, {720,480}, {-1,-1}};
-static const char* floodfill_types[] = { "fixed_level", "fixed_range", "floating_range", 0 };
+//static const char* floodfill_types[] = { "fixed_level", "fixed_range", "floating_range", 0 };
 static const int floodfill_depths[] = { CV_8U, CV_32F, -1 };
 static const int floodfill_channels[] = { 1, 3, -1 };
 
index 051426a425ceea7203e6dc55369985b7972668c2..4cd9ce6ffda68844e488dcac310e9bdad33ffc17 100644 (file)
@@ -1600,10 +1600,10 @@ void CxCore_TransformTest::get_test_array_types_and_sizes( int test_case_idx, Cv
 {
     CvRNG* rng = ts->get_rng();
     int bits = cvTsRandInt(rng);
-    int depth, cn, dst_cn, mat_cols, mattype;
+    int depth, dst_cn, mat_cols, mattype;
     CxCore_MatrixTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
 
-    mat_cols = cn = CV_MAT_CN(types[INPUT][0]);
+    mat_cols = CV_MAT_CN(types[INPUT][0]);
     depth = CV_MAT_DEPTH(types[INPUT][0]);
     dst_cn = cvTsRandInt(rng) % 4 + 1;
     types[OUTPUT][0] = types[REF_OUTPUT][0] = CV_MAKETYPE(depth, dst_cn);
@@ -1979,7 +1979,6 @@ void CxCore_CovarMatrixTest::get_test_array_types_and_sizes( int test_case_idx,
     CvRNG* rng = ts->get_rng();
     int bits = cvTsRandInt(rng);
     int i, single_matrix;
-    CvSize sz;
     CxCore_MatrixTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
 
     flags = bits & (CV_COVAR_NORMAL | CV_COVAR_USE_AVG | CV_COVAR_SCALE | CV_COVAR_ROWS );
@@ -1998,7 +1997,7 @@ void CxCore_CovarMatrixTest::get_test_array_types_and_sizes( int test_case_idx,
         types[INPUT][0] = (types[INPUT][0] & ~CV_MAT_DEPTH_MASK) | CV_32F;
 
     sizes[OUTPUT][0] = sizes[REF_OUTPUT][0] = flags & CV_COVAR_NORMAL ? cvSize(len,len) : cvSize(count,count);
-    sizes[INPUT_OUTPUT][0] = sizes[REF_INPUT_OUTPUT][0] = sz = !t_flag ? cvSize(len,1) : cvSize(1,len);
+    sizes[INPUT_OUTPUT][0] = sizes[REF_INPUT_OUTPUT][0] = !t_flag ? cvSize(len,1) : cvSize(1,len);
     sizes[TEMP][0] = sizes[INPUT][0];
 
     types[INPUT_OUTPUT][0] = types[REF_INPUT_OUTPUT][0] =