Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: 'create' is not a member of 'cv::Tracker'

İn this official tutorial I got the error in title. What should be the reason?

Ptr<Tracker> tracker = Tracker::create( "KCF" );

Here the part of tracking.hpp:

    @endcode
    of course, you can also add any additional methods of your choice. It should be pointed out,
    however, that it is not expected to have a constructor declared, as creation should be done via
    the corresponding createTracker() method.
   In src/tracker.cpp file add BOILERPLATE_CODE(name,classname) line to the body of
    Tracker::create() method you will find there, like :
@code
        Ptr<Tracker> Tracker::create( const String& trackerType )
        {
          BOILERPLATE_CODE("BOOSTING",TrackerBoosting);
          BOILERPLATE_CODE("MIL",TrackerMIL);
          return Ptr<Tracker>();
        }
@endcode
-   Finally, you should implement the function with signature :
@code
        Ptr<classname> classname::createTracker(const classname::Params &parameters){
            ...
        }
@endcode

I am using 3.2.0 release.

like image 391
ffttyy Avatar asked Dec 19 '22 05:12

ffttyy


1 Answers

The code you pasted from tracking.hpp isn't actual code, it's just sample code that's part of the documentation. The only relevant code in the tracking header file is:

#include <opencv2/tracking/tracker.hpp>
#include <opencv2/tracking/tldDataset.hpp>

Thus, to see what you're actually importing you need to look at the tracking/tracker.hpp file (here).

If you do that, you'll see that there's no static create method in the Tracker class declaration. The method was actually removed in this commit. So, basically, you're right: the tutorial wasn't updated after the method was removed. You should report your issue to the opencv team.

That being said, to make the tutorial work you'll probably need to replace the line that's not compiling with:

Ptr<TrackerKCF> tracker = TrackerKCF::create();

That should do the trick.

like image 103
themiurge Avatar answered Dec 24 '22 01:12

themiurge