Ask Your Question
0

How to delete an object from Multitracker ?

asked 2017-04-15 09:31:35 -0500

saip gravatar image

I am working with the multitracker to track some objects.

std::string trackingAlg = "KCF";
MultiTracker trackers(trackingAlg);

I am using background subtraction technique to find the object contours and track the objects using

trackers.update(frame);

In the process, I would like to delete some objects from the trackers or update the bounding box of some objects.

I have tried something like this (as shown below) to update the object contours, but was not successful

 trackers.objects[i] = newBound_box[i];

Could anyone suggest how to

  1. delete objects from trackers
  2. update the bounding box (not by trackers.update(frame) but by manual bounding box values) ?

Thank you for your time!

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
2

answered 2017-04-15 09:54:10 -0500

berak gravatar image

updated 2017-04-15 10:00:56 -0500

sadly, you just can't delete or reassign any objects from the multitracker, also the KCF tracker currently never returns false , if it missed the object .

all you can do is, release() the MultiTracker instance, and start building it from scratch.

idk, but maybe having a vector<Ptr<Tracker>> instead of the MultiTracker instance would at least allow you to check single trackers for miss (return false on update()) or re-initialize them with a Rect of your choice (init())

edit flag offensive delete link more

Comments

banyar gravatar imagebanyar ( 2018-01-18 23:28:20 -0500 )edit

HI @banyar, I had a look at the Thom's way from stackoverflow link. I'm worried if creating a new instance would lead to memory leak. Moreover, I couldn't use "delete tracker". For some reasin it crashes.

santo4_opencv gravatar imagesanto4_opencv ( 2019-04-21 01:20:32 -0500 )edit

@santo4_opencv

I'm worried if creating a new instance would lead to memory leak

no, you're wrong. and please use tracker->release()

berak gravatar imageberak ( 2019-04-21 01:45:35 -0500 )edit
-1

answered 2018-08-06 22:07:04 -0500

if don't delete a tracker in multi tracker, you can save tracker want in next frame, and clear tracker present use tracker.clear()!!

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-04-15 09:31:35 -0500

Seen: 3,678 times

Last updated: Aug 06 '18