diff --git a/apps/traincascade/haarfeatures.cpp b/apps/traincascade/haarfeatures.cpp index a58fb45c9..2c96811da 100644 --- a/apps/traincascade/haarfeatures.cpp +++ b/apps/traincascade/haarfeatures.cpp @@ -100,9 +100,13 @@ void CvHaarEvaluator::setImage(const Mat& img, uchar clsLabel, int idx) CV_DbgAssert( !sum.empty() && !tilted.empty() && !normfactor.empty() ); CvFeatureEvaluator::setImage( img, clsLabel, idx); Mat innSum(winSize.height + 1, winSize.width + 1, sum.type(), sum.ptr((int)idx)); - Mat innTilted(winSize.height + 1, winSize.width + 1, tilted.type(), tilted.ptr((int)idx)); Mat innSqSum; - integral(img, innSum, innSqSum, innTilted); + if (((const CvHaarFeatureParams*)featureParams)->mode == CvHaarFeatureParams::ALL) { + Mat innTilted(winSize.height + 1, winSize.width + 1, tilted.type(), tilted.ptr((int)idx)); + integral(img, innSum, innSqSum, innTilted); + } + else + integral(img, innSum, innSqSum); normfactor.ptr(0)[idx] = calcNormFactor( innSum, innSqSum ); }