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

CMakeList find_package OpenCV SVN

asked 2012-04-20 02:16:47 -0600

andreas__ gravatar image

updated 2014-01-28 17:12:02 -0600

ngrennan gravatar image

Hi all,

I have the following problem, which drives me crazy. I installed ROS fuerte with ros-fuerte-opencv2. I also compiled OpenCV from the svn repositories because I need CUDA and OpenGL support which is not included by ros opencv.

However, my rosnode always gets linked against the ROS opencv libraries. e.g.: libopencv_highgui.so.2.3 => /opt/ros/fuerte/lib/libopencv_highgui.so.2.3

my manifest.xml

    <package>
  <description brief="test">

     test

  </description>
  <author>andreas</author>
  <license>BSD</license>
  <review status="unreviewed" notes=""/>
  <url>http://ros.org/wiki/test</url>
  <depend package="roscpp"/>
  <depend package="cv_bridge"/>
  <depend package="std_msgs"/>
  <depend package="image_transport"/>
  <rosdep name="opencv2.3.3"/>

</package>

before ros opencv got updated to versionn 2.3.3 it worked fine by the way. Now there's apparently no distinction between the version numbers any more.

My CMakeList.txt:

cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

set(ROS_BUILD_TYPE RelWithDebInfo)

find_package(OpenCV 2.3.3 REQUIRED)
find_package(GLUT)
find_package(OpenGL)

rosbuild_init()

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

rosbuild_add_library(CGaborKernel src/helper/CGaborKernel.cpp)
rosbuild_add_library(memory_stat src/helper/memory_stat.cpp)

find_package(CUDA)
if(CUDA_FOUND)
    rosbuild_add_executable(img_node_cuda src/img_node_cuda.cpp)
    target_link_libraries(img_node_cuda CGaborKernel memory_stat ${GLUT_LIBRARY} ${OPENGL_LIBRARY} ${OpenCV_LIBS})
endif()

I made it work for the moment by copying the svn libraries over the ros opencv libraries, but that's obiously the worst solution.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2012-04-20 04:07:52 -0600

AHornung gravatar image

updated 2012-04-20 04:09:20 -0600

Since you're using the regular CMake find_package mechanism, it picks up the system-installed OpenCV first. The ROS fuerte setup sets your CMAKE_PREFIX_PATH environment variable. You can try to override it by putting your local CMake installation path in front of the CMAKE_PREFIX_PATH, or exporting the variable OpenCV_DIR to point to your local installation containing OpenCVConfig.cmake.

And yes, I agree that copying stuff over your system-installed OpenCV is a bad idea. It will break most ROS libs depending on it if it's not binary-compatible.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-04-20 02:16:47 -0600

Seen: 2,719 times

Last updated: Apr 20 '12