From: mdim Date: Tue, 8 Dec 2009 12:01:10 +0000 (+0000) Subject: fixed bug in traincascade; added comment in dtree X-Git-Url: https://rtime.felk.cvut.cz/gitweb/opencv.git/commitdiff_plain/3a33167b13508f5c3932d65470b2178f092d1ee3 fixed bug in traincascade; added comment in dtree git-svn-id: https://code.ros.org/svn/opencv/trunk@2382 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08 --- diff --git a/opencv/apps/traincascade/boost.cpp b/opencv/apps/traincascade/boost.cpp index 50ce5e45..1cd343c9 100755 --- a/opencv/apps/traincascade/boost.cpp +++ b/opencv/apps/traincascade/boost.cpp @@ -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; diff --git a/opencv/src/ml/mltree.cpp b/opencv/src/ml/mltree.cpp index 96f137fc..73a3bc08 100644 --- a/opencv/src/ml/mltree.cpp +++ b/opencv/src/ml/mltree.cpp @@ -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;