From: Alexander Alekhin Date: Wed, 28 Nov 2018 20:16:37 +0000 (+0000) Subject: imgproc: local "CV_Assert(totalSampleCount > 0)" check X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~1^2~389^2~7^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ed7d5a5d94669fb11c7dacaac706b790587a8ee;p=platform%2Fupstream%2Fopencv.git imgproc: local "CV_Assert(totalSampleCount > 0)" check --- diff --git a/modules/imgproc/src/grabcut.cpp b/modules/imgproc/src/grabcut.cpp index 9cfbe0d..d68077d 100644 --- a/modules/imgproc/src/grabcut.cpp +++ b/modules/imgproc/src/grabcut.cpp @@ -174,7 +174,6 @@ void GMM::addSample( int ci, const Vec3d color ) void GMM::endLearning() { - CV_Assert(totalSampleCount > 0); for( int ci = 0; ci < componentsCount; ci++ ) { int n = sampleCounts[ci]; @@ -182,6 +181,7 @@ void GMM::endLearning() coefs[ci] = 0; else { + CV_Assert(totalSampleCount > 0); double inv_n = 1.0 / n; coefs[ci] = (double)n/totalSampleCount;