Reputation: 1
Please i need help I am having an error when i try creating a pointer for object tracking with opencv
cv::Ptr<cv::Tracker> tracker = cv::TrackerKCF::create();
The error says:
TrackerKCF is not a member of CV.
I have checked the opencv documentation on objecttracking and i included the neccesary header. I am stuck.
The different header I included includes:
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/objdetect.hpp>
#include <opencv2/video/tracking.hpp>
#include <iostream>
I have tried creating pointer for other object tracking algorithm according to OpenCV
cv::Ptr<cv::Tracker> tracker = cv::TrackerMOSSE::create();
cv::Ptr<cv::Tracker> tracker = cv::TrackerCSRT::create();
I received same Error
Upvotes: 0
Views: 203
Reputation: 2869
This works for me:
#include <opencv2/tracking.hpp>
#include <opencv2/tracking/tracking_legacy.hpp>
int main()
{
auto tracker = cv::legacy::TrackerMOSSE::create();
cv::Ptr<cv::Tracker> tracker2 = cv::TrackerCSRT::create();
}
Note that TrackerMOSSE
has been moved to "legacy" a long time ago (OpenCV 4.5.1).
Generally, everything is well documented, e.g. https://docs.opencv.org/4.8.0/d2/da2/classcv_1_1TrackerCSRT.html, for CSRT, just chose the proper OpenCV version in the combo box and use the search widget.
Upvotes: 0