error: 'create' is not a member of 'cv::Tracker'
error: 'create' is not a member of 'cv::Tracker'
İn this 官方教程 题目写错了。应该是什么原因?
Ptr<Tracker> tracker = Tracker::create( "KCF" );
这里是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 ¶meters){
...
}
@endcode
我使用的是 3.2.0 版本。
您从 tracking.hpp
粘贴的代码不是实际代码,它只是文档中的示例代码。 tracking header file 中唯一相关的代码是:
#include <opencv2/tracking/tracker.hpp>
#include <opencv2/tracking/tldDataset.hpp>
因此,要查看您实际导入的内容,您需要查看 tracking/tracker.hpp
文件 (here)。
如果这样做,您会发现 Tracker
class 声明中没有 static create
方法。该方法实际上已在 this commit. So, basically, you're right: the tutorial wasn't updated after the method was removed. You should report your issue 中删除给 opencv 团队。
话虽这么说,要使教程正常运行,您可能需要将未编译的行替换为:
Ptr<TrackerKCF> tracker = TrackerKCF::create();
这应该可以解决问题。
İn this 官方教程 题目写错了。应该是什么原因?
Ptr<Tracker> tracker = Tracker::create( "KCF" );
这里是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 ¶meters){
...
}
@endcode
我使用的是 3.2.0 版本。
您从 tracking.hpp
粘贴的代码不是实际代码,它只是文档中的示例代码。 tracking header file 中唯一相关的代码是:
#include <opencv2/tracking/tracker.hpp>
#include <opencv2/tracking/tldDataset.hpp>
因此,要查看您实际导入的内容,您需要查看 tracking/tracker.hpp
文件 (here)。
如果这样做,您会发现 Tracker
class 声明中没有 static create
方法。该方法实际上已在 this commit. So, basically, you're right: the tutorial wasn't updated after the method was removed. You should report your issue 中删除给 opencv 团队。
话虽这么说,要使教程正常运行,您可能需要将未编译的行替换为:
Ptr<TrackerKCF> tracker = TrackerKCF::create();
这应该可以解决问题。