Creating my own tracker using tracker module in opencv-contrib [closed]

asked 2017-08-19 12:12:15 -0600

babahooja gravatar image

updated 2017-08-19 13:47:28 -0600

I am trying to create my own tracker using opencv-contrib tracker module. For that I am first trying to replicate the MIL Tracker provided in the contrib. I added my tracker class to the tracking/opencv2/tracker.hpp file. Then, I build the files. I copied the files trackerMIL.cpp, trackerMILModel.hpp, trackerMILModel.cpp and edited the files to suit my own tracker name. I am using the same target estimation method used in MIL. I get the error:

error: (-1) The model is not initialized in function init. How should I resolve this error? The error originates from here (tracker.cpp)

  sampler = Ptr<TrackerSampler>( new TrackerSampler() );
  featureSet = Ptr<TrackerFeatureSet>( new TrackerFeatureSet() );
  model = Ptr<TrackerModel>();

  bool initTracker = initImpl( image.getMat(), boundingBox );

  //check if the model component is initialized
  if( model == 0 )
  {
    CV_Error( -1, "The model is not initialized" );
    return false;
  }
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-09-26 08:14:18.779559

Comments

Do I need to build the specific model files before using it?

babahooja gravatar imagebabahooja ( 2017-08-19 14:53:21 -0600 )edit
sturkmen gravatar imagesturkmen ( 2017-08-19 15:21:47 -0600 )edit

@sturkmen yes I did! I believe the documentation is a bit old wrt the code in the contrib, because it mentions the macro 'BOILERPLATE_CODE' which is absent in the code.

babahooja gravatar imagebabahooja ( 2017-08-19 15:27:46 -0600 )edit

do you have a tracker code or you are trying to implement something

sturkmen gravatar imagesturkmen ( 2017-08-19 16:04:36 -0600 )edit

i have added before some trackers on my local (yes i used BOILERPLATE_CODE when i did. some changes have made on the api)

sturkmen gravatar imagesturkmen ( 2017-08-19 16:07:13 -0600 )edit

if you explain what you want to do maybe i can help

sturkmen gravatar imagesturkmen ( 2017-08-19 16:08:37 -0600 )edit

I am trying to make some changes in MIL's original implementation. I am unable to understand where to put these changes. I don't want to hamper the original implementation of MIL. I had a look at the link above on customizing tracker, but I can't understand how can I add more methods to the original MIL model.

babahooja gravatar imagebabahooja ( 2017-08-19 17:10:44 -0600 )edit

I tried duplicating all the files in tracking/src/ with my own model name (and with changes in the code wrt to model name MIL --> newMIL ). I also added my tracker class in tracker.hpp. Then I built the files using cmake, followed by make and make install, but still my code shows error as mentioned in the question.

babahooja gravatar imagebabahooja ( 2017-08-19 17:13:38 -0600 )edit

Basically, I want to make a new tracker with the exact same code as that of TrackerMIL and then build upon it.

babahooja gravatar imagebabahooja ( 2017-08-19 17:17:34 -0600 )edit
2

see this. i cloned MIL to MIL2 just to give an idea

sturkmen gravatar imagesturkmen ( 2017-08-20 03:02:11 -0600 )edit