Ask Your Question

Revision history [back]

tracker update with rect in python

Hi, I am using an opencv tracker to perform face tracking in videos, together with a face detector every few frames. If a face is detected by the face detector, I would like to update the tracker with the "detected" bounding box. I see that there is an option to enter a Rect in the C++ implementation but not in the python implementation. link text

update()
bool cv::Tracker::update(InputArray image, Rect2d & boundingBox)    
Python: retval, boundingBox = cv.Tracker.update(image)
Update the tracker, find the new most likely bounding box for the target.
Parameters image: The current frame boundingBox: The bounding box that represent the new target location, if true was returned, not modified otherwise

Currently, I can only init the tracker with a bounding box but not update it with one in Python. if my tracker has drifted off the initial face it was tracking, I can't "bring it back" even if I know where the face is now (using a face detector). Is there a way to do this in python (e.g. should I kill the current tracker and init another with detected bounding box?)?

Many thanks in advance!