link to opencv2 in kinetic
Hello! I am using ROS Kinetic on Ubuntu 16.04 Xenial 64bit. I have installed both opencv2 (by libopencv-dev) and opencv3 (by ros-kinetic-opencv3). A project of mine depends on cv_bridge, the problem is: by compilation opencv3 is always linked instead of opencv2 that is acutally needed, although in CMakeLists.txt I have explicitly indicated to use opencv2:
find_package(OpenCV 2.4.9.1 EXACT REQUIRED)
I also tried:
find_package(OpenCV 2 REQUIRED)
but it failed too. If I remove the dependency of cv_bridge in CMakeLists.txt, opencv2 is correctly linked, but the compilation complains the lack of cv_bridge library. Any suggestion or experience on this issue? Thanks in advance!
PS: when I output the path where the opencv2 header files are found to be stored in CMakeLists.txt:
message( STATUS "OpenCV Include Dir: " ${OpenCV_INCLUDE_DIRS} )
it gives me a weird result:
/usr/include/opencv/usr/include
although it does not break the compilation when the dependency on cv_bridge is removed.
Please mark the answer as correct if it answer your question.
Unfortunately, it does not. Actually, the workaround is to clone cv_bridge source, and switch it to indigo branch to force it to link against opencv2, then compile it, and everything is ok again.
I installed cv_brdige from source and switched to indigo branch as suggested, but it seems like I am still using ros-kinetic-opencv3 because when I run my program, I get an error with the following line: "file /tmp/binarydeb/ros-kinetic-opencv3-3.2.0/modules/core/src/matrix.cpp terminate". Any idea?