As the question title states, I am trying to compile my own binaries for the Python3 OpenCV library on Windows 10, with CUDA support and the contrib files.
I have been following this guide on installing OpenCV 3 on Windows concurrently with this one for compiling OpenCV with CUDA support. This question is similar to another question, but I am using VS2015, and the solution posted has not solved my issue.
The Problem
I was able to successfully follow these guides and configure, generate, and build with CMake (with GUI). However, when I ran Python from a fresh terminal after this, I had the same problem mentioned in the other question I linked previously. I have attempted setting path variables as per this solution, but the problem remained. That is when I noticed this line in my CMake output:
It appears as though CMake is failing to find Python libraries, despite having set them manually as per step 5.2 of the install guide:
I don't understand how CMake works very much, and I am now at a loss as to how to fix this. Other stackoverflow questions about installing OpenCV are all about a different version, a different OS, or non-GPU-supported.
The Question
How can I get CMake to properly install OpenCV with CUDA support such that my Python3 interpreter will run it?
Relevant Information
System: Windows 10 Pro (64 bit)
CUDA Toolkit Version: 9.1
Python Version: 3.6.1 (Anaconda 4.4.0 64 bit)
GPU: NVIDIA GeForce GTX 1080
CMake version: 3.10.2
Visual Studio Version: 14 (VS2015 Win64)
Here's the entire output of CMake:
Selecting Windows SDK version 10.0.15063.0 to target Windows 10.0.16299.
found Intel IPP (ICV version): 2017.0.3 [2017.0.3]
at: C:/opencv_3.0/opencv-3.3.1/build/3rdparty/ippicv/ippicv_win
found Intel IPP IW sources: 2017.0.3
at: C:/opencv_3.0/opencv-3.3.1/build/3rdparty/ippicv/ippiw_win
CUDA detected: 9.1
CUDA NVCC target flags: -gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-D_FORCE_INLINES
Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
A library with BLAS API not found. Please specify library location.
LAPACK requires BLAS
A library with LAPACK API not found. Please specify library location.
Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN)
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
Caffe: NO
Protobuf: NO
Glog: NO
Looking for tiny_dnn.h
Looking for tiny_dnn.h - found
Found tiny-dnn in: C:/opencv_3.0/opencv-3.3.1/build/3rdparty/tinydnn/tiny-dnn-1.0.0a3
The protocol buffer compiler is not found (PROTOBUF_PROTOC_EXECUTABLE='')
freetype2: NO
harfbuzz: NO
No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
Excluding from source files list: C:/opencv_3.0/opencv-3.3.1/build/modules/imgproc/accum.neon.cpp
Torch importer has been enabled. To run the tests you have to install Torch ('th' executable should be available) and generate testdata using opencv_extra/testdata/dnn/generate_torch_models.py script.
Tesseract: NO
DNN_FACE_DETECTOR: Download: res10_300x300_ssd_iter_140000.caffemodel
Pylint: registered 110 targets. Build 'check_pylint' target to run checks ("cmake --build . --target check_pylint" or "make check_pylint")
General configuration for OpenCV 3.3.1 =====================================
Version control: unknown
Extra modules:
Location (extra): C:/opencv_3.0/opencv_contrib-3.3.1/modules
Version control (extra): unknown
Platform:
Timestamp: 2018-02-02T20:23:50Z
Host: Windows 10.0.16299 AMD64
CMake: 3.10.2
CMake generator: Visual Studio 14 2015 Win64
CMake build tool: C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
MSVC: 1900
CPU/HW features:
Baseline: SSE SSE2 SSE3
requested: SSE3
Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2
requested: SSE4_1 SSE4_2 AVX FP16 AVX2
SSE4_1 (3 files): + SSSE3 SSE4_1
SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2
FP16 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
AVX2 (8 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
C/C++:
Built as dynamic libs?: YES
C++11: YES
C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe (ver 19.0.24215.1)
C++ flags (Release): /DWIN32 /D_WINDOWS /W4 /GR /EHa /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP12 /MD /O2 /Ob2 /DNDEBUG /Zi
C++ flags (Debug): /DWIN32 /D_WINDOWS /W4 /GR /EHa /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP12 /MDd /Zi /Ob0 /Od /RTC1
C Compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
C flags (Release): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /MP12 /MD /O2 /Ob2 /DNDEBUG /Zi
C flags (Debug): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /MP12 /MDd /Zi /Ob0 /Od /RTC1
Linker flags (Release): /machine:x64 /INCREMENTAL:NO /debug
Linker flags (Debug): /machine:x64 /debug /INCREMENTAL
ccache: NO
Precompiled headers: YES
Extra dependencies: cudart.lib nppc.lib nppial.lib nppicc.lib nppicom.lib nppidei.lib nppif.lib nppig.lib nppim.lib nppist.lib nppisu.lib nppitc.lib npps.lib cublas.lib cufft.lib -LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.1/lib/x64
3rdparty dependencies:
OpenCV modules:
To be built: cudev core cudaarithm flann imgproc ml objdetect phase_unwrapping plot reg surface_matching video xphoto bgsegm cudabgsegm cudafilters cudaimgproc cudawarping dnn face fuzzy img_hash imgcodecs photo shape videoio xobjdetect cudacodec highgui ts bioinspired dpm features2d line_descriptor text calib3d ccalib cudafeatures2d cudalegacy cudaobjdetect cudaoptflow cudastereo datasets rgbd stereo structured_light superres tracking videostab xfeatures2d ximgproc aruco optflow stitching
Disabled: js world contrib_world saliency
Disabled by dependency: -
Unavailable: java python2 python3 viz cnn_3dobj cvv dnn_modern freetype hdf matlab sfm
Windows RT support: NO
GUI:
QT: NO
Win32 UI: YES
OpenGL support: NO
VTK support: NO
Media I/O:
ZLib: build (ver 1.2.8)
JPEG: build (ver 90)
WEBP: build (ver encoder: 0x020e)
PNG: build (ver 1.6.24)
TIFF: build (ver 42 - 4.0.2)
JPEG 2000: build (ver 1.900.1)
OpenEXR: build (ver 1.7.1)
GDAL: NO
GDCM: NO
Video I/O:
Video for Windows: YES
DC1394 1.x: NO
DC1394 2.x: NO
FFMPEG: YES (prebuilt binaries)
avcodec: YES (ver 57.89.100)
avformat: YES (ver 57.71.100)
avutil: YES (ver 55.58.100)
swscale: YES (ver 4.6.100)
avresample: YES (ver 3.5.0)
GStreamer: NO
OpenNI: NO
OpenNI PrimeSensor Modules: NO
OpenNI2: NO
PvAPI: NO
GigEVisionSDK: NO
DirectShow: YES
Media Foundation: NO
XIMEA: NO
Intel PerC: NO
Intel Media SDK: NO
Parallel framework: Concurrency
Trace: YES (with Intel ITT)
Other third-party libraries:
Use Intel IPP: 2017.0.3 [2017.0.3]
at: C:/opencv_3.0/opencv-3.3.1/build/3rdparty/ippicv/ippicv_win
Use Intel IPP IW: sources (2017.0.3)
at: C:/opencv_3.0/opencv-3.3.1/build/3rdparty/ippicv/ippiw_win
Use Lapack: NO
Use Eigen: NO
Use Cuda: YES (ver 9.1)
Use OpenCL: YES
Use OpenVX: NO
Use custom HAL: NO
NVIDIA CUDA
Use CUFFT: YES
Use CUBLAS: YES
USE NVCUVID: YES
NVIDIA GPU arch: 30 35 37 50 52 60 61 70
NVIDIA PTX archs:
Use fast math: YES
OpenCL: <Dynamic loading of OpenCL library>
Include path: C:/opencv_3.0/opencv-3.3.1/3rdparty/include/opencl/1.2
Use AMDFFT: NO
Use AMDBLAS: NO
Python 2:
Interpreter: NO
Python 3:
Interpreter: C:/Program Files/Anaconda3/python.exe (ver 3.6.1)
Python (for build): C:/Program Files/Anaconda3/python.exe
Pylint: C:/Program Files/Anaconda3/Scripts/pylint.exe (ver: 1.6.4, checks: 110)
Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO
Matlab: Matlab not found or implicitly disabled
Documentation:
Doxygen: NO
Tests and samples:
Tests: YES
Performance tests: YES
C/C++ Examples: YES
Install path: C:/opencv_3.0/opencv-3.3.1/build/install
cvconfig.h is in: C:/opencv_3.0/opencv-3.3.1/build
-----------------------------------------------------------------
Configuring done
Generating done