Ask Your Question
0

How to link own build OpenCV instead of ros-hydro-opencv

asked 2014-07-23 02:52:39 -0600

YuhuaZou gravatar image

Hi All

I've build OpenCV 2.4.9 from source and installed in "/opt/opencv". Meanwhile I have installed ROS Hydro which has ros-hydro-opencv2. Now I'm developing a catkin package that depends on OpenCV. My Cmake settings is as follows:

cmake_minimum_required(VERSION 2.8)
project(marker_finder)

set(CMAKE_PREFIX_PATH "/opt/opencv" ${CMAKE_PREFIX_PATH})

####################################################
# Dependencies:
find_package(catkin REQUIRED COMPONENTS roscpp roslib)
find_package( OpenCV REQUIRED )

####################################################
# Build library.

catkin_package(
  INCLUDE_DIRS include
  LIBRARIES marker_finder
  CATKIN_DEPENDS roscpp roslib
  DEPENDS opencv
  )

include_directories(
  include
  ${catkin_INCLUDE_DIRS}
  ${OpenCV_INCLUDE_DIRS}
  )


message(STATUS ${OpenCV_INCLUDE_DIRS})

SET(MF_LIB_SRCS
  src/...  
  )

SET(MF_LIB_HDRS
  include/...
  )

add_library (marker_finder ${MF_LIB_SRCS} ${MF_LIB_HDRS})

target_link_libraries (marker_finder
  GL
  GLU
  ${catkin_LIBRARIES}
  ${OpenCV_LIBRARIES})

install(TARGETS marker_finder LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
install(DIRECTORY include/marker_finder/ DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})

The output of

message(STATUS ${OpenCV_INCLUDE_DIRS})

is

/opt/ros/hydro/include/opencv/opt/ros/hydro/include

Which is not what I expected.

/opt/opencv/include

So how can I make CMake find the correct OpenCV package I want ?

edit retag flag offensive close merge delete

Comments

I think this is quite obvious, since you want to keep using the OpenCV_INCLUDE_DIRS environment variable, just change the value it is pointing to. Look here for more information.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-23 03:34:07 -0600 )edit

Hi @YuhuaZou, did you end up finding a solution to this problem?

MrSquid gravatar imageMrSquid ( 2019-03-14 20:39:07 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-07-23 12:22:16 -0600

JewelCV gravatar image

i think

OpenCV_INCLUDE_DIRS=/opt/opencv/include

might solve it.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-07-23 02:52:39 -0600

Seen: 4,784 times

Last updated: Jul 23 '14