CUDAOpenCV

Build/Compile OpenCV 3.4 in Windows with CUDA 9.1 and Intel MKL + TBB

Because 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. If you just need the Windows libraries then go to Download OpenCV 3.4 with CUDA 9.1. 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).

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).

Before continuing there are a few things to be aware of:

  1. 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. 15.45 from here, or earlier. If you have already installed the latest version you can downgrade to a previous version or use the precompiled binaries from my download page.
  2. The procedure outlined has only been tested on Visual Studio Community 2017 and 2015.
  3. I have not included instructions for compiling the python bindings because you cannot call the CUDA modules from within python. If you require python support it is better to install directly through conda.
  4. If you have built OpenCV with CUDA support then to use those libraries and/or redistribute applications built with them on any machines without the CUDA toolkit installed, you will need to ensure those machines have,
    • an Nvidia capable GPU with driver version of 388.19 or later, and
    • the following dll’s
      cublas64_91.dll
      cudart64_91.dll
      cufft64_91.dll
      nppc64_91.dll
      nppial64_91.dll
      nppicc64_91.dll
      nppidei64_91.dll
      nppif64_91.dll
      nppig64_91.dll
      nppim64_91.dll
      nppist64_91.dll
      nppitc64_91.dll
      npps64_91.dll
      

      which can be found in your

      C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\bin

      directory.

  5. The latest version of Intel TBB uses a shared library, therefore if you build with Intel TBB you need to add
    C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\redist\intel64_win\tbb\vc_mt

    to your path variable, and make sure you redistribute that dll with any of your applications.

 

Prerequisites

Assuming you already have a compatible version of Visual Studio (2017 or 2015) installed there are a couple of additional components you need to download before you can get started, you first need to:

  • Download the source files, available on GitHub. Either clone the git repo making sure to checkout the 3.4.0 tag or download this archive containing all the source file.
  • Install CMake – Version 3.10.1 is used in the guide.
  • Install The CUDA 9.1 Toolkit (cuda_9.1.85_windows.exe) + Patch 1 (cuda_9.1.85.1_windows.exe).
  • Optional – Install both the Intel MKL and TBB by registering for community licensing, and downloading for free. 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.

 

Generating OpenCV Visual Studio solution files with CMake

In the next section we are going to generate the Visual Studio solution files with CMake. 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. Then if you want to add any aditional configuration options, you can open up the build directory in the CMake GUI as described here.
 

Generating Visual Studio solution files for OpenCV 3.4 with CUDA 9.1 and Intel MKL + TBB, from the command prompt (cmd)
    1. Open up the command prompt (windows key + r, then type cmd and press enter) and enter
      "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\tbb\bin\tbbvars.bat" intel64

      to temporarily set the environmental variables for locating your TBB installation.

    2. 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.). 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 "openCvSource=PATH_TO_SOURCE"
      set "vsEdition=Community"
    3. Then choose your configuration from below and copy to the command prompt. To build with Visual Studio 2015 instead of 2017 replace -G”Visual Studio 15 2017 Win64″ with -G”Visual Studio 14 2015 Win64″ and remove -DCUDA_HOST_COMPILER onwards:
      • OpenCV 3.4 with CUDA 9.1
        "C:\Program Files\CMake\bin\cmake.exe" -B"%openCvSource%\build" -H"%openCvSource%/" -G"Visual Studio 15 2017 Win64" -DBUILD_opencv_world=ON -DCUDA_FAST_MATH=ON -DWITH_CUBLAS=ON -DINSTALL_TESTS=ON -DINSTALL_C_EXAMPLES=ON -DBUILD_EXAMPLES=ON -DCUDA_HOST_COMPILER="C:/Program Files (x86)/Microsoft Visual Studio/2017/%vsEdition%/VC/Tools/MSVC/$(VCToolsVersion)/bin/Host$(Platform)/$(PlatformTarget)/cl.exe"
      • OpenCV 3.4 with CUDA 9.1 and MKL multi-threaded with TBB
        "C:\Program Files\CMake\bin\cmake.exe" -B"%openCvSource%\build" -H"%openCvSource%/" -G"Visual Studio 15 2017 Win64" -DBUILD_opencv_world=ON -DCUDA_FAST_MATH=ON -DWITH_CUBLAS=ON -DWITH_MKL=ON -DMKL_USE_MULTITHREAD=ON -DMKL_WITH_TBB=ON -DINSTALL_TESTS=ON -DINSTALL_C_EXAMPLES=ON -DBUILD_EXAMPLES=ON -DCUDA_HOST_COMPILER="C:/Program Files (x86)/Microsoft Visual Studio/2017/%vsEdition%/VC/Tools/MSVC/$(VCToolsVersion)/bin/Host$(Platform)/$(PlatformTarget)/cl.exe"
      • OpenCV 3.4 with CUDA 9.1, MKL multi-threaded with TBB and TBB
        "C:\Program Files\CMake\bin\cmake.exe" -B"%openCvSource%\build" -H"%openCvSource%/" -G"Visual Studio 15 2017 Win64" -DBUILD_opencv_world=ON -DCUDA_FAST_MATH=ON -DWITH_CUBLAS=ON -DWITH_MKL=ON -DMKL_USE_MULTITHREAD=ON -DMKL_WITH_TBB=ON -DWITH_TBB=ON -DINSTALL_TESTS=ON -DINSTALL_C_EXAMPLES=ON -DBUILD_EXAMPLES=ON -DCUDA_HOST_COMPILER="C:/Program Files (x86)/Microsoft Visual Studio/2017/%vsEdition%/VC/Tools/MSVC/$(VCToolsVersion)/bin/Host$(Platform)/$(PlatformTarget)/cl.exe"
    4. Your OpenCV.sln solution file should now be in your PATH_TO_SOURCE/build directory, open it in Visual Studio and select your Configuration.
    5. Click Solution Explorer, expand CMakeTargets, right click on INSTALL and click Build.

      This will both build the library and copy the necessary redistributable parts to the install directory, PATH_TO_SOURCE/build/install in this example. All that is required now to run any programs compiled against these libs is to add the directory containing opencv_world340.dll (and tbb.dll if you have build with Intel TBB) to you path environmental variable.

      If everything was successful, congratulations, you now have OpenCV 3.4 built with CUDA 9.1.

 

