opencv Cmake command

cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules .. -DWITH_CUDA=1 -DENABLE_FAST_MATH=1 -DCUDA_FAST_MATH=1 -DWITH_CUBLAS=1 -DOPENCV_GENERATE_ PKGCONFIG=1 -opencv_ENABLE_NONFREE=1 -BUILD_opencv_world=ON -DCUDA_GENERATION=Pascal ..

cmake compilation and module introduction, I will continue to add more if I encounter any that are not available later.

CMAKE_BUILD_TYPE: Specify the build type, such as Debug, Release, etc.

CMAKE_INSTALL_PREFIX: Specify the installation directory.

BUILD_SHARED_LIBS: When set to ON, a shared library is built; when set to OFF, a static library is built.

BUILD_WITH_STATIC_CTR: When ON, build the static runtime library (MT/MTd), when set to OFF, build the dynamic runtime library (MD/MDd)

OPENCV_EXTRA_MODULES_PATH: Specifies the path to additional modules used to build OpenCV extension modules.

BUILD_opencv_world: When set to ON, build a single dynamic library (opencv_world) containing all modules.

BUILD_opencv_python: When set to ON, builds the Python bindings.

BUILD_opencv_java: When set to ON, build Java bindings.

BUILD_opencv_apps: When set to ON, builds OpenCV sample applications.

BUILD_opencv_calib3d: When set to ON, build the camera calibration and 3D reconstruction module.

The abbreviation of Calibration plus 3D. This module is mainly related to camera calibration and three-dimensional reconstruction. Basic multi-view geometry algorithms, single stereo camera calibration, object pose estimation, stereo similarity algorithms, 3D information reconstruction, etc. It provides camera calibration, stereo vision and 3D reconstruction functions, including camera parameter estimation, stereo matching, 3D point cloud reconstruction, etc.

BUILD_opencv_core: When set to ON, build the core function module.

OpenCV basic data structure

dynamic data structures

plotting function

Array operation related functions

Accessibility and system functions and macros

Interoperability with OpenGL

BUILD_opencv_dnn: When set to ON, build the deep learning module.

image classification;

Target Detection;

Image segmentation;

text detection and recognition;

attitude estimation;

Depth estimation

Face verification and detection;

Human body re-identification;

BUILD_opencv_features2d: When set to ON, build the feature detection and description module.

Feature detection and description

Feature Detectors common interface

Descriptor Extractors common interface

Descriptor Matchers common interface

Generic Descriptor matcher common interface

Keypoint drawing function and matching function drawing function

BUILD_opencv_flann: When set to ON, build a fast nearest neighbor search module.

BUILD_opencv_gapi: When set to ON, build a general image processing module.

BUILD_opencv_highgui: When set to ON, build the graphical user interface module.

Media I/O input and output

video capture

Image and video encoding and decoding

Graphical interactive interface interfaces and other contents

Keypoint drawing function and matching function drawing function

Keypoint drawing function and matching function drawing function

BUILD_opencv_imgcodecs: When set to ON, build the image codec module.

BUILD_opencv_imgproc: When set to ON, build the image processing module.

BUILD_opencv_ml: When set to ON, builds machine learning modules, basically statistical models and classification algorithms.

Statistical Models

Normal Bayes Classifier

K-NearestNeighbors

Support Vector Machines

Decision Trees

Boosting

Gradient Boosted Trees

Random Trees

Extremely randomized trees

Expectation Maximization

Neural Networks

MLData

BUILD_opencv_objdetect: When set to ON, build the target detection module.

Contains two parts: Cascade Classification (cascade classification) and Latent SVM, including Haar feature classifier, cascade classifier, etc.

BUILD_opencv_photo: When set to ON, build image repair, noise removal and enhancement modules.

BUILD_opencv_stitching: When set to ON, build the image stitching module.

splicing assembly line

Features Find and match images

estimated rotation

automatic calibration

Picture is skewed

Seam estimation

exposure compensation

Picture mix

BUILD_opencv_video: When set to ON, build the video analysis module.

BUILD_opencv_videoio: When set to ON, build the video input/output module.

BUILD_opencv_videostab: When set to ON, build the video stabilization module.

BUILD_ITT: Used to build support for Intel? Trace Collector (ITC).

Intel Trace Collector is a tool for analyzing and optimizing parallel and multi-threaded applications. It helps developers identify and resolve performance issues in parallel programs. By using the BUILD_ITT option, you can choose whether to compile and build OpenCV with integrated support for the Intel Trace Collector, allowing you to use the Intel Trace Collector for performance analysis and optimization when developing and debugging OpenCV applications.

BUILD_IPP_IW: option for inter’s ipp acceleration module

BUILD_opencv_ts: Test module (Test Suite) used to build OpenCV.

The test module is a set of test cases used to verify the correctness and stability of the OpenCV library. These test cases can help developers conduct automated testing when developing and modifying OpenCV code to ensure the correctness of the code and the stability of the functionality. By using the BUILD_opencv_ts option, you can choose whether to compile and build OpenCV's test module.

