OpenCV4.3+VS2017+外部库 win10 64位手动编译x64库

OpenCV4.3+VS2017+外部库 win10 64位手动编译x64库

  • 编译步骤
    • 步骤1: 下载 OpenCV
    • 步骤2: 下载 OpenCV-contrib
    • 步骤3: 下载并安装Visual Studio 2017
    • 步骤4: 安装 CMake
    • 步骤5:CMake加载工程
    • 步骤6:OpenCV编译配置
    • 步骤7:生成VS2017工程
    • 步骤8:编译
    • 步骤9:安装
    • 参考文献:

编译步骤

OpenCV是一个开源的计算机视觉库,它非常流行于执行基本的图像处理任务,如模糊、图像混合、增强图像以及视频质量、阈值设定等。 除了图像处理,它还提供了各种预训练的深度学习模型,可以直接用于解决手边的简单任务。程序员必须使用OpenCV指令下载和加载模型,以便对自己的数据集进行推理。

首先,在将OpenCV库用于自己的数据集之前,需要在系统中安装OpenCV库。在这个阶段,在系统中安装OpenCV有两种途径,即(a)使用pip (b)源安装。pip是一个包管理器,用于安装用python编写的包。下表给出了从源代码安装python包和通过pip安装python包的区别:
注意: 表中的所有点都是针对OpenCV编写的,但它们也可以泛化为其他库和包.(来源,侵删)

pip 安装 源码安装
This will install the features which are already build from source i.e., installation of general features and parameters will be carried out. This will allow you to select your own features and parameters to be installed.
Installation is done at the default location where all the python packages resides. Installation location is provided by the programmer.
In terms of performance, the packages installed might run slower because of the hidden conflicts between features. The programmer can select the optimization flags during the compilation of packages which are responsible for the fast performance of library.
The programmers can neither add nor remove features provided in the installation done by pip. Here, the programmer has all the rights to add or remove the features during the installation of library.
The programmers are not expected to have knowledge about the library. This installation is well suited for beginners and those who want to complete their job at the earliest. The programmers must have strong knowledge about packages present in the library because fast performance can be achieved through the fine selection of features during installation.
The package manager will do the work on behalf of programmer. Package Manager is also responsible for taking care of library updation. The programmers are responsible for feature selection and updation of library. They must be aware of new package updates, latest security patches etc, to keep themselves updated about the library.

在本文中,我们将优先考虑从源代码安装OpenCV,以便开发人员可以根据自己的任务修改安装。
我们将从源代码解释Windows 10的安装。

步骤1: 下载 OpenCV

从OpenCV官网下载最新版本的OpenCV 4.3.0源码。
OpenCV4.3+VS2017+外部库 win10 64位手动编译x64库_第1张图片

步骤2: 下载 OpenCV-contrib

步骤3: 下载并安装Visual Studio 2017

步骤4: 安装 CMake

步骤5:CMake加载工程

步骤6:OpenCV编译配置

步骤7:生成VS2017工程

步骤8:编译

步骤9:安装

参考文献:

[1] https://cv-tricks.com/how-to/installation-of-opencv-4-1-0-in-windows-10-from-source/
[2] https://blog.csdn.net/qq_30965187/article/details/106006656
[3] https://blog.csdn.net/nohopenolove/article/details/107028598


来源:https://cv-tricks.com/how-to/installation-of-opencv-4-1-0-in-windows-10-from-source/
现在是讨论屏幕上的两列的时候了。
Name列是在安装OpenCV期间您希望在系统中安装的标志/特性。
Value列确认选择了要安装在系统中的特性。
我们将讨论一些标志如下:

1- BUILD_CUDA_STUBS: This flag is going to build CUDA stubs if there is no CUDA SDK present in the system.

2- BUILD_DOCS: This flag is used to create build rules for the OpenCV documentation.

3- BUILD_EXAMPLES: This flag is used to build all the examples present in the OpenCV library. You can find those examples under the samples folder of the extracted zip on OpenCV.

4- BUILD_ZLIB: This will build the ZLIB from source. The zlib compression utility is a general purpose utility that is useful for various image formats other than PNG, therefore, it can be used without having libpng.

