Installing Opencv With Cmake
@Iamthegeekdavid,
What does SP mean (CUDA-9.2 without sp)?
CMake will generate a set of Makefiles that can build OpenCV by calling make, and later installed by calling make install as root. As it can take a long time to build all of OpenCV, there is an option to parallelize parts of it by including the -j flag, followed by the number of threads that should be used.
erichfrazer write
I used to have the Cuda 9.1 SDK on it before today, but I removed it (all of it) and installed Cuda 9.2 SDK + the 1st patch.
I dont install it (patch).
My Cmake log:
Selecting Windows SDK version 10.0.17134.0 to target Windows 10.0.14393.
Could NOT find PythonInterp: Found unsuitable version '2.7.15', but required is at least '3.4' (found C:/Lib/Python27/python.exe)
Could NOT find PythonInterp: Found unsuitable version '2.7.15', but required is at least '3.2' (found C:/Lib/Python27/python.exe)
AVX_512F is not supported by C++ compiler
AVX512_SKX is not supported by C++ compiler
Dispatch optimization AVX512_SKX is not available, skipped
libjpeg-turbo: VERSION = 1.5.3, BUILD = opencv-4.0.0-pre-libjpeg-turbo
Looking for Mfapi.h
Looking for Mfapi.h - found
found Intel IPP (ICV version): 2017.0.3 [2017.0.3]
at: C:/Lib/opencv/1111/3rdparty/ippicv/ippicv_win
found Intel IPP IW sources: 2017.0.3
at: C:/Lib/opencv/1111/3rdparty/ippicv/ippiw_win
CUDA detected: 9.2
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
Could NOT find BLAS (missing: BLAS_LIBRARIES)
LAPACK requires BLAS
A library with LAPACK API not found. Please specify library location.
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)
Found VTK 9.0.0 (C:/Lib/VTK/build_x64/lib/cmake/vtk-9.0/UseVTK.cmake)
Caffe: NO
Protobuf: NO
Glog: NO
freetype2: NO
harfbuzz: NO
Module opencv_ovis disabled because OGRE3D was not found
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: /modules/dnn/layers/layers_common.avx512_skx.cpp
Tesseract: NO
General configuration for OpenCV 4.0.0-pre
Version control: 3.4.1-780-g387e92353
Extra modules:
Location (extra): C:/Lib/opencv/source/opencv_contrib/modules
Version control (extra): 3.4.1-113-g2231018c
Platform:
Timestamp: 2018-06-22T07:06:17Z
Host: Windows 10.0.14393 AMD64
CMake: 3.11.4
CMake generator: Visual Studio 15 2017 Win64
CMake build tool: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/MSBuild/15.0/Bin/MSBuild.exe
MSVC: 1914
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 AVX512_SKX
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 (9 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
C/C++:
Built as dynamic libs?: YES
C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe (ver 19.14.26430.0)
C++ flags (Release): /DWIN32 /D_WINDOWS /W4 /GR /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP4 /MD /O2 /Ob2 /DNDEBUG
C++ flags (Debug): /DWIN32 /D_WINDOWS /W4 /GR /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP4 /MDd /Zi /Ob0 /Od /RTC1
C Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/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 /MP4 /MD /O2 /Ob2 /DNDEBUG
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 /MP4 /MDd /Zi /Ob0 /Od /RTC1
Linker flags (Release): /machine:x64 /INCREMENTAL:NO
Linker flags (Debug): /machine:x64 /debug /INCREMENTAL
ccache: NO
Precompiled headers: YES
Extra dependencies: opengl32 glu32 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.2/lib/x64
3rdparty dependencies:
OpenCV modules:
To be built: aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv datasets dnn dnn_objdetect dpm face features2d flann fuzzy hfs highgui img_hash imgcodecs imgproc java_bindings_generator line_descriptor ml objdetect optflow phase_unwrapping photo plot python_bindings_generator reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab viz xfeatures2d ximgproc xobjdetect xphoto
Disabled: js world
Disabled by dependency: -
Unavailable: cnn_3dobj freetype hdf java matlab ovis python2 python3 sfm
Applications: tests perf_tests apps
Documentation: NO
Non-free algorithms: NO
Windows RT support: NO
GUI:
QT: YES (ver 5.11.0)
QT OpenGL support: YES (Qt5::OpenGL 5.11.0)
Win32 UI: YES
OpenGL support: YES (opengl32 glu32)
VTK support: YES (ver 9.0.0)
Media I/O:
ZLib: build (ver 1.2.11)
JPEG: build-libjpeg-turbo (ver 1.5.3-62)
WEBP: build (ver encoder: 0x020e)
PNG: build (ver 1.6.34)
TIFF: build (ver 42 - 4.0.9)
JPEG 2000: build (ver 1.900.1)
OpenEXR: build (ver 1.7.1)
HDR: YES
SUNRASTER: YES
PXM: YES
Video I/O:
Video for Windows: YES
DC1394: NO
FFMPEG: YES (prebuilt binaries)
avcodec: YES (ver 57.107.100)
avformat: YES (ver 57.83.100)
avutil: YES (ver 55.78.100)
swscale: YES (ver 4.8.100)
avresample: YES (ver 3.7.0)
GStreamer: NO
DirectShow: YES
Media Foundation: YES
Parallel framework: Concurrency
Trace: YES (with Intel ITT)
Other third-party libraries:
Intel IPP: 2017.0.3 [2017.0.3]
at: C:/Lib/opencv/1111/3rdparty/ippicv/ippicv_win
Intel IPP IW: sources (2017.0.3)
at: C:/Lib/opencv/1111/3rdparty/ippicv/ippiw_win
Lapack: NO
Eigen: NO
Custom HAL: NO
Protobuf: build (3.5.1)
NVIDIA CUDA: YES (ver 9.2, CUFFT CUBLAS NVCUVID FAST_MATH)
NVIDIA GPU arch: 30 35 37 50 52 60 61 70
NVIDIA PTX archs:
OpenCL: YES (no extra features)
Include path: C:/Lib/opencv/source/opencv/3rdparty/include/opencl/1.2
Link libraries: Dynamic load
Python (for build): C:/Lib/Python27/python.exe
Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO
Matlab: NO
Install to: C:/Lib/opencv/1111/install
Configuring done
I am using OpenCv 3.4.0, Python 3.6.4, Cmake 3.10.2, OpenNI-Windows-x64-2.2, SensorKinect093-Bin-Win32-v5.1.2.1, Visual Studio 2015 and Windows 10. I want to build the cv2.pyd for Python 3.6.4.
I follow the step in many others way such as github and OpenCV install opencv_contrib on Windows
After configure in the Cmake, It shows the output about python 3 like this:
And the Cmake havn't the BUILD_opencv_python3, PYTHON3_INCLUDE_DIR and PYTHON3_LIBRARY, so I append the Bool value of BUILD_opencv_python3 and the locations of PYTHON3_INCLUDE_DIR, PYTHON3_LIBRARY manually. The locations are as followings:
After that, Cmake can't find the Libraries of Python3, albeit it have the correct location of PYTHON3_LIBRARY. The output about Python3 in Cmake like this:
How can I configure the python 3.6.4 with Cmake correctlly? I want to use deep camera so I have to compile the Opencv with OPENNI2.
I am looking for help how can I solve it? Thank you very much.
2 Answers
I give up the python 3, and install the python 2.7.14, OpenCV 3.2.0 instead.
Following the step in OpenCV install opencv_contrib on Windows is easy to install...
It take me too much time to install, I suppose that OpenCV 3.4.0 do not support for Python 3.6.4.
I just found this site which contains instructions:https://www.scivision.co/install-opencv-python-windows/
I was able to use the 'pip install opencv-contrib-python' command to have it auto downloaded and installed. I am using Python 3.7 (but it should also work for the version you listed) and have an anaconda environment activated. If you use anaconda, just make sure you install pip for the environment you are using and activate it before using the pip install command.