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

Building ROS node with OpenCV2.2 includes

asked 2011-04-09 00:10:58 -0600

I am unsure how to use cmake build system properly. I need to use OpenCV2.2 headers from my code but receive errors:

[ 80%] Building C object CMakeFiles/phippi.dir/src/crunch.o
In file included from /home/tonu/tyros/phippi/ros/phippi/src/crunch.c:9:
/home/tonu/tyros/phippi/ros/phippi/src/robot.h:44:31: error: imgproc/imgproc_c.h: No such file or directory
/home/tonu/tyros/phippi/ros/phippi/src/robot.h:45:31: error: highgui/highgui_c.h: No such file or directory

CMakeLists.txt has needed entries I suppose

tonu@tonu-desktop:~/tyros/phippi/ros/phippi$ grep -i opencv CMakeLists.txt 
FIND_PACKAGE(OpenCV REQUIRED)
INCLUDE_DIRECTORIES(phippi ${OPENCV_INCLUDES})
tonu@tonu-desktop:~/tyros/phippi/ros/phippi$
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
2

answered 2011-04-11 02:43:24 -0600

updated 2011-04-12 00:54:51 -0600

Instead of the opencv entries in CMakeLists.txt I have put the line

<depend package="opencv2"/>

in my manifest.xml. Then ros will generate the necessary inclusion and linkage flags for gcc automagically :-).

P.S: According to a comment in this thread, cturtle uses opencv 2.0, so you need to use diamondback for 2.2

edit flag offensive delete link more
0

answered 2011-04-13 05:59:52 -0600

updated 2011-04-13 06:02:46 -0600

Previous answer was correct but I already had that line in manifest. As suggested I removed now extra lines from CMakeLists.txt. One thing I needed to do more - add "opencv2" into #include path:

#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/highgui/highgui_c.h"
edit flag offensive delete link more

Question Tools

Stats

Asked: 2011-04-09 00:10:58 -0600

Seen: 627 times

Last updated: Apr 13 '11