vector iterator not dereferencable

asked Jun 7 '17

SWerner gravatar image

updated Jun 7 '17

Hi there, I tried creating my own MultiTracker because I want to be able to add and delect Trackers when an object enter a Frame or leave the frame. So I create to vectors, on of trackers and one of the bounding boxes. This works fine for serveral frames, but then there is a runtime error because the update function of the trackers crashes. I use the HOGDescriptor with the DefaultPeopleDetector and for every bounding box saved in objdetect I create a tracker. Here are some lines of code where the error happens.

vector<ptr<tracker>> vtrack;

vector<rect2d> objdetect;

//Create tracker

objdetect.push_back(tr);

vtrack.push_back(Tracker::create("TLD"));

vtrack[vtrack.size() - 1]->init(frame, tr);

for(int i = 0; i < vtrack.size();i++) {

 vtrack[i]->update(frame, objdetect[i]);

}

Anybody an idea why the programm runs sometimes over 3 Videos without error and then there is this runtime error?

Preview: (hide)

Comments

It seems to be a problem with the TLD Tracker. I changed the tracker to MIL an KCF and there where no problems with the vector iterator

SWerner gravatar imageSWerner (Jun 7 '17)edit