How do I build OpenCV with Tesseract OCR (Text module)

asked 2018-10-03 14:14:22 -0600

DmitryPonv gravatar image

updated 2018-10-03 14:15:34 -0600

I'm trying to build OpenCV with the Tesseract OCR module to use on a raspberry pi.

There is very little information online on how to build this, and what is available is very incomplete.

I'm building using Visual Studio 2017 on windows 10 using the VisualGDB plugin for cross compilation.

I can load the OpenCV CMake project and build it without issues.

I downloaded the OpenCV-contrib modules, and pointed the OPENCV_EXTRA_MODULES_PATH to C:/opencv/opencv_contrib-master/modules

I can see there is a text module that contains some sources for tesseract-ocr.

There are also entries for Tesseract_INCLUDE_DIR and Tesseract_LIBRARY

Does this mean I need to download Tesseract separately? Or can I just use the files that came with OpenCV contrib?

I tried downloading and building Tesseract I cloned https://github.com/tesseract-ocr/tess...

But there is no include folder anywhere. There is an src folder that contains headers and source files, but no include folder anywhere.

Do I need to build tesseract first? And when its built, it creates lib and include files?

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.

I added the lines add_subdirectory(${CMAKE_SOURCE_DIR}/../leptonica) add_subdirectory(${CMAKE_SOURCE_DIR}/../leptonica/build) find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} REQUIRED CONFIG)

But I'm getting errors: add_subdirectory not given a binary directory but the given source C:\opencv\tesseract\CMakeLists.txt Could not find a package configuration file provided by "Leptonica" C:\opencv\tesseract\CMakeLists.txt

Is it possible to add clear instructions on how to build OpenCV with Tesseract???

edit retag flag offensive close merge delete

Comments

If you use cmake you can use https://docs.opencv.org/trunk/db/d4c/...

LBerger gravatar imageLBerger ( 2018-10-07 13:21:47 -0600 )edit