5- BUILD_TIFF: This flag is going to build libtiff from source. It is a library for reading and writing Tagged Image File Format files. It is similar to other libraries namely *libpng* and *libjpeg* which is used to work with *.tiff* format.

6- BUILD_JASPER: This will build the library libjasper from source. It is a project to create a reference implementation of the encoding and decoding specified in the JPEG-2000 Part-1. In other words, it helps in coding and manipulation of images. This library can handle image data in a variety of formats.

7- BUILD_JPEG: This will build the library libjpeg from source. This is a free library for handling JPEG Image Data format. It has got various utilities such as *cjpeg* and *djpeg* to convert the JPEG data into other image file formats. It also has *rdjpgcom* and *wrjpgcom* which helps to insert and extract textual comments in JPEG files.

8- BUILD_PNG: This will build libpng from source. This library is used to handle PNG format images. It is platform independent and is written in C language. It uses zlib for compression and decompression of PNG files.

9- BUILD_WITH_DEBUG_INFO: This flag option in going to include debug info into the release binaries.

10- BUILD_WITH_STATIC_CRT: This flag enables the use of statically linked C-Run Time libraries for statically linked OpenCV. This flag can be enabled in windows system if Microsoft Visual C++ is used for the compilation.

11- BUILD_ANDROID_SERVICE: This flag allows to build OpenCV manager for Google Play.

12- BUILD_JAVA: This flag will enable the Java Support for OpenCV.

13- BUILD_FAT_JAVA_LIB: This flag will create Java wrapper function i.e. exporting all functions of OpenCV library but it also requires static build of OpenCV modules.

14- INSTALL_C_EXAMPLES, INSTALL_PYTHON_EXAMPLES, INSTALL_ANDROID_EXAMPLES : This flag will enables the installation of the C, Python and Android examples present in the sample folder created during the extraction of the OpenCV zip.

15- INSTALL_TESTS: This will install accuracy and performance test binaries and test data.

16- ENABLE_CCACHE: This flag is known as Compiler Cache flag. This will store the output of the compiler after the compilation of your program. If the file remains unchanged and recompilation is done then the output of compilation will be directly taken from the ccache.

17- ENABLE_PRECOMPILED_HEADERS: This flag is used to enable the use of precompiled headers. Precompiled headers are the header files that are compiled into an intermediate form which are faster to process for the compiler.

18- ENABLE_SOLUTION_FOLDER: This flag enables the use of Solution Folder in Visual Studio IDE. This folder is the container of the projects which you want to do using OpenCV.

19- ENABLE_PROFILING: This flag enables the profiling in the GCC compiler i.e. it add flags **-g, -pg.**Profiling is an aspect of software programming where a programmer can determine the parts in the program code that are time consuming and need to be re-written.

20- OPENCV_GENERATE_PKGCONFIG: This will generate .pc file for pkg-config build tools. pkg-config is a tool used during the compilation of application and libraries. It will help you to provide correct compiler options on the command line i.e. it will find installed libraries which are required for the compilation of software.

21- CV_ENABLE_INTRINSICS: This will enable the compiler to use intrinsic functions which are provided in the programming language to optimize the code. This optimization will be done when the program requests explicit optimization i.e. when the flag is enabled.

22- ENABLE_LTO: This flag will be used to optimize the code during the linking of libraries. The linker will pull all the object files and combine them to optimize the code.

23- ENABLE_THIN_LTO: This flag will be used for optimization of program in incremental and scalable manner. It is similar to regular LTO as clang will emit LLVM bitcode after the compilation. The ThinLTO bitcode is augmented with a compact summary of the module. During the link step, only the summaries are read and merged into a combined summary index, which includes an index of function locations for later cross-module function importing. Fast and efficient whole-program analysis is then performed on the combined summary index.

24- LAPACK_LIBRARIES: LAPACK (Linear Algebra PACKage) is written in Fortran 90 and provides routines for solving systems of simultaneous linear equations, least-squares solutions of linear systems of equations, eigenvalue problems, and singular value problems. The original goal of the LAPACK project was to make the widely used EISPACK and LINPACK libraries run efficiently on shared-memory vector and parallel processors.

