cmake linking error OpenCV_FOUND to FALSE UBUNTU 13.04
Hello,
I was following the tutorials, but then I noticed that I was using the ROS OpenCV installation instead of the local OpenCV which was installed manually. After a long web search I managed to use the local version. I am using OpenCV 2.4.9 which is OK. If I run:
python
import cv2
print cv2.__version__
I get:
2.4.9
I was getting 2.4.6
I have a code in a folder, to build it I am using cmake. The CMakeLists file is:
cmake_minimum_required(VERSION 2.8)
project( Tutorials ) to
find_package( OpenCV REQUIRED )
add_executable( bin/findContours_demo src/findContours_demo.cpp )
target_link_libraries( bin/findContours_demo ${OpenCV_LIBS} )
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
Which was working fine. Now with OpenCV 2.4.9 installed from source, when I execute cmake I get this:
CMake Warning at /usr/local/opencv-2.4.9/cmake/OpenCVConfig.cmake:161 (message):
Found OpenCV Windows Pack but it has not binaries compatible with your
configuration.
You should manually point CMake variable OpenCV_DIR to your build of OpenCV
library.
Call Stack (most recent call first):
CMakeLists.txt:3 (find_package)
CMake Error at CMakeLists.txt:3 (find_package):
Found package configuration file:
/usr/local/opencv-2.4.9/cmake/OpenCVConfig.cmake
but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
NOT FOUND.
-- Configuring incomplete, errors occurred!
I alredy went back to the ROS OpenCV and I can get it done, but if I change to 2.4.9 from source I get the same error. I am using UBUNTU 13.04 with ROS hydro. Is this error telling me I am using Windows??? I already search the web but the solutions posted are for Windows. I think something is broken with my cmake but I have no idea what is it.
Thanks.
EDIT 1
I already tried everything I could possibly imagine but nothing happens, I am still getting the same error. Has somebody tried to do this and got it done? Using ROS with the OpenCV from source?
EDIT 2
The problem was not the OpenCV installation, but the cmake
instruction. It did not have the rules to find the OpenCV package, what I did was:
Get OpenCV from source.
Unzip it, I am doing it in /usr/local
, so I have /usr/local/opencv-2.4.9
.
In /usr/local/opencv-2.4.9
do:
sudo mkdir build
cd build
Compile OpenCV, e.g. I am using this cmake
instruction:
sudo cmake -D BUILD_DOCS=ON -D WITH_QT=ON -D WITH_XINE=ON -D WITH_OPENGL=ON -D WITH_TBB=ON -D WITH_OPENNI=ON -D BUILD_EXAMPLES=ON -D WITH_OPENCL=ON -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local/opencv-2.4.9 ..
sudo make
sudo make install
Add to the file /etc/ld.so.conf
:
/usr/local/opencv-2.4.9/lib
Then:
sudo ldconfig
Add the paths to OpenCV to your .bashrc
, for me was:
source /opt/ros/hydro/setup.bash
CMAKE_PREFIX_PATH=/usr/local/opencv-2.4.9:$CMAKE_PREFIX_PATH
CPATH=/usr/local/opencv-2.4.9/include:$CPATH
LD_LIBRARY_PATH=/usr/local/opencv-2.4.9/lib:$LD_LIBRARY_PATH ...