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

problem compiling ros with standalone opencv 2.3.1

asked 2011-12-02 12:47:41 -0600

asrinivasan31 gravatar image

updated 2014-04-20 14:09:49 -0600

ngrennan gravatar image


I having trouble getting rosmake to compile with the new version of opencv. I keep getting "fatal error: opencv-2.3.1/opencv2/features2d/features2d.h: No such file or directory compilation terminated."

I don't remember personally installing opencv, it must have come up with something else, perhaps (ROS-Electric). But anyway, I have the *.so.2.3.1 libraries in the /usr/lib folder and the include directory in /usr/include/opencv-2.3.1/opencv2/.... I set the C_PATH_INCLUDE and CPLUS_PATH_INCLUDE variables to the 2.3.1 directory and yet it still can't find the .h files.

What else is required so my package can see it? I think Cmakelists.txt only has the Find_Package(OpenCv) which only finds the old opencv and not the 2.3.1 version. I need it to be this version so I can use the simple blob detection api. Any help is appreciated.

Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2011-12-04 04:22:07 -0600

Kevin gravatar image

updated 2011-12-04 04:46:45 -0600

It would be helpful if you gave more information ... operating system, version of ROS, etc.

OpenCV is an external library in Electric (which I am guessing you are using). Try installing the library. On the Mac using homebrew do: brew install opencv.

In my CMakeLists.txt file to build a fictional program called test, I have the following:

find_package(OpenCV 2.3.1 REQUIRED)
rosbuild_add_executable(test src/test.cpp )
target_link_libraries(test ${OpenCV_LIBS})

If you are not sure which opencv cmake is finding, you can do something like this to the CMakeLists.txt:

     message("====== Found ${OpenCV_VERSION} =======")

Hope that helps!

edit flag offensive delete link more

Question Tools


Asked: 2011-12-02 12:47:41 -0600

Seen: 700 times

Last updated: Dec 04 '11