Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

CascadeClassifier crashing on detectMultiScale

Hello, I'm trying to find faces in a video using the CascadeClassifier. Since I migrated from 2.4 to 3.0 I've been having an issue with detectMultiScale when I hand it a RoI bounded Mat.
I use the following line to search for the faces

classifier_->detectMultiScale(region, found, 1.35, 5, 0, Size(25, 25));

Where region is a Mat bounded by a Rect I defined to reduce the search area based on a background subtractor and found is a new vector.

When run I get the following:

Debug Assertion Failed!
Program: C:\Windows\system32\MSVCP110D.dll
File: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\vector
Line: 1124

Expression: vector subscript out of range

When debugging the application I find that this error comes when executing line 1265 on cascadedetect.cpp

if( !featureEvaluator->setImage(gray, scales) )

because scales, a vector initialized on line 1249, reaches setImage with size 0 no matter what I do.
What should I do about it? Should I add to that line another condition stating that scales must be greater than 0? Is this a bug that should be reported or am I doing something wrong?