title: How do I build OpenCV with TesseractOCR?
body: <p>I'm trying to build OpenCV with the Tesseract OCR module to use on a raspberry pi.</p>
  
  <p>There is very little information online on how to build this, and what is available is very incomplete.</p>
  
  <p>I'm building using Visual Studio 2017 on windows 10 using the VisualGDB plugin for cross compilation.</p>
  
  <p>I can load the OpenCV CMake project and build it without issues. </p>
  
  <p>I downloaded the OpenCV-contrib modules, and pointed the <code>OPENCV_EXTRA_MODULES_PATH</code> to <code>C:/opencv/opencv_contrib-master/modules</code></p>
  
  <p>I can see there is a <code>text</code> module that contains some sources for tesseract-ocr.</p>
  
  <p>There are also entries for <code>Tesseract_INCLUDE_DIR</code> and <code>Tesseract_LIBRARY</code></p>
  
  <p>Does this mean I need to download Tesseract separately? Or can I just use the files that came with OpenCV contrib?</p>
  
  <p>I cloned <code>https://github.com/tesseract-ocr/tesseract</code></p>
  
  <p>But there is no include folder anywhere. There is an src folder that contains headers and source files, but no include folder anywhere.</p>
  
  <p>Do I need to build tesseract first? And when its built, it creates lib and include files?</p>
  
  <p>I tried to build tesseract, but it required leptonica.
  I was able to build leptonica. but I cannot manage to include it in Tesseract cmake. </p>
  
  <p>I added the lines </p>
  
  <pre><code>add_subdirectory(${CMAKE_SOURCE_DIR}/../leptonica)
  add_subdirectory(${CMAKE_SOURCE_DIR}/../leptonica/build)
  find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} REQUIRED CONFIG) 
  </code></pre>
  
  <p>But I'm getting errors:</p>
  
  <p><code>add_subdirectory not given a binary directory but the given source     C:\opencv\tesseract\CMakeLists.txt</code></p>
  
  <p><code>Could not find a package configuration file provided by "Leptonica"        C:\opencv\tesseract\CMakeLists.txt  124</code>    </p>
  
  <p>Thanks,</p>