OpenCV 2.4.9 and CUDA 6.5 - opencv

I recently upgraded to CUDA 6.5, and I recompiled succefully OpenCV 2.4.9 on Ubuntu 14.04.
However when I recompiled my project using OpenCV and cmake, I got the following configuration error:
-- GCC detected, adding compile flags
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
Could NOT find CUDA: Found unsuitable version "6.5", but required is exact
version "6.0" (found /usr/local/cuda-6.5)
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:313 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-2.8/Modules/FindCUDA.cmake:806 (find_package_handle_standard_args)
/usr/local/share/OpenCV/OpenCVConfig.cmake:215 (find_package)
CMakeLists.txt:9 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/andrey/Data/Projects/Groups_code/Lulu/build-Ubuntu/CMakeFiles/CMakeOutput.log".
How to fix this one? Do I need to reinstall cmake, or upgrade Modules file in cmake?

Try delete cmake cache.
"File"->"Delete Cache". Then "Configure" , "Generate" as usual.

In my experience, when OpenCV is built with a certain version of CUDA it specifies that in the file /usr/local/share/OpenCV/OpenCVConfig.cmake. If you have changed your version of CUDA after you built OpenCV then rebuilding OpenCV with the new CUDA version should fix this. That will basically rewrite the new version to /usr/local/share/OpenCV/OpenCVConfig.cmake.
In addition, it seems that you are calling find_package(CUDA) after calling find_package(OpenCV). That enforces cmake to look for the version of CUDA with which OpenCV was built. If you call find_package(CUDA) before find_package(OpenCV) you will likely see something like:
-- Found CUDA: /usr/local/cuda-6.5 (found version "6.5")
CMake Error at /usr/local/share/OpenCV/OpenCVConfig.cmake:222 (message):
OpenCV static library was compiled with CUDA 6.0 support. Please, use the
same version or rebuild OpenCV with CUDA 6.5
Call Stack (most recent call first):
CMakeLists.txt:49 (find_package)
OpenCV source has been changing over the years with different versions of CUDA and so a version mismatch there can cause things to break. So the recommended way to fix this is to rebuild OpenCV.

Related

Issue building OpenCV with ccache and CUDA

Trying to build OpenCV 3.3.1 with CUDA support, using ccache:
Ubuntu 16.04 LTS
OpenCV 3.3.1
CUDA 8.0
CCACHE 3.2.4
Make fails for .cu files, giving error:
/usr/bin/ccache: invalid option -- 'E'
Usage:
ccache [options] ...
I've added the /usr/lib/ccache to PATH, which cc and which c++ outputs /usr/lib/ccache/cc and /usr/lib/ccache/c++ respectively. Manually added a symlink for nvcc in /usr/lib/ccache directory, but now OpenCV CMakeLists.txt cannot find CUDA.
But interestingly I can build this sample CUDA code, with this CMake file without any issue.
I've searched the net and read most posts on SO and other forums, but had no success. I've had this issue for previous versions of OpenCV as well, but always disabled ccache as a solution.
Can someone please explain the reason behind this error?
Trying to set
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda
seems to solve this problem for me.

OpenCV Crosscompile for ARM: highgui error (GTK2+)

I'm have build the OpenCV library from source for Zynq (ARM). But, OpenCV was build on the same PC for x86 (PC) also. Firstly, I can execute every example on my PC without any issues. Secondly, I am able to crosscompile and execute every program on the arm target, except the ones including highgui libraries, where I receive the following error:
OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvShowImage, file /home/hristov/workspace/opencv/modules/highgui/src/window.cpp, line 534
terminate called after throwing an instance of 'cv::Exception'
what(): /home/user/workspace/opencv/modules/highgui/src/window.cpp:534: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvShowImage
Yes, I have gone through the forum for solutions for this issue but some answers were unclear and I would like some more detail into this. I have created the OpenCV build for ARM build WITH_GTK and GTK2. Also installed libgtk2.0-dev, pkg-config
However, From another topic on this forum, I learned that the problem lies in setting up the pkg-config: http://answers.opencv.org/question/57945/opencv-gui-with-gtk-2-solved/
Q) Based on the above solution, Do you set the path for PKG_CONFIG_PATH on your ARM platform (Zynq) or on the PC platform (Ubuntu PC)? Because, it is already set to the described path on the ARM platform whereas it is different on the PC Linux platform. More details of the current path is shown below:
PKG_CONFIG_PATH in PC(Ubuntu):
/usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
PKG_CONFIG_PATH in ARM (Embedded platform):
/usr/local/lib/arm-linux-gnueabihf/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/arm-linux-gnueabihf/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
If the pkg-config must be changed on my PC, to the /usr/lib/arm-linux-gnueabihf/pkgconfig/ location, I cannot find any pkg-config in that location. Should I create a new one, by copying the folder from my target?
Q) Also, Should the GTK libraries also be installed in the Target Embedded system (ARM)?
Hope someone can help me with this solution as I have rebuild the libraries umpteen times with many different solutions, but to no avail. Thanks!

