title: How to make use of OpenCV source codes instead of shared libraries
body: <p>I have a project at hand which I want to use one of the opencv modules (specifically dnn).
  Instead of building the dnn module I want to use the source code of this modules in my project. by doing so, I can change the source code live and see the results at the same time. </p>
  
  <p>I have a very simple scenario with one only source file:</p>
  
  <p>main.cpp</p>
  
  <pre><code>#include "iostream"
  #include &lt;opencv2/dnn.hpp&gt;
  
  int main(int argc, char *argv[])
  {
      std::string ConfigFile = "tsproto.pbtxt";
      std::string ModelFile = "tsmodel.pb";
  
      cv::dnn::Net net = cv::dnn::readNetFromTensorflow(ModelFile,ConfigFile);
  
  
      return 0;
  }
  </code></pre>
  
  <p>now this function "cv::dnn::readNetFromTensorflow" is in dnn module. I tried many different methods to embedded the dnn source codes inside my project but all of them failed !</p>
  
  <p>for example, the first time I tried to include every cpp and hpp file in the module/dnn/ folder of opencv in my project but I ended up in errors like </p>
  
  <pre><code>/home/user/projects/Tensor/tf_importer.cpp:28: error: 'CV__DNN_EXPERIMENTAL_NS_BEGIN' does not name a type
  
  #include "../precomp.hpp" no such file or directory
  
  HAVE_PROTOBUF is undefined 
  
  and ....
  </code></pre>
  
  <p>I tried to solve these errors but some more errors just happened, more undefined MACROs and more undefined hpp files !</p>
  
  <pre><code>#include "../layers_common.simd.hpp" no such file or directory
  and many many more errors !
  </code></pre>
  
  <p>It seems that I'm stuck in a while(true) loop of errors !!! Is it really that hard to use opencv modules source code ?</p>
  
  <p>P.S.
  For those who are asking about why I want to use opencv source code instead of using the shared libraries I have to say that I want to import a customized tensorflow model which opencv read function doesn't support and I want to know where exactly it crashesh so I can fix it. </p>
  
  <p>By the way, I am only using c++11 functions and gcc as compiler in Ubuntu 16.04</p>