Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Failure building OpenCV 3.2 with CUDA support for VS15

Hi!

I am trying to build OpenCV 3.2 with CUDA support for Microsoft Visual Studio 15 on Windows 10, but I have run into some trouble. I'll try to go through step by step what I have done so far to make it easier for you guys to understand if and where I have done anything wrong. So:

  • I startet out downloading the pre-built binaries of OpenCV 3.2 for Windows 10 from www.opencv.org/downloads.html. I placed OpenCV at C:\opencv for an easy path.
  • I then opened a command promt and navigated to the C:\opencv directory and cloned the git repository for the opencv_contrib modules into that directory. The contents of C:\opencv is so far the folders build, opencv_contrib and sources.
  • I then downloaded the latest version of the CUDA Toolbox, although I have read that this comes with OpenCV 3.2 already.
  • Next, I downloaded the latest version of Cmake and opened the GUI. I set the source code folder to C:/opencv/sources and the build folder to C:/opencv/build.
  • I then clicked configure, waited for it to be done and changed the OPENCV_EXTRA_MODULES_PATH to C:/opencv/opencv_contrib/modules. I then clicked reconfigure and acquired the list of all modules that the source material would allow me to generate a solution for.
  • Next, I ticked on the opencv_contrib modules that I need (ximgproc, xfeatures2d, plot, text and xobjdetect) and all the cuda modules. I also ticked on BUILD_CUDA_STUBS. I made sure that WITH_CUBLAS and WITH_CUDA was ticked on, set my CUDA_ARCH_BIN to 5.2 and CUDA_GENERATION to Maxwell (I'm using a GTX 960). I then generated the solution. This all went fine with no errors. Note: The generation was done with the Microsoft Visual Studio 14 2015 C++ compiler, as this is the only one I have gotten the opencv_contrib modules to work with before.
  • I then opened the OpenCV.sln project and built the ALL_BUILD and INSTALL projects in both debug and release, in that order. This produced the warnings mentioned here but completed with no errors.
  • I thought everything was fine at this point and decided to make an example project to test out OpenCV's capabilities with CUDA support. I made a new VS15 project and set up the include directories, linkers and library directories. Now, when I try to compile my example project I get the error:

    OpenCV Error: No CUDA support (The library is compiled without CUDA support) in throw_no_cuda, file C:\build\master_winpack-build-win64-vc14\opencv\modules\core\include\opencv2/core/private.cuda.hpp, line 97
    

Anyone else experienced anything similar? And does anyone know how to fix this? Any help would be appreciated.