Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make tesseract on iOS faster?

I am struggling with tesseract ocr on ios. Everything works fine but it is really slow. 2 - 3 seconds recogintion time for a single line of digits.

I am reading from a Video Stream.

I am using tesseract 3.01 with a custom training file for my font.

Here is what I do:

Setting up tesseract only to find numbers (0-9)

  1. Shrink, Deskew and Binarize Image
  2. use GetLines to find the line I want the text of
  3. setRectangle to only recognize the line i want
  4. getUTF8Text to get my text <- this alone takes 2-3 seconds

Are there any suggestions to speed up the process?

like image 443
n3utrino Avatar asked Jul 24 '12 12:07

n3utrino


1 Answers

I switched to the SVN of tesseract 3.02

After having some problems with crosscompiling,

I am down to about 1.2 - 0.8 Seconds for getUTF8Text and 0.3 - 0.2 seconds for image preprocessing.

I did some testing

  • Binarization and Shrinking by 0.7 gains 0.3 Seconds but costs you 0.1
  • chop_enable=0 has almost no effect on speed about a speed gain of 0.1 in average althoug it counts for 50% of the cpu usage if profiled

The main gain in usability was to optimize the code with setRectangle not calling getUTF8Text if I suspect the bounds to be incorrect. And some String postprocessing by checking the received string and apply some algorithm to eliminate the most common misinterpretations from tesseract.

maybe this is useful for someone else.

like image 129
n3utrino Avatar answered Oct 03 '22 16:10

n3utrino