diff --git a/modules/objdetect/src/haar.cpp b/modules/objdetect/src/haar.cpp index 4ba4e7f694..bfcc2e7eef 100644 --- a/modules/objdetect/src/haar.cpp +++ b/modules/objdetect/src/haar.cpp @@ -1531,6 +1531,13 @@ cvHaarDetectObjectsForROC( const CvArr* _img, continue; } + if ( winSize.width > maxSize.width || winSize.height > maxSize.height ) + { + if( !findBiggestObject ) + break; + continue; + } + cvSetImagesForHaarClassifierCascade( cascade, sum, sqsum, tilted, factor ); cvZero( temp );