25- MKL_ROOT_DIR: Intel® Math Kernel Library (Intel® MKL) optimizes code with minimal effort for future generations of Intel® processors. It is compatible with your choice of compilers, languages, operating systems, and linking and threading models. It uses industry-standard C and Fortran APIs for compatibility with popular BLAS, LAPACK, and FFTW functions for its working.

26- OPENCV_EXTRA_MODULES_PATH: This flag is used to specify the path of the extra modules which will be installed along with the installation of OpenCV. Note that, we have downloaded *opencv_contrib* in step 2 which is nothing but the extra modules in OpenCV. You can set the path on this flag to the *opencv_contrib* downloaded folder.

27- OPENCV_GENERATE_PKGCONFIG: This flag is used to generate the opencv4.pc file. The pkg-config provides command line options for compiling the programs i.e. pkg-config finds the path of installed libraries automatically which are going to be used in your program. OpenCV 4.1.0 doesn’t generate the opencv4.pc file unless this flag is specified.

28- WITH_CUDA: This option allows the CUDA support in the OpenCV. You need to make sure that you have CUDA enabled GPU in your machine in order to use the CUDA library. CUDA is generally used to make the computations faster with the help of GPU.

29- WITH_DIRECTX: This option allows the Microsoft DirectX support for OpenCV. It is a collection of application programming interfaces (APIs) for handling tasks related to multimedia, especially game programming and video on Microsoft platforms.

30- WITH_EIGEN: This flag enables the Eigen library support for OpenCV. It is a high-level C++ library of template headers for linear algebra matrix and vector operations, geometrical transformations, numerical solvers and related algorithms.

31- WITH_GDAL: The Geospatial Data Abstraction Library (GDAL) is a computer software library for reading and writing raster and vector geospatial data formats, and is released under the permissive X/MIT style free software license by the Open Source Geospatial Foundation. As a library, it presents a single abstract data model to the calling application for all supported formats. It may also be built with a variety of useful command line interface utilities for data translation and processing.

32- WITH_GSTREAMER: GStreamer is a library for constructing graphs of media-handling components. The applications it supports range from simple Ogg/Vorbis playback, audio/video streaming to complex audio (mixing) and video (non-linear editing) processing.

33- WITH_HALIDE: Halide is an open-source project that let us write image processing algorithms in well-readable format, schedule computations according to specific device and evaluate it with a quite good efficiency.

34- WITH_HPX: HPX (High Performance ParalleX) is a general purpose C++ runtime system for parallel and distributed applications of any scale. This library strictly adheres to the C++11 Standard and leverages the Boost C++ Libraries which makes HPX easy to use, highly optimized, and very portable. HPX is developed for conventional architectures including Linux-based systems, Windows, Mac, and the BlueGene/Q, as well as accelerators such as the Xeon Phi.

35- WITH_OPENGL: This flag will allow the OpenGL support is OpenCV for building application related to OpenGL. OpenGL is a library which is used to render 3D scenes. These 3D scenes can be later processed using OpenCV library in the form of images and videos.

36- WITH_TBB: The TBB flag makes use of Intel’s Parallel Programming and Heterogeneous Computing library i.e. Thread Building Block library. The library provides a wide range of features for parallel programming, including generic parallel algorithms, concurrent containers, a scalable memory allocator, work-stealing task scheduler, and low-level synchronization primitives. If you want to know more about this library click on this link.

37- WITH_OPENCL: OpenCL (Open Computing Language) is a framework for writing programs that execute across heterogeneous platforms consisting of central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), field-programmable gate arrays (FPGAs) and other processors or hardware accelerators

38- WITH_QT: Qt is a cross-platform application development framework for desktop, embedded and mobile. Qt is not a programming language on its own. It is a framework written in C++. With Qt, GUIs can be written directly in C++ using its Widgets modules. Qt also comes with an interactive graphical tool called *Qt Designer* with functions as a code generator for Widgets based GUIs.

你可能感兴趣的:(Qt,c++,opencv)