Re-initializing (correcting) the trackers when using MultiTracker

asked 2020-01-13 03:59:43 -0500

xonxt gravatar image

updated 2020-01-13 04:08:13 -0500

I'm writing an application in Python and used this article as an example of how to use the various OpenCV trackers and the MultiTracker in particular. I have an object detector running in the background, which detects the desired objects in every frame, and then does a sort of "Hungarian algorithm" on the bounding boxes.

I wanted to speed up the tracking a bit using KCF or maybe Mosse, and wanted to use the MultiTracker wrapper.

What strikes me as odd, is that though the MuiltiTracker does return a boolean for the tracking result, it only returns one of those. And there is no way of knowing, which of the trackers in the list failed.

This is pretty easy to solve if don't use the MultiTracker, but just a list of individual trackers. Though it looks like a list of trackers unfortunately works slower than one MultiTracker.

There also seems to be no way of "correcting" the trackers apart from completely re-initializing them, which is an even bigger problem if you're using the MultiTracker. It would be nice to be able to occasionally correct the trackers. And knowing WHICH of the trackers failed would also be useful.

edit retag flag offensive close merge delete

Comments

Though it looks like a list of trackers unfortunately works slower than one MultiTracker.

can't be. proof ? (after all, it is just a list of trackers, look at src)

berak gravatar imageberak ( 2020-01-13 04:03:16 -0500 )edit

@berak: tested with %timeit in a Jupyter Notebook. Going with a for loop through a list of trackers and running .update() on each seems to run about twice as long as running .update() once on a MultiTracker. Though I do only have two trackers in my example.

xonxt gravatar imagexonxt ( 2020-01-13 04:06:57 -0500 )edit
1

@berak: yeah, I saw the sources and that it also uses a list... but that's what I found strange. Here's a screenshot.

xonxt gravatar imagexonxt ( 2020-01-13 04:39:33 -0500 )edit