To build with Visual Studio 2015 instead of 2017 replace -G”Visual StuWin64″ with -G”Visual StuWin64″ and remove -DCUDA_HOST_COMPILER onwards: Then choose your configuration from below and copy to the command prompt.If you not using Visual Studio Community 2017 then you also need to replace Community with the edition you have installed (Professional or Enterprise). Set the location of the source files, and your Visual Studio edition, by entering the text shown below, first setting PATH_TO_SOURCE to the root of the OpenCV files you downloaded or cloned (the directory containing 3rdparty,apps,build,etc.).To temporarily set the environmental variables for locating your TBB installation. "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\tbb\bin\tbbvars.bat" intel64 Open up the command prompt (windows key + r, then type cmd and press enter) and enter.
Generating Visual Studio solution files for OpenCV 3.4 with CUDA 9.1 and Intel MKL + TBB, from the command prompt (cmd) Then if you want to add any aditional configuration options, you can open up the build directory in the CMake GUI as described here. There are two ways to do this, from the command prompt or with the CMake GUI, however quickest and easiest way to proceed is to use the command prompt to generate the base configuration. In the next section we are going to generate the Visual Studio solution files with CMake. Generating OpenCV Visual Studio solution files with CMake MKL version 2018.0.124 and TBB version 2018.0.124 are used in this guide, I cannot guarantee that other versions will work correctly.
Either clone the git repo making sure to checkout the 3.4.0 tag or download this archive containing all the source file.
CUDA 9.1 is not supported by the latest versions of Visual Stutio 2017, 15.5 onwards, to follow the guide you need to install a supported version, e.g.
The guide below details instructions on compiling the 64 bit version of OpenCV 3.4 shared libraries with Visual Studio 2017 (will also work with Visual Studio 2015 if selected in CMake as long as you do not include the CUDA_HOST_COMPILER option in the commands below), CUDA 9.1, support for both the Intel Math Kernel Libraries (MKL) and Intel Threaded Building Blocks (TBB).īefore continuing there are a few things to be aware of: To see the performance boost from calling the OpenCV CUDA functions with these libraries see the OpenCV 3.4 GPU CUDA Performance Comparisson (nvidia vs intel).
If you just need the Windows libraries then go to Download OpenCV 3.4 with CUDA 9.1. OpenCV 4.0 which is compatible with CUDA 10.0 and the latest version of Visual Studio 2017 was released on, go to Build OpenCV 4.0.0 with CUDA 10.0 and Intel MKL +TBB in Windows, for the updated guide.īecause the pre-built Windows libraries available for OpenCV 3.4 do not include the CUDA modules, or the support for Intel’s Math Kernel Libraries (MKL) or Intel Threaded Building Blocks (TBB) performance libraries, I have included the build instructions, below for anyone who is interested.