Ask Your Question

Revision history [back]

Hello. I work with Marco, who opened this thread. I would like to give some additional information, hoping that it will help. I have run gdb on the core dump of the error.

The issue is triggered by a failing assert() at line 922 of file modules/objdetect/src/cascadedetect.cpp. This is the assert call:

assert( !oldCascade &&
       (data.featureType == FeatureEvaluator::HAAR ||
        data.featureType == FeatureEvaluator::LBP ||
        data.featureType == FeatureEvaluator::HOG) );

Using GDB, I was able to verify the value of the involved variables. More specifically, oldCascade is correctly set to false (making !oldCascade equals to true), while the value of data.featureType is 32729, which does not correspond to any of the values rapresented by the enum within the FeatureEvaluator class, defined as follows:

class FeatureEvaluator
{
public:
    enum
    {
        HAAR = 0,
        LBP  = 1,
        HOG  = 2
    };
    ....
}

Here are the values of the other attributes that compose the structure "CascadeClassifierImpl::data":

{stageType = -2012718384, featureType = 32729, ncategories = 0, minNodesPerTree = 1, maxNodesPerTree = 1, origWinSize = {width = 20, height = 20}, stages = std::vector of length 22, capacity 22 = {... }, classifiers = std::vector of length 2135, capacity 2135 = {...}, nodes = std::vector of length 2135, capacity 2135 = {...}, leaves = std::vector of length 4270, capacity 4270 = {...}, subsets = std::vector of length 0, capacity 0,
stumps = std::vector of length 2135, capacity 4096 = {...}}

We verified experimentally that no two calls to the detectMultiScale() method can occur at once (we have a mutex that controls the access to the doFaceRec() method, which is defined as written by my colleague in the post above). I am thinking that there might some kind of error like an array overflow at some point in the code, that overwrites part of the structure "CascadeClassifierImpl::data"?

The "suspicious" data structure is initialized during the call to the method load() of the CascadeClassifierImpl class, which calls data = Data(), which, in turn, executes the following line of code:

stageType = featureType = ncategories = maxNodesPerTree = 0;

I have looked at the code in the modules/objdetect/src/cascadedetect.cpp file, and I cannot seem to find any place in the code where data.featureType could be changed into any value like 32729. Hence, my concerns on the possibility of an array overflow that overwrites the content of CascadeClassifierImpl::data.

Does anybody have any suggestions for us? Is there anything else that I might discover using GDB?

Thank you everybody for your help and time!

Ciao, Alessandro