From: Maria Dimashova Date: Thu, 10 Nov 2011 13:40:11 +0000 (+0000) Subject: fixed CvRTrees::read in case nactive_vars==var_count (thanks to Malcolm Reynolds) X-Git-Tag: accepted/2.0/20130307.220821~1636 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3ce652eb4422202a49252672b681ec8e2690844;p=profile%2Fivi%2Fopencv.git fixed CvRTrees::read in case nactive_vars==var_count (thanks to Malcolm Reynolds) --- diff --git a/modules/ml/src/rtrees.cpp b/modules/ml/src/rtrees.cpp index a1a13b0..94f7c40 100644 --- a/modules/ml/src/rtrees.cpp +++ b/modules/ml/src/rtrees.cpp @@ -813,11 +813,16 @@ void CvRTrees::read( CvFileStorage* fs, CvFileNode* fnode ) active_var_mask = cvCreateMat( 1, var_count, CV_8UC1 ); { // initialize active variables mask - CvMat submask1, submask2; - cvGetCols( active_var_mask, &submask1, 0, nactive_vars ); - cvGetCols( active_var_mask, &submask2, nactive_vars, var_count ); + CvMat submask1; + cvGetCols( active_var_mask, &submask1, 0, nactive_vars ); cvSet( &submask1, cvScalar(1) ); - cvZero( &submask2 ); + + if( nactive_vars < var_count ) + { + CvMat submask2; + cvGetCols( active_var_mask, &submask2, nactive_vars, var_count ); + cvZero( &submask2 ); + } } }