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.
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").
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