opencv_contrib README

The project's README from github.com/opencv/opencv_contrib. As one markdown file: README.md.

Repository for OpenCV's extra modules

This repository is intended for the development of so-called "extra" modules, contributed functionality. New modules quite often do not have stable API, and they are not well-tested. Thus, they shouldn't be released as a part of the official OpenCV distribution, since the library maintains binary compatibility, and tries to provide decent performance and stability.

So, all the new modules should be developed separately, and published in the opencv_contrib repository at first. Later, when the module matures and gains popularity, it is moved to the central OpenCV repository, and the development team provides production-quality support for this module.

How to build OpenCV with extra modules

You can build OpenCV, so it will include the modules from this repository. Contrib modules are under constant development and it is recommended to use them alongside the master branch or latest releases of OpenCV.

Here is the CMake command for you:

$ cd <opencv_build_directory>
$ cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules <opencv_source_directory>
$ make -j5

As the result, OpenCV will be built in the <opencv_build_directory> with all modules from opencv_contrib repository. If you don't want all of the modules, use CMake's BUILD_opencv_* options. Like in this example:

$ cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules -DBUILD_opencv_legacy=OFF <opencv_source_directory>

If you also want to build the samples from the "samples" folder of each module, also include the "-DBUILD_EXAMPLES=ON" option.

If you prefer using the GUI version of CMake (cmake-gui), then, you can add opencv_contrib modules within opencv core by doing the following:

  1. Start cmake-gui.

  2. Select the opencv source code folder and the folder where binaries will be built (the 2 upper forms of the interface).

  3. Press the configure button. You will see all the opencv build parameters in the central interface.

  4. Browse the parameters and look for the form called OPENCV_EXTRA_MODULES_PATH (use the search form to focus rapidly on it).

  5. Complete this OPENCV_EXTRA_MODULES_PATH by the proper pathname to the <opencv_contrib>/modules value using its browse button.

  6. Press the configure button followed by the generate button (the first time, you will be asked which makefile style to use).

  7. Build the opencv core with the method you chose (make and make install if you chose Unix makefile at step 6).

  8. To run, linker flags to contrib modules will need to be added to use them in your code/IDE. For example to use the aruco module, "-lopencv_aruco" flag will be added.

Update the repository documentation

In order to keep a clean overview containing all contributed modules, the following files need to be created/adapted:

  1. Update the README.md file under the modules folder. Here, you add your model with a single-line description.

  2. Add a README.md inside your own module folder. This README explains which functionality (separate functions) is available, links to the corresponding samples, and explains in somewhat more detail what the module is expected to do. If any extra requirements are needed to build the module without problems, add them here also.

opencv_contrib (opencv/opencv_contrib)

Searching Database…

这是什么?这是 OpenCV 扩展模块的代码仓库,收录了一些贡献的计算机视觉功能。这些功能还不够稳定或测试不够充分,暂时无法纳入 OpenCV 的核心发行版。
这是独立的库,还是某个项目的附加组件?这是一个附加组件:它包含一组扩展模块(例如 aruco),需要与 OpenCV 主源码树一起编译,不能单独作为库使用。
如何编译带有这些扩展模块的 OpenCV?对 OpenCV 主源码运行 CMake,并通过 OPENCV_EXTRA_MODULES_PATH 选项指向本仓库的 modules 目录,然后像平常一样编译(类 Unix 系统上使用 make 和 make install)。
使用这个仓库还需要 OpenCV 主仓库吗?需要。本仓库只包含扩展模块,必须与 OpenCV 核心源码一起编译(最好使用与 master 分支或最新发布版本相匹配的版本)。
这些模块可以用于生产环境吗?不可以。这里的模块通常缺乏稳定的 API,测试也不够充分,所以在它们成熟之前才被排除在 OpenCV 主发行版之外。
我能只编译部分扩展模块,而不是全部吗?可以。你可以使用 CMake 的 BUILD_opencv_ 选项,单独启用或禁用某个 contrib 模块。
一个模块稳定并且广泛使用之后会怎样?它会被移入 OpenCV 的主仓库,由核心团队为其提供生产级别的支持。
这里包含的模块有哪些典型例子?aruco 模块(用于 ArUco 标记检测)是一个扩展模块的例子,编译时使用 -lopencv_aruco 之类的参数进行链接。
在哪里可以找到某个模块的文档?每个模块的文件夹中都有自己的 README.md,其中说明了该模块的功能、可用函数、示例以及额外的编译要求。
Creator
opencv
Size
151.1 MB
Stars
10.2K
Updated
CommitOct 09
Age
13y
Commits · 90 Days