Ask Your Question

opencv-master-4.0.1 cmake with tesseract on windows 10

asked 2019-02-16 04:48:31 -0600

WolfG gravatar image


After unsuccesful attempts to build leptonica+tesseract with codeblocks(mingw 64bit) I used MS Visual Studo 15 2017 Win64 and finally was successful. I created


and copied

F:\leptonica-1.74.4\src\*.h       to F:\tesseract-3.05.01\Files\leptonica\include\.
F:\leptonica-1.74.4\build\src\*.h to F:\tesseract-3.05.01\Files\leptonica\include\.

Now I have the required modules to build openvc with tesseract --- I thought...

Using F:/OpenCV-Source/opencv-master-4.0.1 I started CMAKE. After first Configure I added the following 3 entries

Tesseract_INCLUDE_DIR F:/tesseract-3.05.01/include 
Tesseract_LIBRARY     F:/tesseract-3.05.01/build/Release/tesseract305.lib
Lept_LIBRARY          F:/leptonica-1.74.4/build/src/Release/leptonica-1.74.4.lib

into the CMAKE window and started Configure again. However, I did not see any indication that tesseract is included in my build.

What am I doing wrong? How do I configure CMAKE to have tesseract included?

Basically I followed the answer in by strukmen

Thanks for hints Wolf

edit retag flag offensive close merge delete


it's here :

-DTesseract_INCLUDE_DIR:PATH="${myRepo}"/Install/tesseract/include -DTesseract_LIBRARY="${myRepo}"/Install/tesseract/lib/tesseract400.lib -DLept_LIBRARY="${myRepo}"/Install/leptonica/lib/leptonica-1.74.4.lib \
$CMAKE_OPTIONS -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-DINSTALL_CREATE_DISTRIB=ON -DCMAKE_INSTALL_PREFIX="$myRepo"/install/"$RepoSource"  "$myRepo/$RepoSource"
LBerger gravatar imageLBerger ( 2019-02-16 05:04:45 -0600 )edit

@WolfG i tried to update my previous answer. please see it and ask if something is unclear.

sturkmen gravatar imagesturkmen ( 2019-02-16 11:47:40 -0600 )edit

@WolfG Did you install tesseract ?

LBerger gravatar imageLBerger ( 2019-02-16 11:51:25 -0600 )edit

Thanks guys, your hints helped me to compile the stuff. Wolf

WolfG gravatar imageWolfG ( 2019-02-17 11:34:07 -0600 )edit

1 answer

Sort by » oldest newest most voted

answered 2019-02-16 05:06:47 -0600

berak gravatar image

updated 2019-02-16 05:07:52 -0600

IF you want to use opencv's cv::text::OcrTesseract bindings, like e.g. here , you have to rebuild opencv along with the opencv_contrib modules , see there for build instructions .

the main opencv code alone does not use tesseract at all, and won't pick up anything from there

edit flag offensive delete link more


Thanks a lot! I included the contrib_modules you mentioned, and successfully compiled all with MS Visual Studio. Wolf

WolfG gravatar imageWolfG ( 2019-02-17 11:32:36 -0600 )edit

Question Tools

1 follower


Asked: 2019-02-16 04:48:31 -0600

Seen: 1,040 times

Last updated: Feb 16 '19