intel / ros_object_analytics

Apache License 2.0
181 stars 58 forks source link

‘create’ is not a member of ‘cv::Tracker’ #38

Open ahasenfr opened 6 years ago

ahasenfr commented 6 years ago

I tried to install, apart from other packages, this packagen to get the "IntelROSProject" running. But during "catkin_make" an error occurred which I put in the title. Full error log:

/home/aha/catkin_ws/src/ros_object_analytics-0.3.0/object_analytics_nodelet/src/tracker/tracking.cpp: In member function ‘void object_analytics_nodelet::tracker::Tracking::rectifyTracker(const cv::Mat&, const Rect2d&)’:
/home/aha/catkin_ws/src/ros_object_analytics-0.3.0/object_analytics_nodelet/src/tracker/tracking.cpp:48:14: error: ‘create’ is not a member of ‘cv::Tracker’
   tracker_ = cv::Tracker::create("MIL");
              ^
ros_object_analytics-0.3.0/object_analytics_nodelet/CMakeFiles/object_analytics_nodelet.dir/build.make:374: die Regel für Ziel „ros_object_analytics-0.3.0/object_analytics_nodelet/CMakeFiles/object_analytics_nodelet.dir/src/tracker/tracking.cpp.o“ scheiterte
make[2]: *** [ros_object_analytics-0.3.0/object_analytics_nodelet/CMakeFiles/object_analytics_nodelet.dir/src/tracker/tracking.cpp.o] Fehler 1
make[2]: *** Auf noch nicht beendete Prozesse wird gewartet …
CMakeFiles/Makefile2:7122: die Regel für Ziel „ros_object_analytics-0.3.0/object_analytics_nodelet/CMakeFiles/object_analytics_nodelet.dir/all“ scheiterte
make[1]: *** [ros_object_analytics-0.3.0/object_analytics_nodelet/CMakeFiles/object_analytics_nodelet.dir/all] Fehler 2
Makefile:127: die Regel für Ziel „all“ scheiterte
make: *** [all] Fehler 2
Invoking "make -j4 -l4" failed

Searched a bit in the web and found this question on stackoverflow. Which lead to a commit in the opencv code, where the part for creating a tracker has changed. So I think your code needs some adjustment here?

Peter9606 commented 6 years ago

@ahasenfr , I guess you might are using a old version OpenCV rather than the latest one. Can you please confirm with that?

ahasenfr commented 6 years ago

As it is ROS, I'm using the integrated OpenCV version which seems to be version 3.3.1. It is ROS Kinetic with a full desktop install from march this year.

Does this mean I need to use the latest version from OpenCV itself and not the one that comes packed with ROS Kinetic?

Peter9606 commented 6 years ago

@sharronliu , can you help with this issue?

sharronliu commented 6 years ago

your log error shows in your build environment, the version number was read as OpenCV 3.2 while the libraries actually found is NOT (probably 3.3.1 since you mentioned from Kinetic).

You may try avoid seeking for OpenCV 3.2 from your catkin workspace, by properly setup the environment.

ahasenfr commented 6 years ago

Again, how can you tell that from the error log that I gave. I have set up the complete machine again, so all is new and there should be no interference with old code what so ever. But I still get the same error...

I'm completely new and unexperienced in this field and it would be somewhat nice to have some support...

I just used the command "pkg-config --modversion opencv" and the echo was "2.4.9.1" which confuses me. Because I didn't make any stand-alone installation for opencv, only ros kinetic....

ahasenfr commented 6 years ago

No additional answer?

sharronliu commented 6 years ago

OpenCV 3.3 introduced big changes in tracker APIs against 3.2

In 3.3: cv::TrackerMIL::create(); In 3.2: cv::Tracker::create("MIL");

Your build log shows, for certain reason, the catkin tools found 3.2 version number, while actually provided is 3.3

sharronliu commented 6 years ago

from catkin workspace, $ rm -rf build/CMakeCache.txt $ catkin_make -DCMAKE_BUILD_TYPE=Release --pkg object_analytics_nodelet

searching from the build log, you should found something like this, to verify the environment is as expected: -- Found OpenCV: /opt/ros/kinetic (found suitable version "3.3.1", minimum required is "3.2")

sharronliu commented 6 years ago

The package supports either 3.3 or 3.2, but not both.

ahasenfr commented 6 years ago

Like I said above, I reinstalled ubuntu from ground up, so there is no more OpenCV 3.2 installed. But I got the same problem afterwards, so I tried around and I think the Movidius Neural Compute (MvNC) SDK might be the problem. Because running the catkin_make without the SDK installed just runs fine. I even get the message

Found OpenCV: /opt/ros/kinetic (found suitable version "3.3.1", minimum required is "3.2")

in the build log in the console. After I install the NCSDK (which installs OpenCV btw), I get the error and the command pkg-config --modversion opencv gives me the "2.4.9.1", before when only ROS Kinetic was installed I got an error message that the package was not found etc.

But I need the NCSDK because I want to use the Movidius stick... I'm completely new in this field, so I don't know how to force the OpenCV version of ROS... there is a uninstall-opencv(.sh) in the NCSDK, but that didn't solve the problem :/

sharronliu commented 6 years ago

The Object Analytics supports either 3.3 or 3.2. In case you need to keep 3.2 for NCSDK, you may just try removing 3.3 from ROS kinetic.

$ apt search ros-kinetic-opencv3 $ sudo apt-get remove ros-kinetic-opencv3

Let me know if this solve your problem.

ahasenfr commented 6 years ago

No, I'm not sure but I think you are misunderstanding something. Previously a standalone OpenCV (3.2) was installed because I thought I need it, didn't know that ROS Kinetic already comes with OpenCV. But now there is only ROS and the NCSDK. While pkg-config --modversion opencv returns an error after the installation of Kinetic, it returns "2.4.9.1" if I run the same command after installing the NCSDK.

As I'm new to all this, I don't know how exactly it works, but it seems to me that the OpenCV part from ROS is not registered in the system, while the one that comes with the NCSDK does get registered. So I think, it might come from this.

But now I have noticed something. You mentioned before this:

In 3.3: cv::TrackerMIL::create(); In 3.2: cv::Tracker::create("MIL");

Previously I downloaded the (newest) package via the release site from github and there was only the line for OpenCV 3.2.... and that is absolutly normal because this release dates from end November 2017 with no support for 3.3.... I'm so dumb -.-

So sorry, for the trouble and mess here :(

sharronliu commented 6 years ago

In our verification OpenCV 3.3 works for both Object Analytics and Movidius NCS. You may try to remove other versions and keep only 3.3

sharronliu commented 6 years ago

I updated README to clarify the opencv_contrib dependency. https://github.com/intel/ros_object_analytics/pull/42

It's quite easy to confuse people when using different version of ROS Kinetic. Hopefully it get clear now.