Home > other >  Install tesseract openCV Cmake C
Install tesseract openCV Cmake C

Time:10-11

I've been trying to install Tesseract under OpenCV for a very long time now.

Earlier I built OpenCV using CMake-gui and connected Contrib successfully. Now I can use add. libraries. I have cloned tesseract and leptonica repasitories. And I tried to connect it in the same way as Contrib, but nothing came of it .... I also tried to install Tesseract OCR and added it to Path, in the console I can use the Tess OCR functions, but this also did not help me build Opencv Tesseract.

enter image description here

I am writing under QT 5.15. After building OpenCV, I was unable to run the CMake project in QT, so I built a Qmake file using include ("libraries").

CodePudding user response:

After some time, I managed to build using cmake lept and tess, but so far I can't connect opencv with tess, it writes that everything is found - but errors in config Anyone with the same problem. Download Tesseract and Leptonica, then first build leptonica and so LEPTONICA _DIR appears, then build Tesseract using LEPTONICA _DIR. And you need to rebuild OpenCV again, while specifying DIR Tesseracta after building it and specifying LEPTONICA _DIR again.

CMake Warning (dev) at E:/TextParserC  /tess_build/TesseractConfig.cmake:39:
  Syntax Warning in cmake code at column 50

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  E:/OpenCV/opencv_contrib-master/modules/text/cmake/init.cmake:8 (find_package)
  cmake/OpenCVModule.cmake:298 (include)
  cmake/OpenCVModule.cmake:364 (_add_modules_1)
  modules/CMakeLists.txt:7 (ocv_glob_modules)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at E:/TextParserC  /tess_build/TesseractConfig.cmake:39:
  Syntax Warning in cmake code at column 91

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  E:/OpenCV/opencv_contrib-master/modules/text/cmake/init.cmake:8 (find_package)
  cmake/OpenCVModule.cmake:298 (include)
  cmake/OpenCVModule.cmake:364 (_add_modules_1)
  modules/CMakeLists.txt:7 (ocv_glob_modules)
This warning is for project developers.  Use -Wno-dev to suppress it.

Tesseract:   YES (ver 4.1.1)
Can't use Tesseract (details: https://github.com/opencv/opencv_contrib/pull/2220)

Help me with it pls... i`m tired..

UPG

Anyone who has the same problem: You need to edit the TesseractConfig file on line 39 you need to add quotes set (Tesseract_INCLUDE_DIRS "C: / Program Files (x86) / tesseract / include; C: / Program Files (x86) / tesseract / include / tesseract")

CodePudding user response:

Is tesseract build included in opencv, or can you use already installed tesseract ?

I strongly suggest to use the latest tesseract (a.k.a 5.0) (even not released yet) - there is plenty improvement and fixes especially for cmake build. AFAIK API calls are the same as in 4.x, so when you COMPILE opencv against it, it should work.

Tesseract&leptonica cmake builds are easy on windows: just see some available tutorials like: https://bucket401.blogspot.com/2021/03/building-tesserocr-on-ms-windows-64bit.html (untill tesserocr installation part) or https://spell.linux.sk/building-tesseract-and-leptonica-with-cmake-and-clang-on-windows

  • Related