VS2017 compiled OpenCV 3.4.0-RC under Windows

Source: Internet
Author: User
Tags doxygen

Briefly

Haven't used OpenCV for a long time, this time need to do a bit of image processing related work, and need to use up, here to record the process of compiling. I have previously introduced a post using vs2015 to compile opencv2.4 here.
The compiled file is here https://pan.baidu.com/s/1qXCWxkw

1. Download the source code

Here will not download the source code compression package, directly from GitHub cloning.

# 因为访问github较慢,这里直接使用的国内码云同步仓库git clone https://gitee.com/mirrors/opencv.git# github上的地址为:https://github.com/opencv/opencv.git

After cloning, you can package the 3.4.0-RC branch, or you can switch directly to the 3.4.0-RC branch or use the master code directly.

cd opencvgit archive -o ../opencv3.4.0.zip 3.4.0-rc

Packing out the package is not a Git repository related files, not very large, can be extracted to the directory you want to unzip.

2. Using CMake to generate vs engineering

I do not use the command line, directly used by the cmake-gui configuration.
After selecting the source directory and building the directory, click configure the button and select the compiler as visual studio 2015 2017 win64 , waiting for the configuration to end. (The process of the configuration will be downloaded opencv_ffmpeg.dll and other files, the procedure may be relatively slow)

The build options I use are changed as follows (tools-->my changes)

Commandline options:-DBUILD_JAVA:BOOL="0" -DENABLE_LTO:BOOL="1" -DWITH_GSTREAMER:BOOL="0" -DCPACK_BINARY_ZIP:BOOL="1" -DBUILD_TESTS:BOOL="0" -DENABLE_CXX11:BOOL="1" -DBUILD_PERF_TESTS:BOOL="0" -DCPACK_SOURCE_7Z:BOOL="0" -DCPACK_BINARY_NSIS:BOOL="0" Cache file:BUILD_JAVA:BOOL=0ENABLE_LTO:BOOL=1WITH_GSTREAMER:BOOL=0CPACK_BINARY_ZIP:BOOL=1BUILD_TESTS:BOOL=0ENABLE_CXX11:BOOL=1BUILD_PERF_TESTS:BOOL=0CPACK_SOURCE_7Z:BOOL=0CPACK_BINARY_NSIS:BOOL=0

The configuration output information is as follows

