opencv_contrib

OpenCV 额外模块的存储库。(Repository for OpenCV's extra modules)

  • 所有者: opencv/opencv_contrib
  • 平台: Linux, Mac, Windows, Android, BSD, iOS, Maemo
  • 許可證: Apache License 2.0
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

OpenCV 额外模块的存储库

这个存储库用于开发所谓的”额外“模块、贡献的功能。新模块通常没有稳定的 API,而且它们没有经过良好的测试。因此,它们不应该作为官方 OpenCV 发行版的一部分发布,因为该库保持二进制兼容性,并试图提供良好的性能和稳定性。

因此,所有新模块都应单独开发,并首先在 opencv_contrib 存储库中发布。 稍后,当模块成熟并获得普及时,将其移至中央 OpenCV 存储库,并且开发团队为该模块提供生产质量支持。

如何使用额外模块构建 OpenCV

您可以构建 OpenCV,因此它将包含来自这个存储库的模块。Contrib 模块正在不断地开发中,建议将它们与 OpenCV 的主分支或最新版本一起使用。

以下是适合您的 CMake 命令:

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

结果,OpenCV 将与来自 opencv_contrib 存储库的所有模块一起构建在 <opencv_build_directory>。如果你不想要所有的模块, 使用 CMake 的 BUILD_opencv_* 选项。就像在这个例子中一样:

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

如果您更喜欢使用 cmake(cmake-gui)的 gui 版本,那么可以通过执行以下操作在 opencv 内核中添加 opencv_contrib 模块:

  1. 启动 cmake-gui
  2. 选择 opencv 源代码文件夹和二进制文件所在的文件夹(界面的两种上部格式)
  3. 按下 configure 按钮。你会在中心界面看到所有的 opencv 构建参数
  4. 浏览参数并查找名为 OPENCV_EXTRA_MODULES_PATH 的表单(使用搜索表单快速关注它)
  5. 使用其浏览按钮,通过 <opencv_contrib>/modules 值的正确路径名来完成OPENCV_EXTRA_MODULES_PATH。
  6. 按 configure 按钮,然后按 generate 按钮(第一次,您将被问到要使用哪种 makefile 样式)
  7. 使用您选择的方法构建 opencv 内核(如果您在步骤 6 选择了 Unix makfile,则进行 make 和 make install)
  8. 要运行,需要添加链接器标记到 contrib 模块以在您的代码/IDE 中使用它们。例如,要使用 aruco 模块,将添加“-lopencv_aruco”标志。

更新存储库文档

为了保持包含所有贡献模块的清晰概览,需要创建/修改以下文件。

  1. 更新 modules 文件夹下的 README.md 文件。在这里,您可以使用单行描述添加模型。
  2. 在您自己的模块文件夹中添加一个 README.md。本自述文件解释了哪些功能(单独功能)可用,链接到相应的示例,并更详细地解释了模块预期要做的事情。如果需要额外的需求来构建模块,请在这里添加它们。

主要指標

概覽
名稱與所有者opencv/opencv_contrib
主編程語言C++
編程語言CMake (語言數: 15)
平台Linux, Mac, Windows, Android, BSD, iOS, Maemo
許可證Apache License 2.0
所有者活动
創建於2013-09-11 13:28:04
推送於2025-04-22 08:55:04
最后一次提交2025-04-22 11:54:25
發布數55
最新版本名稱4.11.0 (發布於 2025-01-08 19:16:05)
第一版名稱3.0.0-beta (發布於 2014-11-07 19:39:24)
用户参与
星數9.7k
關注者數383
派生數5.8k
提交數4.5k
已啟用問題?
問題數1540
打開的問題數535
拉請求數1856
打開的拉請求數83
關閉的拉請求數425
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?

Repository for OpenCV's extra modules

This repository is intended for 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
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.