Using opencv tracking with ROS kinetic
Hey, i want to use the tracking packageof opencv3 contrib in my ROS package.
The tracking packagee seems to be installed correctly, i can find the tracker.cpp in my opencv folder and also use other functions like
Ptr<tracker> tracker = TrackerMIL::create();
But when i want to use "selectROI" is get an error:
error: ‘selectROI’ was not declared in this scope
Rect2d r = selectROI(im);
I tried the solution from here but that didn't work for me.
In my opinion i got a linking error like the OP from the link, but what i don't understand is how i can create a Tracker but when i want to use the "selectROI" function its not declared.
Thats the Code i'm trying to compile:
#include <opencv2/opencv.hpp>
#include <opencv2/video/tracking.hpp>
#include "opencv2/highgui/highgui.hpp"
using namespace std;
using namespace cv;
int main (int argc, char **arv)
{
// Read image
Mat im = imread("~/catkin_ws/Bild.jpg");
// Select ROI
Rect2d r;
r = selectROI(im);
// Crop image
Mat imCrop = im(r);
// Display Cropped Image
imshow("Image", imCrop);
waitKey(0);
return 0;
}
Thanks in advance!
Not a complete answer, but:
and
No, this would be a compiler error: it cannot find the declaration of the symbol
selectROI
. Are you including the correct headers?I think i do, got the test code from here and just strg+C it to be able to better trace back the source of the problem. My complete code is more, but as the "selectROI" seems to be the problem i broke it down
Well it's still a compiler error.
But i don't get why everyone can use the function with the same headers, but when i try it can't compile. While other function of the tracking API are working just fine.
I sympathise, but I can't help you with that. I just wanted to let you know it's not a linker error.
Btw: OpenCV has its own forum:
answers.opencv.org
. You might want to ask this over there.Thanks for that, it helps to find a solution :)
And OpenCV: Can't find modules from contrib repository (Tracker, selectROI) seems to suggest that perhaps the OpenCV version you are using doesn't include the necessary functionality. I'm not an OpenCV expert, but is the contribs stuff included?