Creating my own tracker using tracker module in opencv-contrib [closed]
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;
}
Do I need to build the specific model files before using it?
did you read the documentation before? see also tutorial_customizing_cn_tracker.cpp
@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.
do you have a tracker code or you are trying to implement something
i have added before some trackers on my local (yes i used BOILERPLATE_CODE when i did. some changes have made on the api)
if you explain what you want to do maybe i can help
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.
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 intracker.hpp
. Then I built the files using cmake, followed bymake
andmake install
, but still my code shows error as mentioned in the question.Basically, I want to make a new tracker with the exact same code as that of TrackerMIL and then build upon it.
see this. i cloned MIL to MIL2 just to give an idea