BUILD_opencv_objc_building_generator: Build file used to generate Objective-C bindings.

Objective-C binding is to facilitate interaction and integration with Objective-C code when using the OpenCV library on iOS and macOS platforms. When setting BUILD_opencv_objc_building_generator to ON, CMake generates the build files required for Objective-C bindings. These build files include Objective-C header and source files, as well as helper tools for generating Objective-C bindings. By enabling this option, developers can use Objective-C language to call functions and classes in the OpenCV library on iOS and macOS platforms to implement image processing and computer vision functions.

WITH_CUDA: When set to ON, CUDA support is enabled.

WITH_TBB: When set to ON, Intel TBB support is enabled.

WITH_OPENCL: When set to ON, OpenCL support is enabled.

OpenCL is an open parallel computing framework that can utilize multiple computing devices (such as CPU, GPU, etc.) for parallel computing to accelerate the execution of image processing and computer vision algorithms. If WITH_OPENCL is set to ON, OpenCL support is enabled; if set to OFF, OpenCL support is not enabled.

OPENCL related options:

OPENCL_FOUNE: Whether to use opencl to find

WITH_OPENCL: Enable OPENCL support

OPENCV_DNN_OPENCL: Deep learning module (DNN) used to control whether OpenCL acceleration is enabled

OpenCV's DNN module provides deep learning inference functions and can load and execute trained deep learning models. OpenCL is a parallel computing framework that can use multiple computing devices (such as CPU, GPU, etc.) to perform parallel computing to accelerate the inference process of deep learning models.

If OPENCV_DNN_OPENCL is set to ON, the OpenCL-accelerated DNN module will be enabled; if set to OFF, the OpenCL-accelerated DNN module will be disabled. Enabling OpenCL acceleration can improve the speed of deep learning model inference, especially when using an OpenCL-capable GPU. However, it should be noted that to enable OpenCL acceleration, you need to ensure that the system supports OpenCL and the corresponding OpenCL driver is installed. If the system does not support OpenCL or the OpenCL driver is not installed, the OpenCL accelerated DNN module cannot be enabled even if OPENCV_DNN_OPENCL is set to ON.

WITH_OPENCLAMDBLAS: Enable OPENCL GPU parallel BLAS linear algebra library support provided by AMD

BLAS (basic linear algebra subroutine) is a routine that provides standard building blocks for performing basic vector and matrix operations. Level 1 BLAS performs scalar, vector, and vector-vector operations, level 2 BLAS performs matrix-vector operations, and level 3 BLAS performs matrix-matrix operations.

AMD_BLAS official: Basic Linear Algebra Subroutine (BLAS) library | Ade (amd.com)

WITH_OPENCLAMDFFT: Enable OPENCL GPU parallel fast Fourier transform support provided by AMD

FFT: Fast Fourier Transform

cFFT official: clFFT: OpenCL Fast Fourier Transform (FFT) (clmathlibraries.github.io)

WITH_OPENCL_D3D11_NV: Enable OPENCL D3D11 GPU parallel computing support provided by NVIDIA

WITH_OPENCL_SVM: OPENCL shared virtual memory support

WITH_OPENGL: When set to ON, OpenGL support is enabled.

WITH_QT: When set to ON, Qt support is enabled.

ENABLE_PRECOMPILED_HEADERS: When set to ON, precompiled header files are enabled.

CV_TRACE: Used to enable or disable tracing of OpenCV function calls.

When the CV_TRACE option is enabled, the OpenCV library will output tracing information of function calls at runtime, including function names, parameters, and return values. This is useful for debugging and performance analysis, helping developers understand the code's execution flow and performance bottlenecks. Tracing functionality can be added to the library when OpenCV is compiled by enabling the CV_TRACE option. At runtime, you can use the corresponding API function to control the opening and closing of tracing, and set the target of the tracing output (such as console, log file, etc.). This way, developers can use the CV_TRACE option to obtain more detailed function call information during debugging and performance optimization as needed.

ENABLE_LTO: used to enable or disable link time optimization (Link Time Optimization, referred to as LTO).

Link-time optimization is a compiler optimization technique that optimizes the entire program during the link phase, rather than just optimizing individual source files. By enabling LTO, the compiler can perform global optimizations on the entire OpenCV library, thereby improving code execution efficiency and performance. If ENABLE_LTO is set to ON, link-time optimization is enabled; if set to OFF, link-time optimization is disabled. Enabling LTO may increase compilation time and memory consumption, but can improve the execution efficiency of the generated OpenCV library. Therefore, depending on specific needs and compilation environment, you can choose whether to enable the ENABLE_LTO option.

ENABLE_IPC: Generate position-independent code (required for shared libraries)

ENABLE_PRECOMPILED_HEADERS: enable precompiled headers

EBABLE_SOLUTION_FOLDERS: Enable solutions in VS or other IDEs

</code><img class="look-more-preCode contentImg-no-view" src="//i2.wp.com/csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreBlack. png" alt="" title="">