Error compiling with OpenCV (xfeatures2d.h)

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Error compiling with OpenCV (xfeatures2d.h)

Constantine
Hi,

I'm having trouble recompiling rtabmap_ros due to an OpenCV library error. I had rtabmap_ros working previously, but I had to install the libfreenect2 drivers for another project (which required recompiling OpenCV 3.0 and installing beignet for OpenCL). I have OpenCV 3.0 installed in /opt/ and the paths are exported through .bashrc. Although now, I'm having compile errors when I run catkin_make. Commenting out the opencv .bashrc exports doesn't seem to change anything.

[ 75%] Built target camera
[ 76%] Building CXX object rtabmap_ros/CMakeFiles/rtabmap_ros.dir/src/OdometryROS.cpp.o
In file included from /home/supdood/catkin_ws/devel/lib/rtabmap-0.9/../../include/rtabmap-0.9/rtabmap/core/Memory.h:37:0,
                 from /home/supdood/catkin_ws/src/rtabmap_ros/src/OdometryROS.cpp:41:
/home/supdood/catkin_ws/devel/lib/rtabmap-0.9/../../include/rtabmap-0.9/rtabmap/core/Features2d.h:235:2: error: ‘BriefDescriptorExtractor’ in namespace ‘cv’ does not name a type
  cv::BriefDescriptorExtractor * _brief;
  ^
/home/supdood/catkin_ws/devel/lib/rtabmap-0.9/../../include/rtabmap-0.9/rtabmap/core/Features2d.h:257:2: error: ‘FREAK’ in namespace ‘cv’ does not name a type
  cv::FREAK * _freak;
  ^
/home/supdood/catkin_ws/devel/lib/rtabmap-0.9/../../include/rtabmap-0.9/rtabmap/core/Features2d.h:299:2: error: ‘BriefDescriptorExtractor’ in namespace ‘cv’ does not name a type
  cv::BriefDescriptorExtractor * _brief;
  ^
/home/supdood/catkin_ws/devel/lib/rtabmap-0.9/../../include/rtabmap-0.9/rtabmap/core/Features2d.h:321:2: error: ‘FREAK’ in namespace ‘cv’ does not name a type
  cv::FREAK * _freak;
  ^
make[2]: *** [rtabmap_ros/CMakeFiles/rtabmap_ros.dir/src/OdometryROS.cpp.o] Error 1
make[1]: *** [rtabmap_ros/CMakeFiles/rtabmap_ros.dir/all] Error 2
make: *** [all] Error 2

Any help is appreciated =)
Reply | Threaded
Open this post in threaded view
|

Re: Error compiling with OpenCV (xfeatures2d.h)

matlabbe
Administrator
Hello,

I've just updated rtabmap library to support OpenCV 3 (https://github.com/introlab/rtabmap/commit/6fe1e421816231f1f1a9345a1fe009975d43554b). You should build OpenCV 3 with opencv_contrib modules (particularly xfeatures2d). After rebuilding/installing the updated rtabmap library, rtabmap_ros should be able to build (make sure to update rtabmap_ros too to have the latest fix when there are multiple OpenCV installed).

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: Error compiling with OpenCV (xfeatures2d.h)

matlabbe
Administrator

Building rtabmap_ros with OpenCV 3 issue on Indigo

After some tests on a fresh Ubuntu 14.04, using OpenCV 3 with ROS-Indigo binaries is not recommended (use OpenCV 2.4.x instead). On Indigo, cv_bridge binaries (on which rtabmap_ros depends) are built against 2.4.

If OpenCV 3 is really required, to avoid conflict when building rtabmap_ros with OpenCV 3, I suggest to uninstall cv_bridge package and all packages depended on it  (even OpenCV 2.4 binaries), then get all these packages from source on GitHub and build them in your catkin workspace.
Reply | Threaded
Open this post in threaded view
|

Re: Error compiling with OpenCV (xfeatures2d.h)

Constantine
Thanks mat. I noticed you recently added libfreenect2 support.  If I wanted to get the kinect2 working with rtabmap, did you recompile OpenCV 2.4 from source or did the ros included opencv binaries work?
Reply | Threaded
Open this post in threaded view
|

Re: Error compiling with OpenCV (xfeatures2d.h)

matlabbe
Administrator
Normally, on a default ROS system (Hydro/Indigo/Jade), RTAB-Map's dependencies are already satisfied by the binaries installed (including OpenCV 2.4).

To use rtabmap_ros with kinect v2, you can look at this launch file: rgbd_mapping_kinect2.launch

The instructions in the header:
   <!-- Kinect 2
        Install Kinect2 : Follow ALL directives at https://github.com/code-iai/iai_kinect2
                          Make sure it is calibrated!
        Run:
           $ roslaunch kinect2_bridge kinect2_bridge.launch publish_tf:=true
           $ roslaunch rtabmap_ros rgbd_mapping_kinect2.launch
   -->
   <!-- Which image resolution to process in rtabmap: sd, qhd, hd -->
   <arg name="resolution" default="qhd" />
   ...
Note that you need to use the latest code from master branch of rtabmap_ros to make rtabmap runs with the latest versions of libfreenect2 and kinect2_bridge.

cheers
Reply | Threaded
Open this post in threaded view
|

Re: Error compiling with OpenCV (xfeatures2d.h)

Constantine
Thanks for the help mat. Turns out I had some shared object files left over from OpenCV 3 in /opt/ros/. A good clean-up and a fresh ROS reinstall fixed it.