Hello, I have been using opencv in python without issues. I am now trying to switch to cpp, which I am new to. I have recently reinstalled opencv and compiled it with opencv_contrib following the instructions in the readme. I am using the tracking features of opencv for my project.
When I go to make my file I get the following error:
/home/sydney/Desktop/projects/Leaf_Tracking_cpp/tracker.cpp: In function ‘int main(int, char)’: /home/sydney/Desktop/projects/Leaf_Tracking_cpp/tracker.cpp:33:9: error: ‘Tracker’ was not declared in this scope 33 | Ptr<tracker> tracker; | ^~~~~~~ /home/sydney/Desktop/projects/Leaf_Tracking_cpp/tracker.cpp:33:16: error: template argument 1 is invalid 33 | Ptr<tracker> tracker; | ^ /home/sydney/Desktop/projects/Leaf_Tracking_cpp/tracker.cpp:37:19: error: ‘Tracker’ is not a class, namespace, or enumeration 37 | tracker = Tracker::create(trackerType); | ^~~~~~~ /home/sydney/Desktop/projects/Leaf_Tracking_cpp/tracker.cpp:76:12: error: ‘selectROI’ was not declared in this scope; did you mean ‘select’? 76 | bbox = selectROI(frame, false); | ^~~~~~~~~ | select /home/sydney/Desktop/projects/Leaf_Tracking_cpp/tracker.cpp:82:12: error: base operand of ‘->’ is not a pointer 82 | tracker->init(frame, bbox); | ^~ /home/sydney/Desktop/projects/Leaf_Tracking_cpp/tracker.cpp:91:26: error: base operand of ‘->’ is not a pointer 91 | bool ok = tracker->update(frame, bbox); | ^~ make[2]: [CMakeFiles/tracker.dir/build.make:63: CMakeFiles/tracker.dir/tracker.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:73: CMakeFiles/tracker.dir/all] Error 2 make: * [Makefile:84: all] Error 2
I notice that others have had the same error here but its not clear how they were able to get the code to compile.
Any suggestions on how to solve this would be greatly appreciated! Thank you!
One thing to note is that when I use "#include <opencv2 tracking.hpp="">" I get an error that it can't find tracking.hpp so I have replaced that line in the sample code with "#include <opencv2 video="" tracking.hpp="">".