Commit 484e56f3 authored by Leonid Beynenson's avatar Leonid Beynenson

Fixed small bug in opencv_traincascade application: overflow sometimes happened…

Fixed small bug in opencv_traincascade application: overflow sometimes happened during calculation of the number of negative samples.
parent 22bd1273
......@@ -268,7 +268,7 @@ bool CvCascadeClassifier::updateTrainingSet( double& acceptanceRatio)
return false;
cout << "POS count : consumed " << posCount << " : " << (int)posConsumed << endl;
int proNumNeg = cvRound( (float)(numNeg * posCount) / numPos ); // apply only a fraction of negative samples.
int proNumNeg = cvRound( ( ((double)numNeg) * ((double)posCount) ) / numPos ); // apply only a fraction of negative samples. double is required since overflow is possible
int negCount = fillPassedSamples( posCount, proNumNeg, false, negConsumed );
if ( !negCount )
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment