如何编译Opencv +ffmpeg linux 明明安装了ffmpeg但是opencv就是找不到

news2025/1/23 22:38:09

想要编译opencv+ffmpeg:
1.安装ffmpeg 随便位置(具体看ffmpeg 编译安装)
执行下面命令,其中/usr/local/ffmpeg/lib/pkgconfig是你实际的ffmpeg路径


export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/ffmpeg/lib/pkgconfig

2.下载opencv,执行下面脚本,但是在cmake之后看一下ffmpeg有没有被探测到

cd OpenCV
mkdir build
cd build
cmake -D OPENCV_GENERATE_PKGCONFIG=YES -DWITH_FFMPEG=ON..
make -j4
make install

当执行完下面命令后发现,fuck,ffmpeg怎么没有被编译进去啊,不是都检测到了吗

cmake -D OPENCV_GENERATE_PKGCONFIG=YES -DWITH_FFMPEG=ON..

在这里插入图片描述

不要着急,这是因为头文件没有被找到,找到你的头文件,然后:

cp -r /your/ffmpeg/include  /usr/local/include

然后再次编译,发现这次可以了,真的可以了呢。
在这里插入图片描述

下面是ffmpeg中的编译markdown,可以看一下
Building OpenCV for Tegra with CUDA {#tutorial_building_tegra_cuda}

@tableofcontents

OpenCV with CUDA for Tegra

This document is a basic guide to building the OpenCV libraries with CUDA support for use in the Tegra environment. It covers the basic elements of building the version 3.1.0 libraries from source code for three (3) different types of platforms:

  • NVIDIA DRIVE™ PX 2 (V4L)
  • NVIDIA® Tegra® Linux Driver Package (L4T)
  • Desktop Linux (Ubuntu 14.04 LTS and 16.04 LTS)

This document is not an exhaustive guide to all of the options available when building OpenCV. Specifically, it covers the basic options used when building each platform but does not cover any options that are not needed (or are unchanged from their default values). Additionally, the installation of the CUDA toolkit is not covered here.

This document is focused on building the 3.1.0 version of OpenCV, but the guidelines here may also work for building from the master branch of the git repository. There are differences in some of the CMake options for builds of the 2.4.13 version of OpenCV, which are summarized below in the @ref tutorial_building_tegra_cuda_opencv_24X section.

Most of the configuration commands are based on the system having CUDA 8.0 installed. In the case of the Jetson TK1, an older CUDA is used because 8.0 is not supported for that platform. These instructions may also work with older versions of CUDA, but are only tested with 8.0.

A Note on Native Compilation vs. Cross-Compilation

The OpenCV build system supports native compilation for all the supported platforms, as well as cross-compilation for platforms such as ARM and others. The native compilation process is simpler, whereas the cross-compilation is generally faster.

At the present time, this document focuses only on native compilation.

Getting the Source Code {#tutorial_building_tegra_cuda_getting_the_code}

There are two (2) ways to get the OpenCV source code:

  • Direct download from the OpenCV downloads page
  • Cloning the git repositories hosted on GitHub

For this guide, the focus is on using the git repositories. This is because the 3.1.0 version of OpenCV will not build with CUDA 8.0 without applying a few small upstream changes from the git repository.

OpenCV

Start with the opencv repository:

# Clone the opencv repository locally:
$ git clone https://github.com/opencv/opencv.git

To build the 3.1.0 version (as opposed to building the most-recent source), you must check out a branch based on the 3.1.0 tag:

$ cd opencv
$ git checkout -b v3.1.0 3.1.0

Note: This operation creates a new local branch in your clone’s repository.

There are some upstream changes that must be applied via the git cherry-pick command. The first of these is to apply a fix for building specifically with the 8.0 version of CUDA that was not part of the 3.1.0 release:

# While still in the opencv directory:
$ git cherry-pick 10896

You will see the following output from the command:

[v3.1.0 d6d69a7] GraphCut deprecated in CUDA 7.5 and removed in 8.0
 Author: Vladislav Vinogradov <vlad.vinogradov@itseez.com>
 1 file changed, 2 insertions(+), 1 deletion(-)

Secondly, there is a fix for a CMake macro call that is problematic on some systems:

$ git cherry pick cdb9c

You should see output similar to:

[v3.1.0-28613 e5ac2e4] gpu samples: fix REMOVE_ITEM error
 Author: Alexander Alekhin <alexander.alekhin@itseez.com>
 1 file changed, 1 insertion(+), 1 deletion(-)

The last upstream fix that is needed deals with the pkg-config configuration file that is bundled with the developer package (libopencv-dev):

$ git cherry-pick 24dbb

You should see output similar to:

[v3.1.0 3a6d7ab] pkg-config: modules list contains only OpenCV modules (fixes #5852)
 Author: Alexander Alekhin <alexander.alekhin@itseez.com>
 1 file changed, 7 insertions(+), 4 deletions(-)

At this point, the opencv repository is ready for building.

OpenCV Extra

The opencv_extra repository contains extra data for the OpenCV library, including the data files used by the tests and demos. It must be cloned separately:

# In the same base directory from which you cloned OpenCV:
$ git clone https://github.com/opencv/opencv_extra.git

As with the OpenCV source, you must use the same method as above to set the source tree to the 3.1.0 version. When you are building from a specific tag, both repositories must be checked out at that tag.

$ cd opencv_extra
$ git checkout -b v3.1.0 3.1.0

You may opt to not fetch this repository if you do not plan on running the tests or installing the test-data along with the samples and example programs. If it is not referenced in the invocation of CMake, it will not be used.

Note: If you plan to run the tests, some tests expect the data to be present and will fail without it.

Preparation and Prerequisites {#tutorial_building_tegra_cuda_preparation}

To build OpenCV, you need a directory to create the configuration and build the libraries. You also need a number of 3rd-party libraries upon which OpenCV depends.

Prerequisites for Ubuntu Linux

These are the basic requirements for building OpenCV for Tegra on Linux:

  • CMake 2.8.10 or newer
  • CUDA toolkit 8.0 (7.0 or 7.5 may also be used)
  • Build tools (make, gcc, g++)
  • Python 2.6 or greater

These are the same regardless of the platform (DRIVE PX 2, Desktop, etc.).

A number of development packages are required for building on Linux:

  • libglew-dev
  • libtiff5-dev
  • zlib1g-dev
  • libjpeg-dev
  • libpng12-dev
  • libjasper-dev
  • libavcodec-dev
  • libavformat-dev
  • libavutil-dev
  • libpostproc-dev
  • libswscale-dev
  • libeigen3-dev
  • libtbb-dev
  • libgtk2.0-dev
  • pkg-config

Some of the packages above are in the universe repository for Ubuntu Linux systems. If you have not already enabled that repository, you need to do the following before trying to install all of the packages listed above:

$ sudo apt-add-repository universe
$ sudo apt-get update

The following command can be pasted into a shell in order to install the required packages:

$ sudo apt-get install \
    libglew-dev \
    libtiff5-dev \
    zlib1g-dev \
    libjpeg-dev \
    libpng12-dev \
    libjasper-dev \
    libavcodec-dev \
    libavformat-dev \
    libavutil-dev \
    libpostproc-dev \
    libswscale-dev \
    libeigen3-dev \
    libtbb-dev \
    libgtk2.0-dev \
    pkg-config

(Line-breaks and continuation characters are added for readability.)

If you want the Python bindings to be built, you will also need the appropriate packages for either or both of Python 2 and Python 3:

  • python-dev / python3-dev
  • python-numpy / python3-numpy
  • python-py / python3-py
  • python-pytest / python3-pytest

The commands that will do this:

$ sudo apt-get install python-dev python-numpy python-py python-pytest
# And, optionally:
$ sudo apt-get install python3-dev python3-numpy python3-py python3-pytest

Once all the necessary packages are installed, you can configure the build.

Preparing the Build Area

Software projects that use the CMake system for configuring their builds expect the actual builds to be done outside of the source tree itself. For configuring and building OpenCV, create a directory called “build” in the same base directory into which you cloned the git repositories:

$ mkdir build
$ cd build

You are now ready to configure and build OpenCV.

Configuring OpenCV for Building {#tutorial_building_tegra_cuda_configuring}

The CMake configuration options given below for the different platforms are targeted towards the functionality needed for Tegra. They are based on the original configuration options used for building OpenCV 2.4.13.

The build of OpenCV is configured with CMake. If run with no parameters, it detects what it needs to know about your system. However, it may have difficulty finding the CUDA files if they are not in a standard location, and it may try to build some options that you might otherwise not want included, so the following invocations of CMake are recommended.

In each cmake command listed in the following sub-sections, line-breaks and indentation are added for readability. Continuation characters are also added in examples for Linux-based platforms, allowing you to copy and paste the examples directly into a shell. When entering these commands by hand, enter the command and options as a single line. For a detailed explanation of the parameters passed to cmake, see the “CMake Parameter Reference” section.

For the Linux-based platforms, the shown value for the CMAKE_INSTALL_PREFIX parameter is /usr. You can set this to whatever you want, based on the layout of your system.

In each of the cmake invocations below, the last parameter, OPENCV_TEST_DATA_PATH, tells the build system where to find the test-data that is provided by the opencv_extra repository. When this is included, a make install installs this test-data alongside the libraries and example code, and a make test automatically provides this path to the tests that have to load data from it. If you did not clone the opencv_extra repository, do not include this parameter.

Vibrante V4L Configuration

Supported platform: Drive PX 2

$ cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_PNG=OFF \
    -DBUILD_TIFF=OFF \
    -DBUILD_TBB=OFF \
    -DBUILD_JPEG=OFF \
    -DBUILD_JASPER=OFF \
    -DBUILD_ZLIB=OFF \
    -DBUILD_EXAMPLES=ON \
    -DBUILD_opencv_java=OFF \
    -DBUILD_opencv_python2=ON \
    -DBUILD_opencv_python3=OFF \
    -DENABLE_NEON=ON \
    -DWITH_OPENCL=OFF \
    -DWITH_OPENMP=OFF \
    -DWITH_FFMPEG=ON \
    -DWITH_GSTREAMER=OFF \
    -DWITH_GSTREAMER_0_10=OFF \
    -DWITH_CUDA=ON \
    -DWITH_GTK=ON \
    -DWITH_VTK=OFF \
    -DWITH_TBB=ON \
    -DWITH_1394=OFF \
    -DWITH_OPENEXR=OFF \
    -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0 \
    -DCUDA_ARCH_BIN=6.2 \
    -DCUDA_ARCH_PTX="" \
    -DINSTALL_C_EXAMPLES=ON \
    -DINSTALL_TESTS=OFF \
    -DOPENCV_TEST_DATA_PATH=../opencv_extra/testdata \
    ../opencv

The configuration provided above builds the Python bindings for Python 2 (but not Python 3) as part of the build process. If you want the Python 3 bindings (or do not want the Python 2 bindings), change the values of BUILD_opencv_python2 and/or BUILD_opencv_python3 as needed. To enable bindings, set the value to ON, to disable them set it to OFF:

-DBUILD_opencv_python2=OFF

Jetson L4T Configuration

Supported platforms:

  • Jetson TK1
  • Jetson TX1

Configuration is slightly different for the Jetson TK1 and the Jetson TX1 systems.

Jetson TK1

$ cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_CXX_FLAGS=-Wa,-mimplicit-it=thumb \
    -DBUILD_PNG=OFF \
    -DBUILD_TIFF=OFF \
    -DBUILD_TBB=OFF \
    -DBUILD_JPEG=OFF \
    -DBUILD_JASPER=OFF \
    -DBUILD_ZLIB=OFF \
    -DBUILD_EXAMPLES=ON \
    -DBUILD_opencv_java=OFF \
    -DBUILD_opencv_python2=ON \
    -DBUILD_opencv_python3=OFF \
    -DENABLE_NEON=ON \
    -DWITH_OPENCL=OFF \
    -DWITH_OPENMP=OFF \
    -DWITH_FFMPEG=ON \
    -DWITH_GSTREAMER=OFF \
    -DWITH_GSTREAMER_0_10=OFF \
    -DWITH_CUDA=ON \
    -DWITH_GTK=ON \
    -DWITH_VTK=OFF \
    -DWITH_TBB=ON \
    -DWITH_1394=OFF \
    -DWITH_OPENEXR=OFF \
    -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-6.5 \
    -DCUDA_ARCH_BIN=3.2 \
    -DCUDA_ARCH_PTX="" \
    -DINSTALL_C_EXAMPLES=ON \
    -DINSTALL_TESTS=OFF \
    -DOPENCV_TEST_DATA_PATH=../opencv_extra/testdata \
    ../opencv

Note: This uses CUDA 6.5, not 8.0.

Jetson TX1

$ cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_PNG=OFF \
    -DBUILD_TIFF=OFF \
    -DBUILD_TBB=OFF \
    -DBUILD_JPEG=OFF \
    -DBUILD_JASPER=OFF \
    -DBUILD_ZLIB=OFF \
    -DBUILD_EXAMPLES=ON \
    -DBUILD_opencv_java=OFF \
    -DBUILD_opencv_python2=ON \
    -DBUILD_opencv_python3=OFF \
    -DENABLE_PRECOMPILED_HEADERS=OFF \
    -DWITH_OPENCL=OFF \
    -DWITH_OPENMP=OFF \
    -DWITH_FFMPEG=ON \
    -DWITH_GSTREAMER=OFF \
    -DWITH_GSTREAMER_0_10=OFF \
    -DWITH_CUDA=ON \
    -DWITH_GTK=ON \
    -DWITH_VTK=OFF \
    -DWITH_TBB=ON \
    -DWITH_1394=OFF \
    -DWITH_OPENEXR=OFF \
    -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0 \
    -DCUDA_ARCH_BIN=5.3 \
    -DCUDA_ARCH_PTX="" \
    -DINSTALL_C_EXAMPLES=ON \
    -DINSTALL_TESTS=OFF \
    -DOPENCV_TEST_DATA_PATH=../opencv_extra/testdata \
    ../opencv

Note: This configuration does not set the ENABLE_NEON parameter.

Ubuntu Desktop Linux Configuration

Supported platforms:

  • Ubuntu Desktop Linux 14.04 LTS
  • Ubuntu Desktop Linux 16.04 LTS

The configuration options given to cmake below are targeted towards the functionality needed for Tegra. For a desktop system, you may wish to adjust some options to enable (or disable) certain features. The features enabled below are based on the building of OpenCV 2.4.13.

$ cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_PNG=OFF \
    -DBUILD_TIFF=OFF \
    -DBUILD_TBB=OFF \
    -DBUILD_JPEG=OFF \
    -DBUILD_JASPER=OFF \
    -DBUILD_ZLIB=OFF \
    -DBUILD_EXAMPLES=ON \
    -DBUILD_opencv_java=OFF \
    -DBUILD_opencv_python2=ON \
    -DBUILD_opencv_python3=OFF \
    -DWITH_OPENCL=OFF \
    -DWITH_OPENMP=OFF \
    -DWITH_FFMPEG=ON \
    -DWITH_GSTREAMER=OFF \
    -DWITH_GSTREAMER_0_10=OFF \
    -DWITH_CUDA=ON \
    -DWITH_GTK=ON \
    -DWITH_VTK=OFF \
    -DWITH_TBB=ON \
    -DWITH_1394=OFF \
    -DWITH_OPENEXR=OFF \
    -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0 \
    -DCUDA_ARCH_BIN='3.0 3.5 5.0 6.0 6.2' \
    -DCUDA_ARCH_PTX="" \
    -DINSTALL_C_EXAMPLES=ON \
    -DINSTALL_TESTS=OFF \
    -DOPENCV_TEST_DATA_PATH=../opencv_extra/testdata \
    ../opencv

This configuration is nearly identical to that for V4L and L4T, except that the CUDA_ARCH_BIN parameter specifies multiple architectures so as to support a variety of GPU boards. For a desktop, you have the option of omitting this parameter, and CMake will instead run a small test program that probes for the supported architectures. However, the libraries produced might not work on Ubuntu systems with different cards.

As with previous examples, the configuration given above builds the Python bindings for Python 2 (but not Python 3) as part of the build process.

Building OpenCV {#tutorial_building_tegra_cuda_building}

Once cmake finishes configuring OpenCV, building is done using the standard make utility.

Building with make

The only parameter that is needed for the invocation of make is the -j parameter for specifying how many parallel threads to use. This varies depending on the system and how much memory is available, other running processes, etc. The following table offers suggested values for this parameter:

PlatformSuggested valueNotes
DRIVE PX 26
Jetson TK13If the build fails due to a compiler-related error, try again with a smaller number of threads. Also consider rebooting the system if it has been running for a long time since the last reboot.
Jetson TX14
Ubuntu Desktop7The actual value will vary with the number of cores you have and the amount of physical memory. Because of the resource requirements of compiling the CUDA code, it is not recommended to go above 7.

Based on the value you select, build (assuming you selected 6):

$ make -j6

By default, CMake hides the details of the build steps. If you need to see more detail about each compilation unit, etc., you can enable verbose output:

$ make -j6 VERBOSE=1

Testing OpenCV {#tutorial_building_tegra_cuda_testing}

Once the build completes successfully, you have the option of running the extensive set of tests that OpenCV provides. If you did not clone the opencv_extra repository and specify the path to testdata in the cmake invocation, then testing is not recommended.

Testing under Linux

To run the basic tests under Linux, execute:

$ make test

This executes ctest to carry out the tests, as specified in CTest syntax within the OpenCV repository. The ctest harness takes many different parameters (too many to list here, see the manual page for CTest to see the full set), and if you wish to pass any of them, you can do so by specifying them in a make command-line parameter called ARGS:

$ make test ARGS="--verbose --parallel 3"

In this example, there are two (2) arguments passed to ctest: --verbose and --parallel 3. The first argument causes the output from ctest to be more detailed, and the second causes ctest to run as many as three (3) tests in parallel. As with choosing a thread count for building, base any choice for testing on the available number of processor cores, physical memory, etc. Some of the tests do attempt to allocate significant amounts of memory.

Known Issues with Tests

At present, not all of the tests in the OpenCV test suite pass. There are tests that fail whether or not CUDA is compiled, and there are tests that are only specific to CUDA that also do not currently pass.

Note: There are no tests that pass without CUDA but fail only when CUDA is included.

As the full lists of failing tests vary based on platform, it is impractical to list them here.

Installing OpenCV {#tutorial_building_tegra_cuda_installing}

Installing OpenCV is very straightforward. For the Linux-based platforms, the command is:

$ make install

Depending on the chosen installation location, you may need root privilege to install.

Building OpenCV 2.4.X {#tutorial_building_tegra_cuda_opencv_24X}

If you wish to build your own version of the 2.4 version of OpenCV, there are only a few adjustments that must be made. At the time of this writing, the latest version on the 2.4 tree is 2.4.13. These instructions may work for later versions of 2.4, though they have not been tested for any earlier versions.

Note: The 2.4.X OpenCV source does not have the extra modules and code for Tegra that was upstreamed into the 3.X versions of OpenCV. This part of the guide is only for cases where you want to build a vanilla version of OpenCV 2.4.

Selecting the 2.4 Source

First you must select the correct source branch or tag. If you want a specific version such as 2.4.13, you want to make a local branch based on the tag, as was done with the 3.1.0 tag above:

# Within the opencv directory:
$ git checkout -b v2.4.13 2.4.13

# Within the opencv_extra directory:
$ git checkout -b v2.4.13 2.4.13

If you simply want the newest code from the 2.4 line of OpenCV, there is a 2.4 branch already in the repository. You can check that out instead of a specific tag:

$ git checkout 2.4

There is no need for the git cherry-pick commands used with 3.1.0 when building the 2.4.13 source.

Configuring

Configuring is done with CMake as before. The primary difference is that OpenCV 2.4 only provides Python bindings for Python 2, and thus does not distinguish between Python 2 and Python 3 in the CMake parameters. There is only one parameter, BUILD_opencv_python. In addition, there is a build-related parameter that controls features in 2.4 that are not in 3.1.0. This parameter is BUILD_opencv_nonfree.

Configuration still takes place in a separate directory that must be a sibling to the opencv and opencv_extra directories.

Configuring Vibrante V4L

For DRIVE PX 2:

$ cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_PNG=OFF \
    -DBUILD_TIFF=OFF \
    -DBUILD_TBB=OFF \
    -DBUILD_JPEG=OFF \
    -DBUILD_JASPER=OFF \
    -DBUILD_ZLIB=OFF \
    -DBUILD_EXAMPLES=ON \
    -DBUILD_opencv_java=OFF \
    -DBUILD_opencv_nonfree=OFF \
    -DBUILD_opencv_python=ON \
    -DENABLE_NEON=ON \
    -DWITH_OPENCL=OFF \
    -DWITH_OPENMP=OFF \
    -DWITH_FFMPEG=ON \
    -DWITH_GSTREAMER=OFF \
    -DWITH_GSTREAMER_0_10=OFF \
    -DWITH_CUDA=ON \
    -DWITH_GTK=ON \
    -DWITH_VTK=OFF \
    -DWITH_TBB=ON \
    -DWITH_1394=OFF \
    -DWITH_OPENEXR=OFF \
    -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0 \
    -DCUDA_ARCH_BIN=6.2 \
    -DCUDA_ARCH_PTX="" \
    -DINSTALL_C_EXAMPLES=ON \
    -DINSTALL_TESTS=ON \
    -DOPENCV_TEST_DATA_PATH=../opencv_extra/testdata \
    ../opencv

Configuring Jetson L4T

For Jetson TK1:

$ cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_PNG=OFF \
    -DBUILD_TIFF=OFF \
    -DBUILD_TBB=OFF \
    -DBUILD_JPEG=OFF \
    -DBUILD_JASPER=OFF \
    -DBUILD_ZLIB=OFF \
    -DBUILD_EXAMPLES=ON \
    -DBUILD_opencv_java=OFF \
    -DBUILD_opencv_nonfree=OFF \
    -DBUILD_opencv_python=ON \
    -DENABLE_NEON=ON \
    -DWITH_OPENCL=OFF \
    -DWITH_OPENMP=OFF \
    -DWITH_FFMPEG=ON \
    -DWITH_GSTREAMER=OFF \
    -DWITH_GSTREAMER_0_10=OFF \
    -DWITH_CUDA=ON \
    -DWITH_GTK=ON \
    -DWITH_VTK=OFF \
    -DWITH_TBB=ON \
    -DWITH_1394=OFF \
    -DWITH_OPENEXR=OFF \
    -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-6.5 \
    -DCUDA_ARCH_BIN=3.2 \
    -DCUDA_ARCH_PTX="" \
    -DINSTALL_C_EXAMPLES=ON \
    -DINSTALL_TESTS=ON \
    -DOPENCV_TEST_DATA_PATH=../opencv_extra/testdata \
    ../opencv

For Jetson TX1:

$ cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_PNG=OFF \
    -DBUILD_TIFF=OFF \
    -DBUILD_TBB=OFF \
    -DBUILD_JPEG=OFF \
    -DBUILD_JASPER=OFF \
    -DBUILD_ZLIB=OFF \
    -DBUILD_EXAMPLES=ON \
    -DBUILD_opencv_java=OFF \
    -DBUILD_opencv_nonfree=OFF \
    -DBUILD_opencv_python=ON \
    -DENABLE_PRECOMPILED_HEADERS=OFF \
    -DWITH_OPENCL=OFF \
    -DWITH_OPENMP=OFF \
    -DWITH_FFMPEG=ON \
    -DWITH_GSTREAMER=OFF \
    -DWITH_GSTREAMER_0_10=OFF \
    -DWITH_CUDA=ON \
    -DWITH_GTK=ON \
    -DWITH_VTK=OFF \
    -DWITH_TBB=ON \
    -DWITH_1394=OFF \
    -DWITH_OPENEXR=OFF \
    -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0 \
    -DCUDA_ARCH_BIN=5.3 \
    -DCUDA_ARCH_PTX="" \
    -DINSTALL_C_EXAMPLES=ON \
    -DINSTALL_TESTS=ON \
    -DOPENCV_TEST_DATA_PATH=../opencv_extra/testdata \
    ../opencv

Configuring Desktop Ubuntu Linux

For both 14.04 LTS and 16.04 LTS:

$ cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_PNG=OFF \
    -DBUILD_TIFF=OFF \
    -DBUILD_TBB=OFF \
    -DBUILD_JPEG=OFF \
    -DBUILD_JASPER=OFF \
    -DBUILD_ZLIB=OFF \
    -DBUILD_EXAMPLES=ON \
    -DBUILD_opencv_java=OFF \
    -DBUILD_opencv_nonfree=OFF \
    -DBUILD_opencv_python=ON \
    -DWITH_OPENCL=OFF \
    -DWITH_OPENMP=OFF \
    -DWITH_FFMPEG=ON \
    -DWITH_GSTREAMER=OFF \
    -DWITH_GSTREAMER_0_10=OFF \
    -DWITH_CUDA=ON \
    -DWITH_GTK=ON \
    -DWITH_VTK=OFF \
    -DWITH_TBB=ON \
    -DWITH_1394=OFF \
    -DWITH_OPENEXR=OFF \
    -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0 \
    -DCUDA_ARCH_BIN='3.0 3.5 5.0 6.0 6.2' \
    -DCUDA_ARCH_PTX="" \
    -DINSTALL_C_EXAMPLES=ON \
    -DINSTALL_TESTS=ON \
    -DOPENCV_TEST_DATA_PATH=../opencv_extra/testdata \
    ../opencv

Building, Testing and Installing

Once configured, the steps of building, testing, and installing are the same as above for the 3.1.0 source.

CMake Parameter Reference {#tutorial_building_tegra_cuda_parameter_reference}

The following is a table of all the parameters passed to CMake in the recommended invocations above. Some of these are parameters from CMake itself, while most are specific to OpenCV.

ParameterOur Default ValueWhat It DoesNotes
BUILD_EXAMPLESONGoverns whether the C/C++ examples are built
BUILD_JASPEROFFGoverns whether the Jasper library (libjasper) is built from source in the 3rdparty directory
BUILD_JPEGOFFAs above, for libjpeg
BUILD_PNGOFFAs above, for libpng
BUILD_TBBOFFAs above, for tbb
BUILD_TIFFOFFAs above, for libtiff
BUILD_ZLIBOFFAs above, for zlib
BUILD_opencv_javaOFFControls the building of the Java bindings for OpenCVBuilding the Java bindings requires OpenCV libraries be built for static linking only
BUILD_opencv_nonfreeOFFControls the building of non-free (non-open-source) elementsUsed only for building 2.4.X
BUILD_opencv_pythonONControls the building of the Python 2 bindings in OpenCV 2.4.XUsed only for building 2.4.X
BUILD_opencv_python2ONControls the building of the Python 2 bindings in OpenCV 3.1.0Not used in 2.4.X
BUILD_opencv_python3OFFControls the building of the Python 3 bindings in OpenCV 3.1.0Not used in 2.4.X
CMAKE_BUILD_TYPEReleaseSelects the type of build (release vs. development)Is generally either Release or Debug
CMAKE_INSTALL_PREFIX/usrSets the root for installation of the libraries and header files
CUDA_ARCH_BINvariesSets the CUDA architecture(s) for which code is compiledUsually only passed for platforms with known specific cards. OpenCV includes a small program that determines the architectures of the system’s installed card if you do not pass this parameter. Here, for Ubuntu desktop, the value is a list to maximize card support.
CUDA_ARCH_PTX“”Builds PTX intermediate code for the specified virtual PTX architectures
CUDA_TOOLKIT_ROOT_DIR/usr/local/cuda-8.0 (for Linux)Specifies the location of the CUDA include files and libraries
ENABLE_NEONONEnables the use of NEON SIMD extensions for ARM chipsOnly passed for builds on ARM platforms
ENABLE_PRECOMPILED_HEADERSOFFEnables/disables support for pre-compiled headersOnly specified on some of the ARM platforms
INSTALL_C_EXAMPLESONEnables the installation of the C example files as part of make install
INSTALL_TESTSONEnables the installation of the tests as part of make install
OPENCV_TEST_DATA_PATH…/opencv_extra/testdataPath to the testdata directory in the opencv_extra repository
WITH_1394OFFSpecifies whether to include IEEE-1394 support
WITH_CUDAONSpecifies whether to include CUDA support
WITH_FFMPEGONSpecifies whether to include FFMPEG support
WITH_GSTREAMEROFFSpecifies whether to include GStreamer 1.0 support
WITH_GSTREAMER_0_10OFFSpecifies whether to include GStreamer 0.10 support
WITH_GTKONSpecifies whether to include GTK 2.0 supportOnly given on Linux platforms, not Microsoft Windows
WITH_OPENCLOFFSpecifies whether to include OpenCL runtime support
WITH_OPENEXROFFSpecifies whether to include ILM support via OpenEXR
WITH_OPENMPOFFSpecifies whether to include OpenMP runtime support
WITH_TBBONSpecifies whether to include Intel TBB support
WITH_VTKOFFSpecifies whether to include VTK support

Copyright © 2016, NVIDIA CORPORATION. All rights reserved.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2263353.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

三维视频融合在数字孪生中的应用

一、在提升监控效率与决策准确性方面的应用 改善监控视角与理解&#xff1a;在数字孪生场景下&#xff0c;三维视频融合技术能够将监控视频与三维环境相结合。例如在城市安防、工业生产、大型活动等场景中&#xff0c;形成连续、实时、动态的三维全景拼接图。这解决了传统监控…

语音识别失败 chrome下获取浏览器录音功能,因为安全性问题,需要在localhost或127.0.0.1或https下才能获取权限

环境&#xff1a; Win10专业版 谷歌浏览器 版本 131.0.6778.140&#xff08;正式版本&#xff09; &#xff08;64 位&#xff09; 问题描述&#xff1a; 局域网web语音识别出现识别失败 chrome控制台出现下获取浏览器录音功能&#xff0c;因为安全性问题&#xff0c;需要在…

计算机网络-传输层 TCP协议(上)

目录 报头结构 TCP的可靠传输机制 核心机制一&#xff1a;确认应答 TCP的序号和确认序号 核心机制二&#xff1a;丢包重传 核心机制三&#xff1a;连接管理 建立连接-三次握手 断开连接-四次挥手 核心机制四&#xff1a;滑动窗口 数据包已经抵达, ACK被丢了 数据包就…

【Cadence射频仿真学习笔记】IC设计中电感的分析、建模与绘制(EMX电磁仿真,RFIC-GPT生成无源器件及与cadence的交互)

一、理论讲解 1. 电感设计的两个角度 电感的设计可以从两个角度考虑&#xff0c;一个是外部特性&#xff0c;一个是内部特性。外部特性就是把电感视为一个黑盒子&#xff0c;带有两个端子&#xff0c;如果带有抽头的电感就有三个端子&#xff0c;需要去考虑其电感值、Q值和自…

AutoSarOS中调度表的概念与源代码解析

--------AutoSarOS调度表的概念 一、AutoSarOS 是什么以及调度表的重要性 AutoSar(Automotive Open System Architecture)是汽车行业的一个开放式软件架构标准哦。它就像是一种大家都遵循的规则,能让不同的软件供应商一起合作开发汽车软件,这样软件就能被重复使用,开发效…

对golang的io型进程进行off-cpu分析

背景&#xff1a; 对于不能占满所有cpu核数的进程&#xff0c;进行on-cpu的分析是没有意义的&#xff0c;因为可能程序大部分时间都处在阻塞状态。 实验例子程序&#xff1a; 以centos8和golang1.23.3为例&#xff0c;测试下面的程序&#xff1a; pprof_netio.go package m…

VS项目,在生成的时候自动修改版本号

demo示例&#xff1a;https://gitee.com/chenheze90/L28_AutoVSversion 可通过下载demo运行即可。 原理&#xff1a;通过csproject项目文件中的Target标签&#xff0c;实现在项目编译之前对项目版本号进行修改&#xff0c;避免手动修改&#xff1b; 1.基础版 效果图如下 部…

springcloud-gateway获取应用响应信息乱码

客户端通过springcloud gateway跳转访问tongweb上的应用&#xff0c;接口响应信息乱码。使用postman直接访问tongweb上的应用&#xff0c;响应信息显示正常。 用户gateway中自定义了实现GlobalFilter的Filter类&#xff0c;在该类中获取了上游应用接口的响应信息&#xff0c;直…

node安装,npm安装,vue-cli安装以及element-ui配置项目

node.js Node.js主要用于开发高性能、高并发的网络服务器&#xff0c;特别适合构建HTTP服务器、实时交互应用&#xff08;如聊天室&#xff09;和RESTful API服务器等。‌它使用JavaScript语言&#xff0c;基于Chrome V8引擎&#xff0c;提供模块化开发和丰富的npm生态系统&…

新能源汽车充电需求攀升,智慧移动充电服务有哪些实际应用场景?

在新能源汽车行业迅猛发展的今天&#xff0c;智慧充电桩作为支持这一变革的关键基础设施&#xff0c;正在多个实际应用场景中发挥着重要作用。从公共停车场到高速公路服务区&#xff0c;从企业园区到住宅小区&#xff0c;智慧充电桩不仅提供了便捷的充电服务&#xff0c;还通过…

MCU驱动使用

一、时钟的配置&#xff1a; AG32 通常使用 HSE 外部晶体&#xff08;范围&#xff1a;4M~16M&#xff09;。 AG32 中不需要手动设置 PLL 时钟&#xff08;时钟树由系统自动配置&#xff0c;无须用户关注&#xff09;。用户只需在配置文件中给出外部晶振频率和系统主频即可。 …

简单的bytebuddy学习笔记

简单的bytebuddy学习笔记 此笔记对应b站bytebuddy学习视频进行整理&#xff0c;此为视频地址&#xff0c;此处为具体的练习代码地址 一、简介 ByteBuddy是基于ASM (ow2.io)实现的字节码操作类库。比起ASM&#xff0c;ByteBuddy的API更加简单易用。开发者无需了解class file …

2025erp系统开源免费进销存系统搭建教程/功能介绍/上线即可运营软件平台源码

系统介绍 基于ThinkPHP与LayUI构建的全方位进销存解决方案 本系统集成了采购、销售、零售、多仓库管理、财务管理等核心功能模块&#xff0c;旨在为企业提供一站式进销存管理体验。借助详尽的报表分析和灵活的设置选项&#xff0c;企业可实现精细化管理&#xff0c;提升运营效…

python 高级用法

1、推导列表 ans [ x for x in range(6)] print(ans)ans [ x for x in range(6) if x > 2] print(ans)ans [ x*y for x in range(6) if x > 2 for y in range(6) if y < 3] print(ans) 2、map 函数 a list(map(list,"abc")) print(a) b list(map(ch…

flask_socketio 以继承 Namespace方式实现一个网页聊天应用

点击进入上一篇&#xff0c;可作为参考 实验环境 python 用的是3.11.11 其他环境可以通过这种方式一键安装&#xff1a; pip install flask3.1.0 Flask-SocketIO5.4.1 gevent-websocket0.10.1 -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple pip list 详情如下&am…

Redis 7.x如何安装与配置?保姆级教程

大家好&#xff0c;我是袁庭新。最新写了一套最新版的Redis 7.x企业级开发教程&#xff0c;今天先给大家介绍下Redis 7.x如何在Linux系统上安装和配置。 1 Redis下载与安装 使用非关系型数据库Redis必须先进行安装配置并开启Redis服务&#xff0c;然后使用对应客户端连接使用…

如何编辑调试gradle,打印日志

在build.gradle.kts中输入 println("testxwg1 ") logger.lifecycle("testxwg2") logger.log(LogLevel.ERROR,"testxwg5") 点刷新就能看到打印日志了

electron-vite【实战系列教程】

创建项目 https://blog.csdn.net/weixin_41192489/article/details/144442262 安装必要的插件 UI 库 element-plus npm install element-plus --save安装 element-plus 图标 npm install element-plus/icons-vue安装插件 – 自动注册组件 vs 自动导入框架方法 npm install -…

【开源项目】数字孪生轨道~经典开源项目数字孪生智慧轨道——开源工程及源码

飞渡科技数字孪生轨道可视化平台&#xff0c;基于国产数字孪生引擎&#xff0c;结合物联网IOT、大数据、激光雷达等技术&#xff0c;对交通轨道进行超远距、高精度、全天侯的监测&#xff0c;集成轨道交通运营数据&#xff0c;快速准确感知目标&#xff0c;筑牢轨交运营生命线。…

Rstudio安装

Rstudio提供了良好的R语言代码编辑环境&#xff0c;R程序调试环境&#xff0c;图形可视化环境以及方便的R工作空间和工作目录管理。 下载网址&#xff1a;https://posit.co/products/open-source/rstudio/ 进入网址&#xff1a; 下滑找到&#xff0c;点击进入 找到Dsektop&am…