General configuration for OpenCV 3.4.0-rc ===================================== Version control:unknown P    latform:timestamp:2017-12-20t08:35:12z host:windows 10.0.14393 AMD64            cmake:3.7.2 CMake generator:visual Studio Win64 CMake Build Tool:                        C:/Program Files (x86)/microsoft Visual Studio/2017/community/msbuild/15.0/bin/msbuild.exe MSVC: 1912 CPU/HW Features:Baseline:SSE SSE2 SSE3 requested:sse3 DISPATC Hed 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 (1 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 + +: Built as dynamic libs?: YES C++11:yes C + + Compiler:c:/program Files (x86)/microsoft Visual studio/2017/community/vc/tools/msvc/14.12.25827/b In/hostx86/x64/cl.exe (ver 19.12.25831.0) C + + flags (Release):/dwin32/d_windows/w4/gr/eha/d _crt_secur E_NO_DEPRECATE/D _crt_nonstdc_no_deprecate/d _scl_secure_no_warnings/gy/bigobj/gl/oi/wd4251/wd4324/wd4275/w D4512/wd4589/mp4/md/o2/ob2/dndebug/zi C + + flags (Debug):/dwin32/d_windows/w4/gr/eha/d _crt_s ECURE_NO_DEPRECATE/D _crt_nonstdc_no_deprecate/d _scl_secure_no_warnings/gy/bigobj/gl/oi/wd4251/wd4324/wd427  5/WD4512/WD4589/MP4/D_DEBUG/MDD/ZI/OB0/OD/RTC1 C Compiler:c:/program Files (x86)/microsoft Visual Studio/2017/community/vc/tools/msvc/14.12.25827/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/gl/oi/mp4/md/o2/ob2/dn Debug/zi C Flags (Debug):/dwin32/d_windows/w3/d _crt_secure_no_deprecate/d _crt_nonstdc_no_deprecat       E/D _SCL_SECURE_NO_WARNINGS/GY/BIGOBJ/GL/OI/MP4/D_DEBUG/MDD/ZI/OB0/OD/RTC1 Linker Flags (Release):     /machine:x64/ltcg/incremental:no/debug Linker Flags (Debug):/machine:x64/ltcg/debug/incremental  Ccache:no precompiled Headers:yes Extra dependencies:3rdparty dependencies: OpenCV modules:to be built:calib3d core DNN features2d Flann Highgui imgcodecs imgproc ml Objdetect p Hoto python_bindings_generator shape stitching superres ts video Videoio videostab disabled:js worl D Disabled by dependency:-Unavailable:cudaarithm cudabgsegm cudacodec cudafeatures2d cudafil Ters Cudaimgproc CudalegAcy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 python3 viz Applications:apps Documentation:yes (C:/Program files/doxygen/bin/doxygen.exe 1.8.10) non-free algorithms:no W      indows RT support:no gui:win32 ui:yes VTK support:no Media I/o:                        Zlib:build (ver 1.2.11) jpeg:build (ver) WEBP: Build (ver encoder:0x020e) png:build (ver 1.6.34) tiff:b Uild (ver 42-4.0.9) JPEG 2000:build (ver 1.900.1) openexr:build (ver 1.7.1 ) video I/O: Video for Windows:yes Dc1394: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) Directshow:yes Parallel framework:concurrency Trace:yes (                   With Intel ITT) other third-party Libraries:intel ipp:2017.0.3 [2017.0.3] at:              C:/opencv/opencv3.4.0/build/3rdparty/ippicv/ippicv_win Intel IPP iw:sources (2017.0.3)                        At:c:/opencv/opencv3.4.0/build/3rdparty/ippicv/ippiw_win Lapack:no Eigen:                        NO Custom hal:no NVIDIA cuda:no OpenCL: YES (no extra features) Include path:c:/opencv/opencv3.4.0/3rdparty/include/opencl/1.2 Link Li                        Braries:dynamic load Python (for build): C:/Program Files/python36/python.exe Matlab: NO instalL To:c:/opencv/opencv3.4.0/build/install-------------------------------------------------------------- ---configuring done

Click the button to create a VS solution after the configuration is complete Generate .

3. Compiling

You can go directly to CMake's build output directory, double-click OpenCV.sln Open With VS2017, and build.
You can also use the command line to compile

# Release版构建命令如下C:\OpenCV\opencv3.4.0\build>msbuild /p:configuration=Release /maxcpucount:4 OpenCV.sln# Debug版本只需要将上面的Release改为Debug即可# 构建完成后,使用下面命令进行安装(安装输出到build下的install目录,实际上面构建完成就已经安装)C:\OpenCV\opencv3.4.0\build>msbuild /p:configuration=Release /maxcpucount:4  INSTALL

Once the compilation is complete, you can build/install view the relevant header and library files in the directory.

4. Errors encountered and solutions

1. perl --version Error

       “C:\OpenCV\opencv3.4.0\build\OpenCV.sln”(默认目标) (1) ->       “C:\OpenCV\opencv3.4.0\build\doc\doxygen_cpp.vcxproj.metaproj”(默认目标) (50) ->       “C:\OpenCV\opencv3.4.0\build\doc\doxygen_cpp.vcxproj”(默认目标) (52) ->       (CustomBuild 目标) ->         CUSTOMBUILD : error : Problems running bibtex. Verify that the command ‘perl --version‘ works from the command        line. Exit code: 1 [C:\OpenCV\opencv3.4.0\build\doc\doxygen_cpp.vcxproj]    46 个警告    1 个错误

This error is related to this project, so it is not the case that the document generation docgen_cpp.vcxproj option is directly removed doxygen .
Add -DBUILD_DOCS:BOOL="0" or cmake-gui remove the selected tick from the command line arguments BUILD_DOC .
And then Configure re Generate -click. and then recompile.

VS2017 compiled OpenCV 3.4.0-RC under Windows

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.