diff --git a/modules/objdetect/src/cascadedetect.cpp b/modules/objdetect/src/cascadedetect.cpp index d8d749fc47..07c848eb9a 100644 --- a/modules/objdetect/src/cascadedetect.cpp +++ b/modules/objdetect/src/cascadedetect.cpp @@ -471,6 +471,10 @@ bool FeatureEvaluator::setImage( InputArray _image, const std::vector& _s bool recalcOptFeatures = updateScaleData(imgsz, _scales); size_t i, nscales = scaleData->size(); + if (nscales == 0) + { + return false; + } Size sz0 = scaleData->at(0).szi; sz0 = Size(std::max(rbuf.cols, (int)alignSize(sz0.width, 16)), std::max(rbuf.rows, sz0.height));