Ask Your Question

Install and run tesseract OCR in visual studio 2013 and opencv 3

asked 2016-01-15 00:14:49 -0600

Gene gravatar image

updated 2016-01-18 03:18:48 -0600

Hello community,

I hope you're all well. I noticed opencv 3 has a library for the tesseract ocr (Scene Text Recognition) and I was wondering how to call it and use it. I have downloaded and installed tesseract 3.02.02 from the google repository and set the necessary paths to lib includes C/C++: Additional include libraries: C:\Program Files\Tesseract-OCR\include C:\Program Files\Tesseract-OCR\include\tesseract C:\Program Files\Tesseract-OCR\include\leptonica

Linker-> General: Additional Librarires Directories C:\Program Files\Tesseract-OCR\lib

Linker -> Input: libtesseract302.lib libtesseract302d.lib liblept168.lib liblept168d.lib

environment variable: TESSDATA_PREFIX : C:\Program Files\Tesseract-OCR\

I tried running the examples from the link but #include "opencv2/text.hpp", #include , #include are not recognized. Any tips on how to make it work would greatly appreciated.

Thanks !!


Using the advice provided by Steven below, I

  • created a directory in "C:\" called "CVmodules" where I put the zips downloaded from the Itseez link(opencv-master and opencv_contrib-master).

  • In the Cmake GUI selected the opencv source code folder (C:\CVmodules\opencv) and the folder where binaries will be built (C:\CVmodules\contribBuild) then pressed the configure button.

  • browsed the parameters in the interface and look for the form called OPENCV_EXTRA_MODULES_PATH

  • completed this OPENCV_EXTRA_MODULES_PATH by the proper pathname to the /modules value (C:\CVmodules\opencv_contrib\modules), then pressed the configure button

However, the picture below is all I see when research tessearct. There is no way to enable tesseract. I also realized that there seem not to be a tesseract library, in the tesseract that I installed,to point it to. I downloaded it from

What am I doing wrong? Did download the wrong version of the tesseract. This is for visual studio 2013 on windows 8. I already have opencv 3 installed using the prebuilt libraries method. Should uninstall and build it instead?


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-01-15 03:52:26 -0600

You need several things

  1. You first need to download both OpenCV repository and OpenCV contrib repository (which contains the actual OCR module).
  2. Then you need to follow the instructions on the OpenCV contrib page in Github to get it configured correctly.
  3. During CMAKE be sure that the OCR module is enabled.
  4. Point your CMAKE to the correct OCR tesseract installation.
  5. Make sure you link the contrib modules AND that you include the correct namespaces.

Then the software should compile and you program should find the correct functions. Good luck!

edit flag offensive delete link more


Hey Steven, Thanks for your help but if not too troublesome I wasn't sure how to perform step 3 to 5. I am new to building modules. Thanks in advance for your efforts.

Gene gravatar imageGene ( 2016-01-16 04:11:08 -0600 )edit

This installation guide by my hand is a bit more detailed when it comes to cmake :)

StevenPuttemans gravatar imageStevenPuttemans ( 2016-01-16 08:48:10 -0600 )edit

Hey steven, I hope you're well. Your link was very helpful indeed. However, I would like to have your opinion on the tesseract version I downloaded. I have created an issue on your github if you do mind checking it. Thanks!

Gene gravatar imageGene ( 2016-01-18 02:36:21 -0600 )edit

Question Tools



Asked: 2016-01-15 00:14:49 -0600

Seen: 5,746 times

Last updated: Jan 18 '16