Tesseract 3.0 installation on Ubuntu 10.10 server

Tesseract is an optical character recognition (OCR) engine originally developed by Hewlett Packard, in 2005 it was open sourced under Apache license. Its development is now supported by Google. Version 3.0 was released in September 2010 apart from other things this version offers support for Polish language.

Wiki at Tesseract website is a bit messy, that is why I decided to describe my experience with building and installation of Tesseract 3.0. I was working on Ubuntu 10.10 server edition, deployed on virtual machine created using Oracle Virtual Box.

First, I’ve install build-essential and autoconf:

sudo apt-get install build-essential
sudo apt-get install autoconf

Next, step according to Tesseract wiki is to install dependencies:

sudo apt-get install libpng12-dev
sudo apt-get install libjpeg62-dev
sudo apt-get install libtiff4-dev
sudo apt-get install zlib1g-dev

Please note, that the name of zlib1g-dev package is misspelled in the wiki.

I’ve tried to install libleptonica (Leptonica is also required dependency) package from default Ubuntu repositories but Tesseract’s ./configure script does not recognize that it is installed. To cope with that I have downloaded sources of Leptonica 1.6.7 from its Google Code website and than followed rather standard build process:

./configure
make
sudo make install
sudo ldconfig

The next step was downloading tesseract-3.00.tar.gz from Tesseract project website. Uncompress archive, go to tesseract-3.0 directory and invoke:

./runautoconf
./configure

After invoking ./configure you should check config_auto.h is dependencies were recognised by ./configure script. Header file should contain #define for HAVE_LIBLEPT, HAVE_LIBPNG, HAVE_LIBTIFF, HAVE_LIBJPEG and HAVE_ZLIB.

make
sudo make install
sudo ldconfig

Without ldconfig you might experience problems with launching Tesseract.

Download languages of your choice from Tesseract website and place them (uncompress first) in your tessdata folder (by default /usr/local/share/tessdata).
Now run the OCR using:

tesseract phototest.tiff out.txt -l eng 
more out.txt

Hope that this will be helpful.

5 thoughts on “Tesseract 3.0 installation on Ubuntu 10.10 server

  1. Przypuszczam, że przyczyną “niewykrycia” zainstalowanej z pakietów biblioteki był brak pakietu libleptonica-dev, w którym znajdują się pliki nagłówkowe potrzebne do kompilacji. Taka jest logika systemu pakietowego w Ubuntu (i pokrewnych): jeśli do działania binariów potrzebna jest biblioteka xyz, to do kompilacji potrzebujemy xyz-dev.

  2. Dziękuje za zwrócenie uwagi, przyznam szczerze, że nie często zdarza mi się kompilować coś ze źródeł (przynajmniej nie w kontekście rzeczy napisanych w C++). Nie wgłębiałem się w to w jaki sposób Tesseract wykorzystuje Leptonice, myślałem, że wystarczy dostęp do biblioteki łączonej dynamicznie.

  3. Witam!

    Widzę, że niepotrzebnie Pan skomplikowal dość prostą rzecz.

    W tym repozytorium jest dostępna najnowsza paczka na Ubuntu z Tesseractem i min. GScanem .
    https://launchpad.net/~alex-p/+archive/notesalexp/+index?start=75&batch=75

    Dwa odradzam wszystkim kompilowanie i instalowanie na sztywno w takich systemach jak Ubuntu, rozumiem Gentoo czy Slackware ale nie Ubuntu. Jeżeli już lepiej zbudować paczkę .deb i ją zainstalować. Przez ręczna kompilację i instalację potem po jakimś czasie pogubimy się w zależnościach 🙂 . A tak paczuszkę upgradujemy i działa dalej.

    Pozdrawiam

  4. Dzięki za te uwagi 😉

    Myślę, że powinienem zainteresować się jakąś bardziej dynamiczną dystrybucją niż Ubuntu. Debian jest znany z tego, że nie ma tam super świeżego softu.

Leave a Reply

Your email address will not be published. Required fields are marked *

*