ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How do I use nonfree opencv Libraries in ROS

asked 2015-06-06 00:22:49 -0500

erivera1802 gravatar image

Hello, I need to use a SURF feature detector in ros. I succeded when I used it outside ROS, but when i try to make a code for a node in ROS, the compiler shows me this:

CMakeFiles/stream_node.dir/src/stream_node.cpp.o: In function    `ImageConverter::imageCb(boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&)':stream_node.cpp:  (.text._ZN14ImageConverter7imageCbERKN5boost10shared_ptrIKN11sensor_msgs6Image_ISaIvEEEEE[_ZN14ImageConverter7imageCbERKN5boost10shared_ptrIKN11sensor_msgs6Image_ISaIvEEEEE]+0x134): undefined reference to `cv::SURF::SURF(double, int, int, bool, bool)'
 CMakeFiles/stream_node.dir/src/stream_node.cpp.o: In function `cv::SURF::~SURF()':
 stream_node.cpp:(.text._ZN2cv4SURFD1Ev[_ZN2cv4SURFD1Ev]+0xe): undefined reference to `vtable for cv::SURF'
 stream_node.cpp:(.text._ZN2cv4SURFD1Ev[_ZN2cv4SURFD1Ev]+0x26): undefined reference to `vtable for cv::SURF'
 stream_node.cpp:(.text._ZN2cv4SURFD1Ev[_ZN2cv4SURFD1Ev]+0x2e): undefined reference to `vtable for cv::SURF'
 stream_node.cpp:(.text._ZN2cv4SURFD1Ev[_ZN2cv4SURFD1Ev]+0x3b): undefined reference to `VTT for cv::SURF'
 collect2: error: ld returned 1 exit status

I understand it is because SURF is ubicated in a nonfree library of opencv, then, my includes are:

#include <ros/ros.h>
#include <image_transport/image_transport.h>
#include <cv_bridge/cv_bridge.h>
#include <sensor_msgs/image_encodings.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <stdio.h>
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/nonfree/features2d.hpp"
#include "opencv2/nonfree/nonfree.hpp"

However, It still doesnt work. Somebody knows what I have to do? Maybe editing the CMakeList.txt?

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-06-06 08:19:26 -0500

daenny gravatar image
edit flag offensive delete link more

Comments

Thanks! I have seen the link where he installs Opencv without OpenCL, but I dont think that would work. But it did! If someone relates that problem the solution is, in the installlation of openCV, install it this way: cmake -D CMAKE_BUILD_TYPE=RELEASE -D WITH_OPENCL=OFF -D CMAKE_INSTALL_PREFIX=/usr/

erivera1802 gravatar image erivera1802  ( 2015-06-10 17:01:39 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-06-06 00:22:49 -0500

Seen: 3,782 times

Last updated: Jun 06 '15