How to integrate Tesseract OCR Library to a C++ program
The PlatformStatus Page has some comments on how to install it. It has dependencies (leptonica) which also need to be installed.
Another solution also linked from the above discussion has similar details for other linux distributions.
When it comes to linking with your program, this post has some specifics
There is also a C wrapper to the underlying API calls; looking at the files included should tell you what to include. Other wrappers are available here.
The documentation of the base API class are here...
A comment from the Platform Status page for the installation.
Comment by [email protected], Nov 23, 2011 I successfully installed tesseract-ocr on Ubuntu 11.10 64Bit using these commands:
sudo apt-get install libleptonica-dev autoconf automake libtool libpng12-dev libjpeg62- dev libtiff4-dev zlib1g-dev subversion g++
cd
svn checkout http://tesseract-ocr.googlecode.com/svn/trunk/ tesseract-ocr
cd tesseract-ocr
./autogen.sh
./configure
make
sudo make install
sudo ldconfig
cd /usr/local/share/tessdata/
sudo wget http://tesseract-ocr.googlecode.com/files/eng.traineddata.gz
sudo gunzip eng.traineddata.gz
cd ~/tesseract-ocr/
tesseract phototest.tif phototest
cat phototest.txt
Related videos on Youtube
locorecto
Updated on June 04, 2022Comments
-
locorecto about 2 years
I am trying to use Tesseract OCR Library in order to create a program to read pictures of elevator floor numbers. I haven't found any example on how to include the Tesseract Library into a C++ file. Something like:
#include "tesseract.h"
I am using Tesseract v 3.00 on Ubuntu 10.10.
-
hmjd over 12 yearsThat probably won't be enough. I know nothing about Tesseract OCR library but you will require the include directives, plus specify the directory to where the Tesseract header files are installed via a compiler switch (usually
-I
) and (possibly) link with the Tesseract library file(s). -
hmjd over 12 yearsThat would be enough to compile the sources if the header files are installed into common include directories. However, if the header files do not contain the definitions (not just declarations) for all functions/variables then there will be a library file(s) (like
libtesseract.a
or/andlibtesseract.so
) that must be linked in order to compile your binary.
-
-
Pascalius about 12 yearsThank you, that was really helpful
-
Kirk Backus about 10 yearslibjpeg62-dev is now just libjpeg-dev