4

So I finally managed to get the Android Tesseract Tools to compile. Everything works as expected, except I wouldn't mind some sort of progress call back. I looked in the wrapper class and the native wrapping cpp code, but there was nothing that dealt with progress.

Is there an easy way to poll Tesseract for some sort of progress? I peaked at the Tesseract source code, but as a person who nativly speaks Java, it scares me.

Considering how variable Tesseract is in terms of progress time, it seems bad to give the user a spinner and call it a day. If it were me and it took over 30 seconds with no feedback, I'd retry or give up.

sashoalm
  • 75,001
  • 122
  • 434
  • 781
Bob Perry
  • 231
  • 1
  • 5
  • There's a Java interface for this now: https://rmtheis.wordpress.com/2014/12/17/receiving-ocr-progress-updates-when-using-tesseract-on-android/ – rmtheis May 04 '15 at 14:21

1 Answers1

2

First off, since the OCR process can be deemed as a "long running task" in the grand sceme of things, put it into an async task. Things such as I/O, network, or image processing should be put into an async task, as you don't want this running on the main UI thread. If a user has a really low spec phone, it would take some time and eventually cause an application not responding error if you leave it on the main UI thread.

In regards to progress bars, you have a few options. If you have a finite time limit such as 30 seconds then set the progress to work up to that and finish early if the OCR process is quicker than 30 seconds. You can also tap into the underlying native code, but its probably not worth the effort...

Alternatively, and the optimal approach in my opinion, set a circular spinner for the duration of the OCR process, since the images could be different and you don't really have an idea how long it will take.

sashoalm
  • 75,001
  • 122
  • 434
  • 781
Jimmy
  • 16,123
  • 39
  • 133
  • 213