the peopledetection gives you a vector<Rect>
and you will have to translate that to a vector<Rect2d>
for the multitracker:
// please use Ptr<MultiTracker>, not MultiTracker here, see below
Ptr<MultiTracker> trackers = makePtr<MultiTracker>(trackingAlg);
vector<Rect> v1; // from detection
vector<Rect2d> v2: // for tracking
for (size_t i=0; i<v1.size(); i++) {
v2.push_back(v1[i]); //Rect2d has a constructor for Rect
}
trackers->add(frame, v2);
then you will have to check the return value from update():
bool ok = trackers->update(frame);
if (! ok) {
// one of the trackers failed, now unfortunately, you will have to:
// * create a new Multitracker instance with current image and current detections
trackers = makePtr<MultiTracker>(trackingAlg);
// * make a new peopledetection
// * copy detections to tracking Rect2ds again, and
trackers->add(frame, objects);
}