Ask Your Question

tracker update with rect in python

asked 2018-04-10 09:05:56 -0500

shanishalgi gravatar image

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

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!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-04-10 09:12:23 -0500

berak gravatar image

yes, true, you "can't bring it back". (known design flaw)

the only current solution is to create a new tracker instance, and call init() on that again.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-04-10 09:05:56 -0500

Seen: 2,072 times

Last updated: Apr 10 '18