I have a problem using the OpenCV 3 tracking module for tracking. It behaves the same way, either I use the interface class (cv :: Tracker), or the implementation class (for example, cv :: TrackerMedianFlow or cv :: TrackerMIL, etc.). The sample is a slightly modified sample from the OpenCV sample folder. After creating it correctly
Ptr<Tracker> tracker = Tracker::create( tracker_algorithm ); if ( tracker == NULL ) { std::cout << "***Error in the instantiation of the tracker...***\n"; return -1; }
initialization works just fine
if ( !tracker->init( frame, boundingBox ) ) { std::cout << "***Could not initialize tracker...***\n"; return -1; }
The problem arises in the later stages, with the main loop when tracking is lost. I use a separate detector to determine a new target. When I find a new target, I clear the tracker and initialize it with a new value
tracker->clear( ); if ( !tracker->init( frame, detectedNewBBox) ) { std::cout << "***Could not initialize tracker without history...***\n"; return -1; }
However, initialization always returns false. I am trying to find out why the Tracker cannot be initialized? The data has been checked several times and looks pretty correct. I even did a little experiment trying to initialize the tracker right after creating it with the same data that it wonโt initialize the loop, and it works fine. Am I doing something wrong? I could not find the documentation on this ... Here is the link to the available documentation on this: Tracker OpenCV 3 Documentation
Thanks for any effort!
source share