parent
eced23c917
commit
57a21946e6
1 changed files with 60 additions and 0 deletions
@ -0,0 +1,60 @@ |
|||||||
|
Build dnn module {#tutorial_dnn_build} |
||||||
|
================ |
||||||
|
|
||||||
|
Introduction |
||||||
|
------------ |
||||||
|
opencv_dnn module is placed in the secondary [opencv_contrib](https://github.com/Itseez/opencv_contrib) repositroy, |
||||||
|
which isn't distributed in binary form, therefore you need to build it manually. |
||||||
|
|
||||||
|
To do this you need to have installed: [CMake](http://www.cmake.org/download), git, and build system (*gcc* with *make* for Linux or *MS Visual Studio* for Windows) |
||||||
|
|
||||||
|
Steps |
||||||
|
----- |
||||||
|
-# Make any directory, for example **opencv_root** |
||||||
|
|
||||||
|
-# Clone [opencv](https://github.com/Itseez/opencv) and [opencv_contrib](https://github.com/Itseez/opencv_contrib) repos to the **opencv_root**. |
||||||
|
You can do it in terminal like here: |
||||||
|
@code |
||||||
|
cd opencv_root |
||||||
|
git clone https://github.com/Itseez/opencv |
||||||
|
git clone https://github.com/Itseez/opencv_contrib |
||||||
|
@endcode |
||||||
|
|
||||||
|
-# Run [CMake-gui](https://www.johnlamp.net/cmake-tutorial-3-gui-tool.html) and set source and build directories: |
||||||
|
|
||||||
|
- Set source code directory to **opencv_root**/opencv; |
||||||
|
|
||||||
|
- Set binaries directory, for exmaple, to **opencv_root**/build_opencv. |
||||||
|
This directory will contain built libraries. |
||||||
|
|
||||||
|
-# Configure opencv: |
||||||
|
- press *Configure*; |
||||||
|
- choose the preffered project generator (Makefiles for Linux, MS Visual Studio for Windows); |
||||||
|
- also you can set many opencv build options, for more details see @ref tutorial_linux_install. |
||||||
|
|
||||||
|
-# In the appeared list of variables find variable `OPENCV_EXTRA_MODULES_PATH` and set it to the **opencv_root**/opencv_contrib. |
||||||
|
|
||||||
|
-# *Configure* the project again, and set build options of dnn module: |
||||||
|
|
||||||
|
- `BUILD_opencv_dnn` variable must exist and be checked. |
||||||
|
|
||||||
|
- dnn module covers waste part of [Caffe](http://caffe.berkeleyvision.org) framework functionality. |
||||||
|
However, to load Caffe networks libprotobuf is required. |
||||||
|
You you can uncheck `BUILD_LIBPROTOBUF_FROM_SOURCES` flag to try use protobuf installed in your system. |
||||||
|
Elsewise libpotobuf will be built from opencv sources. |
||||||
|
|
||||||
|
- You can additionaly check `opencv_dnn_BUILD_TORCH_IMPORTER` variable to build [Torch7](http://torch.ch) importer. |
||||||
|
It allows you to use networks, generated by Torch7 [nn](https://github.com/torch/nn/blob/master/README.md) module. |
||||||
|
|
||||||
|
-# *Generate* the project and build it: |
||||||
|
- If Makefiles generator on Unix was used, run the following in terminal: |
||||||
|
@code |
||||||
|
cd opencv_root/build_opencv |
||||||
|
make all |
||||||
|
@endcode |
||||||
|
- If MS Visual Studio generator was used, then open OpenCV.sln from **opencv_root**/build_opencv folder in the Visual Studio, and build it by using F7 shortcut |
||||||
|
|
||||||
|
-# Now you can build own program by using libraries were built into **opencv_root**/build_opencv/lib. |
||||||
|
See the following tutorials to learn how to create a program using OpenCV: |
||||||
|
- @ref tutorial_windows_install |
||||||
|
- @ref tutorial_linux_gcc_cmake |
Loading…
Reference in new issue