CMake error: BUILD_TBB option supports Windows on ARM only

I am trying to build libraries with CMake for a vision detection system to be built in OpenCV using Visual Studio 2012's C++ compiler. After a lot of fixing of configurations, installation of Qt 5 and also Openni, I am still getting the following errors from the CMake configuration step:
Checking for Windows (Phone) Platform SDK 8.0/8.1
Checking for Visual Studio 2012/2013
WARNING, OpenNI library directory (set by OPENNI_LIB_DIR variable) is not found or does not have OpenNI libraries.
WARNING, OpenNI include directory (set by OPENNI_INCLUDE_DIR variable) is not found or does not have OpenNI include files.
WARNING, PrimeSensor Module binaries directory (set by OPENNI_PRIME_SENSOR_MODULE_BIN_DIR variable) is not found or does not have PrimeSensor Module binaries.
Looking for Mfapi.h
Looking for Mfapi.h - found
Warning at cmake/OpenCVFindIntelPerCSDK.cmake:17 (message):
Intel Perceptual Computing SDK library directory (set by INTELPERC_LIB_DIR
variable) is not found or does not have Intel Perceptual Computing SDK
libraries.
Call Stack (most recent call first):
cmake/OpenCVFindLibsVideo.cmake:291 (include)
CMakeLists.txt:482 (include)
CMake Error at 3rdparty/tbb/CMakeLists.txt:5 (message):
BUILD_TBB option supports Windows on ARM only!
Use regular official TBB build instead of the BUILD_TBB option!
Configuring incomplete, errors occurred!
See also "C:/OpenCV/opencv/lib/CMakeFiles/CMakeOutput.log".
From cmake_gui, you can quickly disable BUILD_TBB variable. If you want TBB, you have to build it separately by yourself, and then you can use this guide to activate it in OpenCV.

opencv error: no GPU support

I have install Cuda 6.5 and opencv 2.4.9 with visual studio 2010, when I run gpu, I get error
Opencv Error: No GPU support(the library is compiled without PGU support) in the row_nogpu, file C:/builds/2_4_Packslave-win32-vc10-shared/opencv/modules/gpu/src/precomp.hpp line 135
I get this error, is any one can help what do I have to do?
Thanks
I believe, you have to actually build the libraries with CUDA support. I Imagine This Guide will be useful.
This can be caused because of following.
Use the flag WITH_CUDA=ON during cmake
You are trying to load the libraries which are compiled without GPU support, after you install opencv make sure you change the libraries path to that of GPU supported once.

Can not find CUDA_NPP_LIBRARY_ROOT_DIR in cmake

I am trying to install opencv 2.2 with cuda enabled. I have installed CUDA and also have compiled and tested some programs with it.
Now I want to install opencv with gpu. I downloaded cmake-gui and set CUDA on. When I hit the configure button it does find cuda toolkit but gives me this error:
CMake Error at modules/gpu/FindNPP.cmake:102 (message):
NPP headers/libraries are not found. Please specify
CUDA_NPP_LIBRARY_ROOT_DIR in CMake or set $NPP_ROOT_DIR.
Call Stack (most recent call first):
modules/gpu/CMakeLists.txt:38 (find_package)
I have installed everything in the default directory.
My cuda-toolkit version is 4.0. Also I have opencv 2.2 without gpu installed.
And in case it might help:
My OS is ubuntu 11.04, my gpu is geforce gtx550, and my cuda driver version is 280.13

Resources