Wednesday, June 18, 2014

Trying tesseract-ocr for Optical Character Recognition

Teseract is an OCR tool Developed by HP Labs.It is one of the most powerful and accurate OCR system.And it is Open Source too...so I decided to give a try
Two Options

  1. Directly installing (what's the fun in that?)
  2. Compile from the source code
So I choose second option.Downloaded latest version 3.03 source code from google drive.Compiling have two steps installing teseract engine and appropriate training data of the language.
So first into compiling. Need so many dependencies

sudo apt-get install autotools-dev libleptonica-dev
sudo apt-get install autoconf automake libtool
sudo apt-get install libpng12-dev
sudo apt-get install libjpeg62-dev
sudo apt-get install libtiff4-dev
sudo apt-get install zlib1g-dev
sudo apt-get install libicu-dev # (if you plan to make the training tools)
sudo apt-get install libpango1.0-dev # (if you plan to make the training tools)
sudo apt-get install libcairo2-dev # (if you plan to make the training tools)
view raw gistfile1.sh hosted with ❤ by GitHub


After installing all dependencies extracted the source code into a folder.Now it is compile time..:)

./autogen.sh
./configure
make
sudo make install
sudo ldconfig
view raw gistfile1.sh hosted with ❤ by GitHub

make step may took some time.After compiling we need to add the language data file which is pasted into /usr/local/share/tessdata and don't forget to give proper permissions otherwise tesseract cannot access the language file.
After everything just run

tesseract phototest.tif out
view raw gistfile1.sh hosted with ❤ by GitHub
















wow..the acuracy is unbelievable.!!!




No comments:

Post a Comment