33 lines
921 B
C++
33 lines
921 B
C++
#ifndef _SAMPLES_UTILITY_HPP_
|
|
#define _SAMPLES_UTILITY_HPP_
|
|
|
|
#include <opencv2/tracking.hpp>
|
|
|
|
inline cv::Ptr<cv::Tracker> createTrackerByName(cv::String name)
|
|
{
|
|
cv::Ptr<cv::Tracker> tracker;
|
|
|
|
if (name == "KCF")
|
|
tracker = cv::TrackerKCF::create();
|
|
else if (name == "TLD")
|
|
tracker = cv::TrackerTLD::create();
|
|
else if (name == "BOOSTING")
|
|
tracker = cv::TrackerBoosting::create();
|
|
else if (name == "MEDIAN_FLOW")
|
|
tracker = cv::TrackerMedianFlow::create();
|
|
else if (name == "MIL")
|
|
tracker = cv::TrackerMIL::create();
|
|
else if (name == "GOTURN")
|
|
tracker = cv::TrackerGOTURN::create();
|
|
else if (name == "MOSSE")
|
|
tracker = cv::TrackerMOSSE::create();
|
|
else if (name == "CSRT")
|
|
tracker = cv::TrackerCSRT::create();
|
|
else
|
|
CV_Error(cv::Error::StsBadArg, "Invalid tracking algorithm name\n");
|
|
|
|
return tracker;
|
|
}
|
|
|
|
#endif
|