Rosanswers logo


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.

Originally posted by asrinivasan31 on ROS Answers with karma: 51 on 2011-12-02

Post score: 0


1 Answer 1


Rosanswers logo

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!

Originally posted by Kevin with karma: 2962 on 2011-12-04

This answer was ACCEPTED on the original site

Post score: 1


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.