- under Windows 7 Home Premium.
- with Qt 5.1.
Tesseract OCR source code
Download tesseract-ocr-3.02.02.tar.gz and extract it.Leptonica library
From the Leptonica web site:Leptonica is a pedagogically-oriented open source site containing software that is broadly useful for image processing and image analysis applications.Leptonica is quite tedious to build because of all its dependencies. Fortunately, someone did this work for us.
Here is the link to his repository: https://github.com/zdenop/tesseract-mingw .
Many thanks to zdenop for saving us time!
Download the following libraries from the bin folder:
- libgif-4.dll
- libjbig-1.dll
- libjpeg-8.dll
- liblept-3.dll : the Leptonica library.
- libpng15-15.dll
- libtiff-3.dll
- libtiffxx-3.dll
- libwebp-2.dll
- zlib1.dll
You must also get the source code. I didn't use the header files in zdenop's repo but you could try. I used the original headers from Leptonica version 1.69.
Extract Leptonica archive, create a bin directory in the new folder then copy all the libraries mentioned above in it.
tesseract-ocr.pro file
In this section, we won't analyze the whole file but only the lines you will have to understand.#_-_-_-_-_-_SOME DIRECTORIES_-_-_-_-_-_ OCR_DIR = D:/prog/ocr LEPTONICA_DIR = $$OCR_DIR/leptonica-1.69 MINGW_LIB_DIR = D:/Programs/Qt/Qt5.1.0/Tools/mingw48_32/i686-w64-mingw32/lib #-_-_-_-_-_-
- OCR_DIR : base directory for my OCR tools.
- LEPTONICA_DIR : Leptonica extraction directory.
- MINGW_LIB_DIR : this one is needed to link against winsock2 library.
DESTDIR = ../tesseract-ocr_release
DEFINES += _tagBLOB_DEFINED DEFINES += USE_STD_NAMESPACE DEFINES += WINDLLNAME=\\\"$$TARGET.dll\\\"
- _tagBLOB_DEFINED : to avoid conflicting declarations between wtypes.h (MinGW) and platform.h (tesseract) if you work with Qt.
- USE_STD_NAMESPACE : I have not searched its exact purpose but it must be declared.
- WINDLLNAME : used by ccutil files.
#_-_-_-_-_-_LINKING_-_-_-_-_-_ win32:LIBS += $$LEPTONICA_DIR/bin/liblept-3.dll win32:LIBS += $$MINGW_LIB_DIR/libws2_32.a #-_-_-_-_-_-
tesseract-ocr.pro can be downloaded from my repository:
https://github.com/broija/tesseract_ocr_qt