Build opencv_contrib with dnn module {#tutorial_dnn_build}
================
====================================
Introduction
Introduction
------------
------------
opencv_dnn module is placed in the secondary [opencv_contrib](https://github.com/Itseez/opencv_contrib) repositroy,
opencv_dnn module is placed in the secondary [opencv_contrib](https://github.com/Itseez/opencv_contrib) repository,
which isn't distributed in binary form, therefore you need to build it manually.
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)
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)
You you can uncheck `BUILD_LIBPROTOBUF_FROM_SOURCES` flag to try use protobuf installed in your system.
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.
Elsewise libpotobuf will be built from opencv sources.
- You can additionaly check `opencv_dnn_BUILD_TORCH_IMPORTER` parameter to build [Torch7](http://torch.ch) importer.
- You can additionally check `opencv_dnn_BUILD_TORCH_IMPORTER` parameter 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.
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:

-# Press *Configure* and *Generate*.

-# Build the generated project:
- If Makefiles generator on Unix was used, run the following in terminal:
- If Makefiles generator on Unix was used, run the following in terminal:
@code
@code
cd opencv_root/build_opencv
cd opencv_root/build_opencv
make all
make all
@endcode
@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
- 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 choosing **Build** -> **Build Solution** menu or using **F7** short-cut.
-# Now you can build own program by using libraries were built into **opencv_root**/build_opencv/lib.
-# 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:
See the following tutorials to learn how to create a program using OpenCV: