Build OpenCV with Extra module, Eigen, Qt, TBB, VTK, XIMEA enabled. The path etc. will differ depending on the version, so please read as appropriate. The environment implemented this time is as follows.
pip install ~ .whl
.Download the source of opencv and opencv_contrib from GitHub. Expand to C: \ opencv
and C: \ opencv \ dev \ opencv_contrib
respectively.
Download the latest stable release of Eigen. Expand to C: \ opencv \ dev \ eigen
.
Install Qt. In the component selection, select and install only Qt> Qt 5.8> msvc2015 64-bit.
Download the Latest release of Intel® TBB. Expand to C: \ opencv \ dev \ tbb \ bin \ intel64 \ vc14
.
Download the source of VTK. Expand to C: \ VTK
. Start CMake with administrator privileges and configure as sourceC: \ VTK
, buildC: \ VTK \ build
. Click Generate → Open Project to open the project in Visual Studio. If you build "ALL_BUILD" and "INSTALL" respectively, VTK will be installed in C: \ Program Files
.
Install XIMEA Windows Software Package.
Pass the path as follows.
Set the path of environment variables |
---|
C:\opencv |
C:\opencv\dev\eigen |
C:\opencv\dev\tbb\bin\intel64\vc14 |
C:\XIMEA\API\x64 |
C:\Qt\5.8\msvc2015_64\bin |
C:\Program Files\VTK |
C:\Program Files\VTK\bin |
Start CMake. Click Configure as sourceC: \ opencv
, buildC: \ opencv \ build
.
Press Configure several times until the following settings are complete to eliminate the red item.
Check the following |
---|
WITH_EIGEN |
WITH_OPENGL |
WITH_QT |
WITH_TBB |
WITH_VTK |
WITH_XIMEA |
Uncheck below |
---|
WITH_CUDA |
WITH_CUFFT |
Name | Value |
---|---|
OPENCV_EXTRA_MODULES_PATH | C:/opencv/dev/opencv_contrib/modules |
EIGEN_INCLDE_PATH | C:/opencv/dev/eigen |
QT_QMAKE_EXECUTSBLE | C:/Qt/5.8/msvc2015_64/bin/qmake.exe |
Qt5Concurrent_DIR | C:/Qt/5.8/msvc2015_64/lib/cmake/Qt5Concurrent |
Qt5Core_DIR | C:/Qt/5.8/msvc2015_64/lib/cmake/Qt5Core |
Qt5Gui_DIR | C:/Qt/5.8/msvc2015_64/lib/cmake/Qt5Gui |
Qt5OpenGL_DIR | C:/Qt/5.8/msvc2015_64/lib/cmake/Qt5OpenGL |
Qt5Test_DIR | C:/Qt/5.8/msvc2015_64/lib/cmake/Qt5Test |
Qt5Widgets_DIR | C:/Qt/5.8/msvc2015_64/lib/cmake/Qt5Widgets |
TBB_ENV_INCLDE | C:/opencv/dev/tbb/include |
TBB_ENV_LIB | C:/opencv/dev/tbb/lib/intel64/vc14/tbb.lib |
TBB_ENV_LIB_DEBUG | C:/opencv/dev/tbb/lib/intel64/vc14/tbb_debug.lib |
TBB_VER_FILE | C:/opencv/dev/tbb/include/tbb/tbb_stddef.h |
If there is no red item, click Generate → Open Project. Open the project in Visual Studio.
When the project is opened in Visual Studio, set the configuration Release
and platform x64
, right-click "ALL_BUILD" → build. If there are no errors, right-click "INSTALL" → build.
"cv2.pyd" and "cv2.cp35-win_amd64.pyd" can be created in C: \ Python27 \ Lib \ site-packages
and C: \ Python35 \ Lib \ site-packages
, respectively.
Pass the path to C: \ opencv
, C: \ opencv \ build \ install \ bin
.
Commenting out the following three lines works fine.
stringutils.cpp
static std::map<QString, QString> replacements3 = { { "EV", "AF" },
//{ "Ü", "A" },
//{ "Ö", "A" },
//{ "Ä", "A" },
{ "O", "G" },
{ "Z", "S" },
{ "M", "N" },
{ "KN", "N" },
{ "K", "C" },
{ "SCH", "SSS" },
{ "PH", "FF" } };
import cv2
print(cv2.getBuildInformation())
General configuration for OpenCV 3.2.0-dev =====================================
Version control: unknown
Extra modules:
Location (extra): C:/opencv/dev/opencv_contrib/modules
Version control (extra): unknown
Platform:
Timestamp: 2017-06-08T23:48:41Z
Host: Windows 10.0.14393 AMD64
CMake: 3.8.1
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 SSSE3
requested: SSSE3
Dispatched code generation: SSE4_1 FP16 AVX AVX2
requested: SSE4_1 AVX FP16 AVX2
SSE4_1 (0 files): + SSE4_1
FP16 (1 files): + SSE4_1 POPCNT SSE4_2 FP16 AVX
AVX (1 files): + SSE4_1 POPCNT SSE4_2 AVX
AVX2 (1 files): + 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 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 /wd4589 /MP8 /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 /wd4589 /MP8 /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 /MP8 /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 /MP8 /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: comctl32 gdi32 ole32 setupapi ws2_32 Qt5::Test Qt5::Concurrent Qt5::OpenGL vfw32 xiapi64 vtkRenderingOpenGL2 vtkCommonCore vtksys vtkCommonDataModel vtkCommonMath vtkCommonMisc vtkCommonSystem vtkCommonTransforms vtkCommonExecutionModel vtkIOImage vtkDICOMParser vtkmetaio vtkzlib vtkjpeg vtkpng vtktiff vtkImagingCore vtkRenderingCore vtkCommonColor vtkCommonComputationalGeometry vtkFiltersCore vtkFiltersGeneral vtkFiltersGeometry vtkFiltersSources vtkglew vtkInteractionStyle vtkFiltersExtraction vtkFiltersStatistics vtkImagingFourier vtkalglib vtkRenderingLOD vtkFiltersModeling vtkIOPLY vtkIOCore vtkFiltersTexture vtkRenderingFreeType vtkfreetype vtkIOExport vtkRenderingGL2PSOpenGL2 vtkgl2ps vtkIOGeometry vtkIOLegacy Qt5::Core Qt5::Gui Qt5::Widgets glu32 opengl32 C:/opencv/dev/tbb/lib/intel64/vc14/tbb.lib
3rdparty dependencies:
OpenCV modules:
To be built: core flann imgproc ml objdetect phase_unwrapping photo plot reg surface_matching video viz xphoto bgsegm dnn face fuzzy imgcodecs shape videoio xobjdetect highgui superres ts bioinspired dpm features2d line_descriptor saliency text calib3d ccalib cvv datasets rgbd stereo structured_light tracking videostab xfeatures2d ximgproc aruco optflow stitching python2 python3
Disabled: world contrib_world
Disabled by dependency: -
Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java cnn_3dobj dnn_modern freetype hdf matlab sfm
Windows RT support: NO
GUI:
QT 5.x: YES (ver 5.8.0)
QT OpenGL support: YES (Qt5::OpenGL 5.8.0)
OpenGL support: YES (glu32 opengl32)
VTK support: YES (ver 7.1.1)
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 )
avformat: YES (ver )
avutil: YES (ver )
swscale: YES (ver )
avresample: YES (ver )
GStreamer: NO
OpenNI: NO
OpenNI PrimeSensor Modules: NO
OpenNI2: NO
PvAPI: NO
GigEVisionSDK: NO
DirectShow: YES
Media Foundation: NO
XIMEA: YES
Intel PerC: NO
Parallel framework: TBB (ver 2017.0 interface 9107)
Other third-party libraries:
Use Intel IPP: 2017.0.2 [2017.0.2]
at: C:/opencv/build/3rdparty/ippicv/ippicv_win
Use Intel IPP IW: prebuilt binaries (2017.0.2)
Use Intel IPP Async: NO
Use Lapack: NO
Use Eigen: YES (ver 3.3.3)
Use Cuda: NO
Use OpenCL: YES
Use OpenVX: NO
Use custom HAL: NO
OpenCL: <Dynamic loading of OpenCL library>
Include path: C:/opencv/3rdparty/include/opencl/1.2
Use AMDFFT: NO
Use AMDBLAS: NO
Python 2:
Interpreter: C:/Python27/python.exe (ver 2.7.13)
Libraries: C:/Python27/libs/python27.lib (ver 2.7.13)
numpy: C:/Python27/lib/site-packages/numpy/core/include (ver 1.12.1)
packages path: C:/Python27/Lib/site-packages
Python 3:
Interpreter: C:/Python35/python.exe (ver 3.5.3)
Libraries: C:/Python35/libs/python35.lib (ver 3.5.3)
numpy: C:/Python35/lib/site-packages/numpy/core/include (ver 1.12.1)
packages path: C:/Python35/Lib/site-packages
Python (for build): C:/Python27/python.exe
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: NO
Install path: C:/opencv/build/install
cvconfig.h is in: C:/opencv/build
-----------------------------------------------------------------
import cv2
import numpy as np
im = cv2.imread("cat.png ")
cv2.imshow("cat",im)
cv2.waitKey(0)
cv2.destroyAllWindows()
Recommended Posts