Adding additional configuration options with the CMake GUI

Once you have generated the base Visual Studio solution file from the command prompt the easiest way to make any aditional configuration changes is through the CMake GUI. To do this:

  1. Fire up the CMake GUI.
  2. Making sure that the Grouped checkbox is ticked, click on the browse build button
     

     
    and navigate to your PATH_TO_SOURCE/build directory. If you have selected the correct directory the main CMake window should resemble the below.
     

     
  3. Now any additional configuration changes can be made by just expanding any of the grouped items and ticking or unticking the values displayed. Once you are happy just press Configure,
     

     
    if the bottom window displays configuration successful press Generate, and you should see
     

     
    Now you can open up the Visual Studio solution file and proceed as before.
  4. Troubleshooting:
    • If you are using Visual Studio 2017, make sure you are using a version earlier than 15.5, as this version is not compatible with CUDA 9.1.
    • Not all options are compatible with each other and the configuration step may fail as a result. If so examine the error messages given in the bottom window and look for a solution.
    • If the build is failing after making changes to the base configuration, I would advise you to remove the build directory and start again making sure that you can at least build the base Visual Studio solution files produces from the command line

46 thoughts on “Build/Compile OpenCV 3.4 in Windows with CUDA 9.1 and Intel MKL + TBB

  1. I try to build opencv3.4.0 with cuda9.1 using VS2017. I can generate Visual Studio solution use cmake 3.10.1. But when I do this step “Click Solution Explorer, expand CMakeTargets, right click on INSTALL and click “. I get something wrong. I can’t build opencv_world340.dll/opencv_world340d.dll. Do you know how can I solve this problem? Thanks a lot.

  2. 1>—— 已启动生成: 项目: opencv_world, 配置: Debug x64 ——
    1>Building NVCC (Device) object modules/world/CMakeFiles/cuda_compile.dir/__/core/src/cuda/Debug/cuda_compile_generated_gpu_mat.cu.obj
    1>Failed to run C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/$(VCToolsVersion)/bin/Host$(Platform)/$(PlatformTarget)/cl.exe
    1>
    1>).
    1>CMake Error at cuda_compile_generated_gpu_mat.cu.obj.cmake:206 (message):
    1> Error generating
    1> D:/opencv/build/modules/world/CMakeFiles/cuda_compile.dir/__/core/src/cuda/Debug/cuda_compile_generated_gpu_mat.cu.obj
    1>
    1>
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(171,5): error MSB6006: “cmd.exe”已退出,代码为 1。
    1>已完成生成项目“opencv_world.vcxproj”的操作 – 失败。

    1. Hi,
      As you have Visual Studio enterprise installed the path to cl.exe will be different. When you generate the cmake file, the following line
      -DCUDA_HOST_COMPILER=”C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/$(VCToolsVersion)/bin/Host$(Platform)/$(PlatformTarget)/cl.exe”
      should be corrected for your version, I imagine it is something like
      -DCUDA_HOST_COMPILER=”C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/$(VCToolsVersion)/bin/Host$(Platform)/$(PlatformTarget)/cl.exe”

  3. Firstly, thank you James Bowley and Parallel Vision for these well done and timely instructions. Before beginning the OpenCV build I upgraded to Visual Studio to the most recent 15.5.5 version, and experienced a number of compiler errors that prevented a successful build of opencv_world340.dll, which appears to be the same error that Zexi Shao saw. After uninstalling VS 2017 15.5.5 and installing the 15.4.5 version I was able to build opencv_world340.dll and all of OpenCV. Note that the CUDA Forum also has many reports of compatibility issues with the latest VS2017.

    1. Hi, thank you for bringing this to my attention, I did not realize there was a problem with the latest version of Visual Studio. I have amended the guide, as per your recomendation, and verified that 15.45 is working.

  4. Hi,
    Thanks for this post.
    Just a quick note I found: for future installers, make sure your CMake is set to the right generator before running step 3.

    If you have run step 3 with the wrong generator, just delete the build folder you already made, and try step 3 again after fixing your generator.

    1. Hi, thank you for your comment, but I am not sure what you mean by the right generator? The guide is for VS2017, with alternative instructions if you want to build with VS2015?

      1. Hi,
        You may be able to explain better than me, or maybe I have just not followed the instructions properly.
        However, my install of CMake defaulted to the VS2015 generator, where my step 3 was build using VS 2017 (15.42). Once I changed my CMake tothe VS2017 generator, and repeated the steps, everything worked.

        Cheers

        1. Hi, just to confirm you ran the below command with -G”Visual Studio 15 2017 Win64″
          “C:\Program Files\CMake\bin\cmake.exe” -B”%openCvSource%\build” -H”%openCvSource%/” -G”Visual Studio 15 2017 Win64″ -DBUILD_opencv_world=ON -DCUDA_FAST_MATH=ON -DWITH_CUBLAS=ON -DINSTALL_TESTS=ON -DINSTALL_C_EXAMPLES=ON -DBUILD_EXAMPLES=ON -DCUDA_HOST_COMPILER=”C:/Program Files (x86)/Microsoft Visual Studio/2017/%vsEdition%/VC/Tools/MSVC/$(VCToolsVersion)/bin/Host$(Platform)/$(PlatformTarget)/cl.exe”
          and cmake defaulted to VS 2015 when you opened it up in the CMake GUI?

  5. I’m seeing the same bug as Zexi, using VS 2017 15.6.3, CMake 3.11.0-rc4, Cuda 9.1 (with all applied patches). The .CU files aren’t compiling. I have the 16299 SDK installed…
    Anybody find a fix for this yet? “Using the correct generator” (commented above) doesn’t help. I’m using Visual Studio 15 2017 Win64…

  6. First, I want to say thank you for this tutorial!
    Now, I’ve been trying to compile OpenCV 3.4.1 with Cuda 9.1 following these steps for longer than I would care to admit. I keep getting this error, and I was hoping for a little help. I can get it to compile without opencv_world or without Cuda, but as soon as both are enabled I’m getting this error. I’m using VS 2017 community 15.4.5.

    Any help would be greatly appreciated!

    10>—— Build started: Project: opencv_world, Configuration: Debug x64 ——
    10>Building NVCC (Device) object modules/world/CMakeFiles/cuda_compile.dir/__/core/src/cuda/Debug/cuda_compile_generated_gpu_mat.cu.obj
    10>CMake Warning (dev) at cuda_compile_generated_gpu_mat.cu.obj.cmake:79:
    10> Syntax Warning in cmake code at column 108
    10>
    10> Argument not separated from preceding token by whitespace.
    10>This warning is for project developers. Use -Wno-dev to suppress it.
    10>
    10>CMake Warning (dev) at cuda_compile_generated_gpu_mat.cu.obj.cmake:79:
    10> Syntax Warning in cmake code at column 227
    10>
    10> Argument not separated from preceding token by whitespace.
    10>This warning is for project developers. Use -Wno-dev to suppress it.
    10>
    10>nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified
    10>CMake Error at cuda_compile_generated_gpu_mat.cu.obj.cmake:206 (message):
    10> Error generating
    10> C:/git/opencv/build/modules/world/CMakeFiles/cuda_compile.dir/__/core/src/cuda/Debug/cuda_compile_generated_gpu_mat.cu.obj
    10>
    10>
    10>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(171,5): error MSB6006: “cmd.exe” exited with code 1.
    10>Done building project “opencv_world.vcxproj” — FAILED.

    1. Hi Michael, I haven’t seen that error before, just to confirm, have you checked out the 3.4.0 tag from the git repo?

      1. I got the 3.4.1 from git, and the 3.4.0 by downloading a zip. I have tried this with all combinations of VS 2015, VS 2017 15.4.5, opencv 3.4.0, and opencv 3.4.1 source code (deleting the build folder between each try), and I get the same error when both opencv_world and cuda are enabled (but they will all compile with one or the other enabled). Because of the consistency, I’m getting the feeling that it’s an error on my end, but I’m at a loss and getting desperate to locate the problem.

        1. Hi MiChael, I suffers the same error. Have you solved it? Could you give me some hints? Thank you very much.

          1. Michael had this problem on a specific machine. He managed to compile it successfully on another one. Are you getting exactly the same error, are you using 3.4.0, on VS2017 15.4.5?

          2. Hi, I am using OpenCV 3.4.1 and OpenCV Contrib 3.4.1 with VS2017 15.4.5. But I haved installed VS 2017 15.6.5 on this machine before, and uninstalled it. I don’t know whether it is the cause. I will try on another machine. Thank you for your help.

          3. The guide is for 3.4.0 but I have tested it on 3.4.1 and apart from two examples everything should compile. I have not however tested the contrib modules, have you tried compiling without the contrib modules, have your followed the guide exactly if so what command line options are you passing to CMake? Did you check out the 3.4.1 tag or a more recent commit.

            What are the errors you are seeing, are they in CMake or during compilation?

  7. James, thanks a ton for this!
    I was able to build 3.4.0 in VS 2015 Pro with MKL, and TBB and it built flawlessly, with almost not effort at all.
    I did notice that it looks like I’ll have to find the relevant header files for opencv cuda and move them into the opencv include folder.
    Did I miss something? I would have hoped their config file would have moved them as part of the build.
    Thanks again.

    1. Hi, if you build the INSTALL solution, all of the headers should be contained insided PATH_TO_SOURCE/build/install/include, are they missing?

      1. There is a build/win_install folder, but not build/install
        I did notice that in one of your screenshots it looks like ALL_BUILD is still the startup project.
        I built the INSTALL project, but switched it to be startup. could that be it?

        1. The win_install folder is different and the startup project should not make any difference. Try building the INSTALL project again, if it was successful last time, it should just create and populate and install directory and not build anything.

          1. OK, I simply didn’t follow directions carefully enough.
            In step 5 I changed the default startup project and selected build from the menu.
            If right clicking on the INSTALL project it will build if needed and install.
            I suppose I could check install in config manager, but why bother. 🙂
            Thanks again for a great tutorial.
            Now to get on with learning more opencv.

    1. Hi,
      I am not sure on (1), but I would recommend using the supported version because I have spent far too much time myself messing around trying to get newer verisons of VS to work with CUDA 9.1.
      Regarding (2), I can’t think of any reason why that wouldn’t work, but I have not tested it to confirm. Unfortunatley to test it I would have to ruin my day and install the updated version of VS, but it should be quick for you to check.

  8. Hi~ James.
    I have followed your instruction and I got the following errors:

    —————————————
    247> test_ffmpeg.cpp
    247> test_fourcc.cpp
    247> test_gstreamer.cpp
    247> test_main.cpp
    247> test_mfx.cpp
    247> test_video_io.cpp
    246> test_optflowpyrlk.cpp
    249>—— Build started: Project: opencv_traincascade, Configuration: Release x64 ——
    246> test_optflowpyrlk.cpp
    247>LINK : fatal error LNK1181: cannot open input file ‘..\..\lib\Release\opencv_world400.lib’
    224> perf_accumulate.cpp
    246>LINK : fatal error LNK1181: cannot open input file ‘..\..\lib\Release\opencv_world400.lib’
    242> test_cloning.cpp
    242> test_decolor.cpp
    242> test_denoise_tvl1.cpp
    242> test_denoising.cuda.cpp
    242> test_hdr.cpp
    242> test_inpaint.cpp
    242> test_main.cpp
    242> test_npr.cpp
    242> test_denoising.cpp
    233>LINK : fatal error LNK1181: cannot open input file ‘..\..\lib\Release\opencv_world400.lib’
    242>LINK : fatal error LNK1181: cannot open input file ‘..\..\lib\Release\opencv_world400.lib’
    224> perf_houghlines.cpp
    224> perf_matchTemplate.cpp
    224> perf_moments.cpp
    224>LINK : fatal error LNK1181: cannot open input file ‘..\..\lib\Release\opencv_world400.lib’
    250>—— Build started: Project: ALL_BUILD, Configuration: Release x64 ——
    —————————————

    I have 19 succeed build and 232 failed. And the main error is “LINK : fatal error LNK1181: cannot open input file ‘..\..\lib\Release\opencv_world400.lib'”

    Could you please explain how to solve this error?
    My system is Windows 10 and VS 2015 with CUDA 9.1 base install.
    Thank you~

    1. Hi Larry,
      You are trying to build the latest commit of OpenCV which may not be fully tested to work with CUDA. The guide is for building OpenCV 3.4 because this is the latest version I found which compiles without any errors. Even OpenCV 3.4.1 throws some build errors becuase the CMake file does not include all the CUDA libs. Try deleting the build folder and checking out the 3.4.0 tag or downloading the 3.4.0 source code as per the guide.

  9. Hi,
    When I try to build the INSTALL I always get about 1000 warnings saying “field of class type without a DLL interface used in a class with a DLL interface”. I tried the whole thing about 3 times. I don’t know what I’m doing wrong. I’m using VS 15.4.5 2017, CUDA 9.1 and OpenCV 3.4.0. Please help.

    1. Hi, are you just seeing warnings but no errors and is the opencv_world340.dll built and present in the PATH_TO_SOURCE/build/install directory?

      1. Yes.. My openCv programs work just fine.. But when I try to run it with CUDA there is error in run, even though no error at build. This is the trial program I ran:
        #include
        #include “opencv2/opencv.hpp”

        int main(int argc, char* argv[])
        {
        //Read Two Images
        cv::Mat h_img1 = cv::imread(“stop.jpg”);
        cv::Mat h_img2 = cv::imread(“circles.png”);
        //Create Memory for storing Images on device
        cv::cuda::GpuMat d_result1, d_img1, d_img2;
        cv::Mat h_result1;
        //Upload Images to device
        d_img1.upload(h_img1);
        d_img2.upload(h_img2);

        cv::cuda::add(d_img1, d_img2, d_result1);
        //Download Result back to host
        d_result1.download(h_result1);
        cv::imshow(“Image1 “, h_img1);
        cv::imshow(“Image2 “, h_img2);
        cv::imshow(“Result addition “, h_result1);
        cv::imwrite(“images/result_add.png”, h_result1);
        cv::waitKey();
        return 0;
        }

        The error says: OpenCV Error: Gpu API call (unknown error) in ::DefaultAllocator::allocate, file C:/Users/jxj5085/Downloads/opencv 3.4/source/opencv-3.4.0/modules/core/src/cuda/gpu_mat.cu, line 116

        Please help..

        1. Hi, what happens when you run opencv_test_cudaarithm.exe in the install folder, do any of the tests pass? What GPU are you using?

          1. I’m using NVIDIA Quadro P4000
            And when I run opencv_test_cudaarithmd it fails..
            I have no idea what’s wrong..

          2. Can you send me the beginning of the output from opencv_test_cudaarithm.exe please, does it look like the below?

            Available options besides google test option:
            Usage: opencv_test_cudaarithm.exe [params]

            –cuda_device (value:-1)
            CUDA device on which tests will be executed (-1 means all devices)
            -h, –help (value:false)
            Print help info

            Run tests on all supported CUDA devices

            [———-]
            [ GPU INFO ] Run on OS Windows x64.
            [———-]
            *** CUDA Device Query (Runtime API) version (CUDART static linking) ***

            Device count: 1

            Device 0: “GeForce GTX 980M”
            CUDA Driver Version / Runtime Version 9.20 / 8.0
            CUDA Capability Major/Minor version number: 5.2
            Total amount of global memory: 8192 MBytes (8589934592 bytes)
            GPU Clock Speed: 1.13 GHz
            Max Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536,65536), 3D=(4096,4096,4096)
            Max Layered Texture Size (dim) x layers 1D=(16384) x 2048, 2D=(16384,16384) x 2048
            Total amount of constant memory: 65536 bytes
            Total amount of shared memory per block: 49152 bytes
            Total number of registers available per block: 65536
            Warp size: 32
            Maximum number of threads per block: 1024
            Maximum sizes of each dimension of a block: 1024 x 1024 x 64
            Maximum sizes of each dimension of a grid: 2147483647 x 65535 x 65535
            Maximum memory pitch: 2147483647 bytes
            Texture alignment: 512 bytes
            Concurrent copy and execution: Yes with 2 copy engine(s)
            Run time limit on kernels: Yes
            Integrated GPU sharing Host Memory: No
            Support host page-locked memory mapping: Yes
            Concurrent kernel execution: Yes
            Alignment requirement for Surfaces: Yes
            Device has ECC support enabled: No
            Device is using TCC driver mode: No
            Device supports Unified Addressing (UVA): Yes
            Device PCI Bus ID / PCI location ID: 1 / 0
            Compute Mode:
            Default (multiple host threads can use ::cudaSetDevice() with device simultaneously)

            deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.20, CUDA Runtime Version = 8.0, NumDevs = 1

            CTEST_FULL_OUTPUT
            OpenCV version: 3.4.0
            OpenCV VCS version: 3.4.0
            Build type: release
            Parallel framework: tbb
            CPU features:
            Intel(R) IPP optimization: disabled
            Intel(R) IPP version: ippIP AVX2 (l9) 2017.0.3 (-) Jul 31 2017
            OpenCL is disabled
            [==========] Running 10629 tests from 65 test cases.
            [———-] Global test environment set-up.
            [———-] 112 tests from CUDA_Arithm/GEMM
            [ RUN ] CUDA_Arithm/GEMM.Accuracy/0, where GetParam() = (GeForce GTX 980M, 128×128, 32FC1, 0, whole matrix)
            [ OK ] CUDA_Arithm/GEMM.Accuracy/0 (1491 ms)
            [ RUN ] CUDA_Arithm/GEMM.Accuracy/1, where GetParam() = (GeForce GTX 980M, 128×128, 32FC1, 0, sub matrix)
            [ OK ] CUDA_Arithm/GEMM.Accuracy/1 (4 ms)
            [ RUN ] CUDA_Arithm/GEMM.Accuracy/2, where GetParam() = (GeForce GTX 980M, 128×128, 32FC1, 0|cv::GEMM_1_T, whole matrix)

            Just to confirm
            1) Your graphics card is this Quadro P4000 see link
            2) You built against CUDA 9.1 and installed the drivers which came with the CUDA toolkit?
            3) You are running on the same computer which you compiled the drivers on?
            4) Did you compile using the CMake GUI or the command line instructions, which options, version of visual studio did you use?
            5) If you used the GUI, did you leave the CMake options at their defaults to generate binary code for all CUDA_ARCH_BIN, yours should be 6.1?
            6) Have you tried the pre-compiled binaries on the downloads page?

          3. Hi James, its me Jasmin again.
            1) Yes I’m using NVIDIA Quadro P4000
            2) I did install CUDA 9.1 + Patch1
            3) Yes, I’m running it on the same computer where I compiled the drivers
            4) I first compiled it using command line exactly as you explained for VS 2017 OpenCV with CUDA 9.1, and then using the cmake gui to add OpenCV_contrib to the extra modules using the VS 15 2017 generator. I’m using Visual Studio Community 2017 15.4.5.
            5) CUDA_ARCH_BIN says 3.0 3.5 3.7 5.0 5.2 6.0 6.1 7.0 in my CMake, I left it at default and this was the default value.
            6) No, I haven’t tried the pre-compiled binaries.

            This is what my opencv_test_cudaarithmd.exe run looks like:
            Available options besides google test option:
            Usage: opencv_test_cudaarithmd.exe [params]

            –cuda_device (value:-1)
            CUDA device on which tests will be executed (-1 means all devices)
            -h, –help (value:false)
            Print help info

            Run tests on all supported CUDA devices

            [———-]
            [ GPU INFO ] Run on OS Windows x64.
            [———-]
            *** CUDA Device Query (Runtime API) version (CUDART static linking) ***

            Device count: 1

            Device 0: “Quadro P4000”
            CUDA Driver Version / Runtime Version 9.10 / 9.10
            CUDA Capability Major/Minor version number: 6.1
            Total amount of global memory: 8192 MBytes (8589934592 bytes)
            GPU Clock Speed: 1.48 GHz
            Max Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072,65536), 3D=(16384,16384,16384)
            Max Layered Texture Size (dim) x layers 1D=(32768) x 2048, 2D=(32768,32768) x 2048
            Total amount of constant memory: 65536 bytes
            Total amount of shared memory per block: 49152 bytes
            Total number of registers available per block: 65536
            Warp size: 32
            Maximum number of threads per block: 1024
            Maximum sizes of each dimension of a block: 1024 x 1024 x 64
            Maximum sizes of each dimension of a grid: 2147483647 x 65535 x 65535
            Maximum memory pitch: 2147483647 bytes
            Texture alignment: 512 bytes
            Concurrent copy and execution: Yes with 2 copy engine(s)
            Run time limit on kernels: Yes
            Integrated GPU sharing Host Memory: No
            Support host page-locked memory mapping: Yes
            Concurrent kernel execution: Yes
            Alignment requirement for Surfaces: Yes
            Device has ECC support enabled: No
            Device is using TCC driver mode: No
            Device supports Unified Addressing (UVA): Yes
            Device PCI Bus ID / PCI location ID: 3 / 0
            Compute Mode:
            Default (multiple host threads can use ::cudaSetDevice() with device simultaneously)

            deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.10, CUDA Runtime Version = 9.10, NumDevs = 1

            CTEST_FULL_OUTPUT
            OpenCV version: 3.4.0
            OpenCV VCS version: unknown
            Build type: debug
            Parallel framework: ms-concurrency
            CPU features:
            Intel(R) IPP optimization: disabled
            Intel(R) IPP version: ippIP SSE4.2 (y8) 2017.0.3 (-) Jul 31 2017
            OpenCL is disabled
            [==========] Running 10629 tests from 65 test cases.
            [———-] Global test environment set-up.
            [———-] 112 tests from CUDA_Arithm/GEMM
            [ RUN ] CUDA_Arithm/GEMM.Accuracy/0, where GetParam() = (Quadro P4000, 128×128, 32FC1, 0, whole matrix)

          4. Hi, just to check, right after

            [———-] 112 tests from CUDA_Arithm/GEMM
            [ RUN ] CUDA_Arithm/GEMM.Accuracy/0, where GetParam() = (Quadro P4000, 128×128, 32FC1, 0, whole matrix)

            you don’t see something similar to the below?

            [ OK ] CUDA_Arithm/GEMM.Accuracy/0 (1491 ms)

            Did the CUDA routines work before you included the contrib modules?
            Did you check out the 3.4 tag of the contrib modules?
            Try with the pre-compiled binaries from the download page, just download this version without mkl or tbb, extract and run opencv_test_cudaarithm.exe from the x64\vc15\bin directory.

          5. Hey,
            Thank you so much for the help… my CUDA works fine with Opencv now, after installing windows 10 SDK in my VS.
            But even after adding the openCV_contrib to the extra_module _path in cmake gui, I’m not able to use the xfeatures2d.
            And the only .lib file in my build folder is opencv_world340d.lib is that how it’s supposed to be? Shouldnt’t I be having other libraries from my opencv_contrib?

          6. Hi, I don’t know which algorithms from xfeatures2d you are trying but, to get the non free ones, e.g. SURF, SIFT, you will need to select OPENCV_ENABLE_NONFREE.

  10. Hi James, at first, thanks for your useful sharings. I have learnt many things from your posts.
    I could do build with vs2015 win64 after four days of effort. Everything seems fine. However, if we do not add -DWITH_CUDA=ON option to cmake prompt, cuda hpp files are not read during build. I think it is important to use -DWITH_CUDA=ON option if one will use gpu modules.

    1. Hi Sukru, thank you for your input, however the guide is for version 3.4.0 where you do not need to specify WITH_CUDA_ON. I suspect you are using the latest commit of OpenCV or version 3.4.3 where you will need to include that flag.

  11. Hi James,
    I’m trying to use SIFT and SURF, so like you told I BUILD the Opencv.sln with OPENCV_ENABLE_NONFREE. But then the build showed one failed:
    7> Creating library C:/Users/jxj5085/Downloads/opencv 3.4/source/opencv-3.4.0/build/lib/Debug/opencv_world340d.lib and object C:/Users/jxj5085/Downloads/opencv 3.4/source/opencv-3.4.0/build/lib/Debug/opencv_world340d.exp
    7>C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\build\bin\Debug\opencv_world340d.dll : fatal error LNK1106: invalid file or disk full: cannot seek to 0x3D8C0002
    7>Done building project “opencv_world.vcxproj” — FAILED.

    And now I just have two .lib files in my build folder:
    opencv_img_hash340d.lib
    opencv_world340d.lib
    Shouldn’t I be have more libraries from opencv_contrib?

    My CUDA program without SIFT and SURF runs fine. But when I try to run a program with SURF, it build without any error, but at run it gives me the error:
    The procedure entry point ?downloadKeypoints@SURF_CUDA@cuda@cv….. could not be located in the dynamic link library C:\…source\Trial23\x64\Debug\Trial23.exe

    Can you please help me figure this out..

    1. I am not sure, what you are doing differently, I suspect you need to clear the build directory and start the build from scratch. I successfully built with contrib and non free by just passing the additional two arguments to cmake on the command line
      -DOPENCV_EXTRA_MODULES_PATH= -DOPENCV_ENABLE_NONFREE=ON
      There is only one additional lib file opencv_img_hash340d.lib and opencv_perf_xfeatures2dd.exe ran without any errors, after I had set the OPENCV_TEST_DATA_PATH environmental variable to point to the test data.

      The error you are getting implies that, as you said, the g\opencv_world340d.dll has not been built and the dll which your test program is trying to link to is the old one, without the non free modules.

      If I have time I will compile for compute 6.2 and send you a link to the binaries.

      1. I ran the opencv_perf_xfeatures2dd.exe and it ran but had a couple of fails with the detect.detect, detectandextract, etc.
        Time compensation is 0
        CTEST_FULL_OUTPUT
        OpenCV version: 3.4.0
        OpenCV VCS version: unknown
        Build type: debug
        Parallel framework: ms-concurrency
        CPU features: mmx sse sse2 sse3
        Intel(R) IPP optimization: enabled
        Intel(R) IPP version: ippIP SSE4.2 (y8) 2017.0.3 (-) Jul 31 2017
        [ INFO:0] Initialize OpenCL runtime…
        OpenCL Platforms:
        NVIDIA CUDA
        dGPU: Quadro P4000 (OpenCL 1.2 CUDA)
        Current OpenCL device:
        Type = dGPU
        Name = Quadro P4000
        Version = OpenCL 1.2 CUDA
        Driver version = 388.19
        Address bits = 64
        Compute units = 14
        Max work group size = 1024
        Local memory size = 48 kB
        Max memory allocation size = 2 GB
        Double support = Yes
        Host unified memory = No
        Device extensions:
        cl_khr_global_int32_base_atomics
        cl_khr_global_int32_extended_atomics
        cl_khr_local_int32_base_atomics
        cl_khr_local_int32_extended_atomics
        cl_khr_fp64
        cl_khr_byte_addressable_store
        cl_khr_icd
        cl_khr_gl_sharing
        cl_nv_compiler_options
        cl_nv_device_attribute_query
        cl_nv_pragma_unroll
        cl_nv_d3d10_sharing
        cl_khr_d3d10_sharing
        cl_nv_d3d11_sharing
        cl_nv_copy_opts
        cl_khr_gl_event
        cl_nv_create_buffer
        Has AMD Blas = No
        Has AMD Fft = No
        Preferred vector width char = 1
        Preferred vector width short = 1
        Preferred vector width int = 1
        Preferred vector width long = 1
        Preferred vector width float = 1
        Preferred vector width double = 1
        [==========] Running 215 tests from 13 test cases.
        [———-] Global test environment set-up.
        [———-] 3 tests from OCL_BruteForceMatcherFixture_Match
        [ RUN ] OCL_BruteForceMatcherFixture_Match.Match/0, where GetParam() = (640×480, 32FC1)
        [ INFO:0] Successfully initialized OpenCL cache directory: C:\Users\jxj5085\AppData\Local\Temp\opencv\3.4.0\opencl_cache\
        [ INFO:0] Preparing OpenCL cache configuration for context: NVIDIA_Corporation–Quadro_P4000–388_19
        [ PERFSTAT ] (samples = 100, mean = 6.72, median = 6.62, stddev = 0.31 (4.5%))
        [ OK ] OCL_BruteForceMatcherFixture_Match.Match/0 (724 ms)
        [ RUN ] OCL_BruteForceMatcherFixture_Match.Match/1, where GetParam() = (1280×720, 32FC1)
        [ PERFSTAT ] (samples = 90, mean = 12.47, median = 12.30, stddev = 0.37 (3.0%))
        [ OK ] OCL_BruteForceMatcherFixture_Match.Match/1 (1226 ms)
        [ RUN ] OCL_BruteForceMatcherFixture_Match.Match/2, where GetParam() = (1920×1080, 32FC1)
        [ PERFSTAT ] (samples = 100, mean = 20.26, median = 19.90, stddev = 0.71 (3.5%))
        [ OK ] OCL_BruteForceMatcherFixture_Match.Match/2 (2264 ms)
        [———-] 3 tests from OCL_BruteForceMatcherFixture_Match (4224 ms total)

        Fails:
        Requested file “./cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png” does not exist.
        params = (FAST_DEFAULT, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/0, where GetParam() = (FAST_DEFAULT, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”) (4 ms)
        [ RUN ] OCL_feature2d_detect.detect/1, where GetParam() = (FAST_DEFAULT, “stitching/a3.png”)
        C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\modules\ts\src\ts_perf.cpp(1970): error: Failed
        Requested file “./stitching/a3.png” does not exist.
        params = (FAST_DEFAULT, “stitching/a3.png”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/1, where GetParam() = (FAST_DEFAULT, “stitching/a3.png”) (6 ms)
        [ RUN ] OCL_feature2d_detect.detect/2, where GetParam() = (FAST_DEFAULT, “stitching/s2.jpg”)
        C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\modules\ts\src\ts_perf.cpp(1970): error: Failed
        Requested file “./stitching/s2.jpg” does not exist.
        params = (FAST_DEFAULT, “stitching/s2.jpg”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/2, where GetParam() = (FAST_DEFAULT, “stitching/s2.jpg”) (3 ms)
        [ RUN ] OCL_feature2d_detect.detect/3, where GetParam() = (FAST_20_TRUE_TYPE5_8, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”)
        C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\modules\ts\src\ts_perf.cpp(1970): error: Failed
        Requested file “./cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png” does not exist.
        params = (FAST_20_TRUE_TYPE5_8, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/3, where GetParam() = (FAST_20_TRUE_TYPE5_8, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”) (6 ms)
        [ RUN ] OCL_feature2d_detect.detect/4, where GetParam() = (FAST_20_TRUE_TYPE5_8, “stitching/a3.png”)
        C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\modules\ts\src\ts_perf.cpp(1970): error: Failed
        Requested file “./stitching/a3.png” does not exist.
        params = (FAST_20_TRUE_TYPE5_8, “stitching/a3.png”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/4, where GetParam() = (FAST_20_TRUE_TYPE5_8, “stitching/a3.png”) (3 ms)
        [ RUN ] OCL_feature2d_detect.detect/5, where GetParam() = (FAST_20_TRUE_TYPE5_8, “stitching/s2.jpg”)
        C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\modules\ts\src\ts_perf.cpp(1970): error: Failed
        Requested file “./stitching/s2.jpg” does not exist.
        params = (FAST_20_TRUE_TYPE5_8, “stitching/s2.jpg”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/5, where GetParam() = (FAST_20_TRUE_TYPE5_8, “stitching/s2.jpg”) (3 ms)
        [ RUN ] OCL_feature2d_detect.detect/6, where GetParam() = (FAST_20_TRUE_TYPE7_12, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”)
        C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\modules\ts\src\ts_perf.cpp(1970): error: Failed
        Requested file “./cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png” does not exist.
        params = (FAST_20_TRUE_TYPE7_12, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/6, where GetParam() = (FAST_20_TRUE_TYPE7_12, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”) (5 ms)
        [ RUN ] OCL_feature2d_detect.detect/7, where GetParam() = (FAST_20_TRUE_TYPE7_12, “stitching/a3.png”)
        C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\modules\ts\src\ts_perf.cpp(1970): error: Failed
        Requested file “./stitching/a3.png” does not exist.
        params = (FAST_20_TRUE_TYPE7_12, “stitching/a3.png”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/7, where GetParam() = (FAST_20_TRUE_TYPE7_12, “stitching/a3.png”) (3 ms)
        [ RUN ] OCL_feature2d_detect.detect/8, where GetParam() = (FAST_20_TRUE_TYPE7_12, “stitching/s2.jpg”)
        C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\modules\ts\src\ts_perf.cpp(1970): error: Failed
        Requested file “./stitching/s2.jpg” does not exist.
        params = (FAST_20_TRUE_TYPE7_12, “stitching/s2.jpg”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/8, where GetParam() = (FAST_20_TRUE_TYPE7_12, “stitching/s2.jpg”) (5 ms)
        [ RUN ] OCL_feature2d_detect.detect/9, where GetParam() = (FAST_20_TRUE_TYPE9_16, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”)
        C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\modules\ts\src\ts_perf.cpp(1970): error: Failed
        Requested file “./cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png” does not exist.
        params = (FAST_20_TRUE_TYPE9_16, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/9, where GetParam() = (FAST_20_TRUE_TYPE9_16, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”) (3 ms)
        [ RUN ] OCL_feature2d_detect.detect/10, where GetParam() = (FAST_20_TRUE_TYPE9_16, “stitching/a3.png”)
        C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\modules\ts\src\ts_perf.cpp(1970): error: Failed
        Requested file “./stitching/a3.png” does not exist.
        params = (FAST_20_TRUE_TYPE9_16, “stitching/a3.png”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/10, where GetParam() = (FAST_20_TRUE_TYPE9_16, “stitching/a3.png”) (6 ms)
        [ RUN ] OCL_feature2d_detect.detect/11, where GetParam() = (FAST_20_TRUE_TYPE9_16, “stitching/s2.jpg”)
        C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\modules\ts\src\ts_perf.cpp(1970): error: Failed
        Requested file “./stitching/s2.jpg” does not exist.
        params = (FAST_20_TRUE_TYPE9_16, “stitching/s2.jpg”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/11, where GetParam() = (FAST_20_TRUE_TYPE9_16, “stitching/s2.jpg”) (3 ms)
        [ RUN ] OCL_feature2d_detect.detect/12, where GetParam() = (FAST_20_FALSE_TYPE5_8, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”)
        C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\modules\ts\src\ts_perf.cpp(1970): error: Failed
        Requested file “./cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png” does not exist.
        params = (FAST_20_FALSE_TYPE5_8, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/12, where GetParam() = (FAST_20_FALSE_TYPE5_8, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”) (6 ms)
        [ RUN ] OCL_feature2d_detect.detect/13, where GetParam() = (FAST_20_FALSE_TYPE5_8, “stitching/a3.png”)
        C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\modules\ts\src\ts_perf.cpp(1970): error: Failed
        Requested file “./stitching/a3.png” does not exist.
        params = (FAST_20_FALSE_TYPE5_8, “stitching/a3.png”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/13, where GetParam() = (FAST_20_FALSE_TYPE5_8, “stitching/a3.png”) (3 ms)
        [ RUN ] OCL_feature2d_detect.detect/14, where GetParam() = (FAST_20_FALSE_TYPE5_8, “stitching/s2.jpg”)
        C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\modules\ts\src\ts_perf.cpp(1970): error: Failed
        Requested file “./stitching/s2.jpg” does not exist.
        params = (FAST_20_FALSE_TYPE5_8, “stitching/s2.jpg”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/14, where GetParam() = (FAST_20_FALSE_TYPE5_8, “stitching/s2.jpg”) (3 ms)
        [ RUN ] OCL_feature2d_detect.detect/15, where GetParam() = (FAST_20_FALSE_TYPE7_12, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”)
        C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\modules\ts\src\ts_perf.cpp(1970): error: Failed
        Requested file “./cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png” does not exist.
        params = (FAST_20_FALSE_TYPE7_12, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/15, where GetParam() = (FAST_20_FALSE_TYPE7_12, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”) (6 ms)
        [ RUN ] OCL_feature2d_detect.detect/16, where GetParam() = (FAST_20_FALSE_TYPE7_12, “stitching/a3.png”)
        C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\modules\ts\src\ts_perf.cpp(1970): error: Failed
        Requested file “./stitching/a3.png” does not exist.
        params = (FAST_20_FALSE_TYPE7_12, “stitching/a3.png”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/16, where GetParam() = (FAST_20_FALSE_TYPE7_12, “stitching/a3.png”) (4 ms)
        [ RUN ] OCL_feature2d_detect.detect/17, where GetParam() = (FAST_20_FALSE_TYPE7_12, “stitching/s2.jpg”)
        C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\modules\ts\src\ts_perf.cpp(1970): error: Failed
        Requested file “./stitching/s2.jpg” does not exist.
        params = (FAST_20_FALSE_TYPE7_12, “stitching/s2.jpg”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/17, where GetParam() = (FAST_20_FALSE_TYPE7_12, “stitching/s2.jpg”) (6 ms)
        [ RUN ] OCL_feature2d_detect.detect/18, where GetParam() = (FAST_20_FALSE_TYPE9_16, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”)
        C:\Users\jxj5085\Downloads\opencv 3.4\source\opencv-3.4.0\modules\ts\src\ts_perf.cpp(1970): error: Failed
        Requested file “./cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png” does not exist.
        params = (FAST_20_FALSE_TYPE9_16, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”)
        termination reason: aborted by the performance testing framework
        bytesIn = 0
        bytesOut = 0
        samples = 0 of 100
        outliers = 0
        frequency = 0
        [ FAILED ] OCL_feature2d_detect.detect/18, where GetParam() = (FAST_20_FALSE_TYPE9_16, “cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png”) (4 ms)

        Is the error in opencv_world because I used the cmake gui? Should I try it in command line?

        1. Hi, you are getting errors because the program cannot find the test data. You need to clone the OpenCv test repo and set the environmental variable to point to it, either in the command line before executing opencv_perf_xfeatures2dd.exe as

          set OPENCV_TEST_DATA_PATH=\testdata

          or by setting the user variables (if you set the system variables you may need to restart the machine for them to take effect) through the windows GUI.

Leave a Reply to Don Lefebvre Cancel reply

Your email address will not be published. Required fields are marked *