Commit b66685808d0432214072da37a26c6c3f02efb848

Authored by Scott Klum
1 parent 42c4fdad

Removed unneeded channel allocation

Showing 1 changed file with 10 additions and 10 deletions
openbr/core/boost.cpp
@@ -72,7 +72,7 @@ static CvMat* cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, b @@ -72,7 +72,7 @@ static CvMat* cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, b
72 72
73 if( idx_selected == 0 ) 73 if( idx_selected == 0 )
74 CV_ERROR( CV_StsOutOfRange, "No components/input_variables is selected!" ); 74 CV_ERROR( CV_StsOutOfRange, "No components/input_variables is selected!" );
75 - } else if (type == CV_32SC(channels)) { 75 + } else if (type == CV_32SC1) {
76 // idx_arr is array of integer indices of selected components 76 // idx_arr is array of integer indices of selected components
77 if( idx_total > data_arr_size ) 77 if( idx_total > data_arr_size )
78 CV_ERROR( CV_StsOutOfRange, 78 CV_ERROR( CV_StsOutOfRange,
@@ -94,10 +94,10 @@ static CvMat* cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, b @@ -94,10 +94,10 @@ static CvMat* cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, b
94 "(it should be 8uC1, 8sC1 or 32sC1)" ); 94 "(it should be 8uC1, 8sC1 or 32sC1)" );
95 } 95 }
96 96
97 - CV_CALL( idx = cvCreateMat( 1, idx_selected, CV_32SC(channels) )); 97 + CV_CALL( idx = cvCreateMat( 1, idx_selected, CV_32SC1 ));
98 dsti = idx->data.i; 98 dsti = idx->data.i;
99 99
100 - if( type < CV_32SC(channels) ) 100 + if( type < CV_32SC1 )
101 { 101 {
102 for( i = 0; i < idx_total; i++ ) 102 for( i = 0; i < idx_total; i++ )
103 if( srcb[i*step] ) 103 if( srcb[i*step] )
@@ -263,7 +263,7 @@ CvDTreeNode* CascadeBoostTrainData::subsample_data( const CvMat* _subsample_idx @@ -263,7 +263,7 @@ CvDTreeNode* CascadeBoostTrainData::subsample_data( const CvMat* _subsample_idx
263 263
264 root = new_node( 0, count, 1, 0 ); 264 root = new_node( 0, count, 1, 0 );
265 265
266 - CV_Assert( (subsample_co = cvCreateMat( 1, sample_count*2, CV_32SC(channels) )) != 0); 266 + CV_Assert( (subsample_co = cvCreateMat( 1, sample_count*2, CV_32SC1 )) != 0);
267 cvZero( subsample_co ); 267 cvZero( subsample_co );
268 co = subsample_co->data.i; 268 co = subsample_co->data.i;
269 for( int i = 0; i < count; i++ ) 269 for( int i = 0; i < count; i++ )
@@ -356,7 +356,7 @@ CascadeBoostTrainData::CascadeBoostTrainData(const FeatureEvaluator* _featureEva @@ -356,7 +356,7 @@ CascadeBoostTrainData::CascadeBoostTrainData(const FeatureEvaluator* _featureEva
356 356
357 void CascadeBoostTrainData::initVarType() 357 void CascadeBoostTrainData::initVarType()
358 { 358 {
359 - var_type = cvCreateMat( 1, var_count + 2, CV_32SC(channels) ); 359 + var_type = cvCreateMat( 1, var_count + 2, CV_32SC1 );
360 if ( featureEvaluator->getMaxCatCount() > 0 ) 360 if ( featureEvaluator->getMaxCatCount() > 0 )
361 { 361 {
362 numPrecalcIdx = 0; 362 numPrecalcIdx = 0;
@@ -433,7 +433,7 @@ void CascadeBoostTrainData::setData( const FeatureEvaluator* _featureEvaluator, @@ -433,7 +433,7 @@ void CascadeBoostTrainData::setData( const FeatureEvaluator* _featureEvaluator,
433 assert( numPrecalcIdx >= 0 && numPrecalcVal >= 0 ); 433 assert( numPrecalcIdx >= 0 && numPrecalcVal >= 0 );
434 434
435 valCache.create( numPrecalcVal, sample_count, CV_32FC1 ); 435 valCache.create( numPrecalcVal, sample_count, CV_32FC1 );
436 - var_type = cvCreateMat( 1, var_count + 2, CV_32SC(channels) ); 436 + var_type = cvCreateMat( 1, var_count + 2, CV_32SC1 );
437 437
438 if ( featureEvaluator->getMaxCatCount() > 0 ) 438 if ( featureEvaluator->getMaxCatCount() > 0 )
439 { 439 {
@@ -476,9 +476,9 @@ void CascadeBoostTrainData::setData( const FeatureEvaluator* _featureEvaluator, @@ -476,9 +476,9 @@ void CascadeBoostTrainData::setData( const FeatureEvaluator* _featureEvaluator,
476 if (effective_buf_width * effective_buf_height != effective_buf_size) 476 if (effective_buf_width * effective_buf_height != effective_buf_size)
477 CV_Error(CV_StsBadArg, "The memory buffer cannot be allocated since its size exceeds integer fields limit"); 477 CV_Error(CV_StsBadArg, "The memory buffer cannot be allocated since its size exceeds integer fields limit");
478 478
479 - buf = cvCreateMat( effective_buf_height, effective_buf_width, CV_32SC(channels) ); 479 + buf = cvCreateMat( effective_buf_height, effective_buf_width, CV_32SC1 );
480 480
481 - cat_count = cvCreateMat( 1, cat_var_count + 1, CV_32SC(channels) ); 481 + cat_count = cvCreateMat( 1, cat_var_count + 1, CV_32SC1 );
482 482
483 // precalculate valCache and set indices in buf 483 // precalculate valCache and set indices in buf
484 precalculate(); 484 precalculate();
@@ -525,9 +525,9 @@ void CascadeBoostTrainData::setData( const FeatureEvaluator* _featureEvaluator, @@ -525,9 +525,9 @@ void CascadeBoostTrainData::setData( const FeatureEvaluator* _featureEvaluator,
525 priors = cvCreateMat( 1, get_num_classes(), CV_64F ); 525 priors = cvCreateMat( 1, get_num_classes(), CV_64F );
526 cvSet(priors, cvScalar(1)); 526 cvSet(priors, cvScalar(1));
527 priors_mult = cvCloneMat( priors ); 527 priors_mult = cvCloneMat( priors );
528 - counts = cvCreateMat( 1, get_num_classes(), CV_32SC(channels) ); 528 + counts = cvCreateMat( 1, get_num_classes(), CV_32SC1 );
529 direction = cvCreateMat( 1, sample_count, CV_8UC(channels) ); 529 direction = cvCreateMat( 1, sample_count, CV_8UC(channels) );
530 - split_buf = cvCreateMat( 1, sample_count, CV_32SC(channels) );//TODO: make a pointer 530 + split_buf = cvCreateMat( 1, sample_count, CV_32SC1 );//TODO: make a pointer
531 } 531 }
532 532
533 void CascadeBoostTrainData::free_train_data() 533 void CascadeBoostTrainData::free_train_data()