]> rtime.felk.cvut.cz Git - opencv.git/commitdiff
fixed bug in traincascade; added comment in dtree
authormdim <mdim@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Tue, 8 Dec 2009 12:01:10 +0000 (12:01 +0000)
committermdim <mdim@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Tue, 8 Dec 2009 12:01:10 +0000 (12:01 +0000)
git-svn-id: https://code.ros.org/svn/opencv/trunk@2382 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08

opencv/apps/traincascade/boost.cpp
opencv/src/ml/mltree.cpp

index 50ce5e45051c78b657f3c7145403552edb18cb87..1cd343c9418e64e97f595b264d77e8c6b3161bfd 100755 (executable)
@@ -270,7 +270,7 @@ void CvCascadeBoostTrainData::setData( const CvFeatureEvaluator* _featureEvaluat
     }
     var_type->data.i[var_count] = cat_var_count;
     var_type->data.i[var_count+1] = cat_var_count+1;
-    work_var_count = ( cat_var_count ? var_count : numPrecalcIdx ) + 1;
+    work_var_count = ( cat_var_count ? 0 : numPrecalcIdx ) + 1;
     buf_size = (work_var_count + 1) * sample_count;
     buf_count = 2;
     
index 96f137fcd57154d83580625679a1b7f681523eb0..73a3bc08b7dde97f6266335bd44e548df0c6aa7b 100644 (file)
@@ -282,8 +282,10 @@ void CvDTreeTrainData::set_data( const CvMat* _train_data, int _tflag,
     // for safe split_node_data() operation
     have_labels = cv_n > 0 || (ord_var_count == 1 && cat_var_count == 0) || _add_labels;
 
-    work_var_count = var_count + (is_classifier ? 1 : 0) + (have_labels ? 1 : 0);
-    buf_size = (work_var_count + 1)*sample_count;
+    work_var_count = var_count + (is_classifier ? 1 : 0) // for responses class_labels
+                               + (have_labels ? 1 : 0); // for cv_labels
+                               
+    buf_size = (work_var_count + 1 /*for sample_indices*/) * sample_count;
     shared = _shared;
     buf_count = shared ? 2 : 1;