khjde1207 / tesseract_ocr

Tesseract OCR for flutter
BSD 3-Clause "New" or "Revised" License
64 stars 31 forks source link

Persist TessBaseAPI over calls for better performance #4

Closed TheLastGimbus closed 3 years ago

TheLastGimbus commented 3 years ago

Hi there! I see that, out of tens of tesseract_ocr forks, this one seems most maintained - thank you!

I don't know what are your plans, but core feature of my app is ocr, so I'm very interested in helping you to maintain this!

Okay, countresy aside - I see that the TessBaseAPI object is re-initiated every call:

https://github.com/khjde1207/tesseract_ocr/blob/934300d2cdf321a2182195c917cb219267f56e10/android/src/main/java/io/paratoner/flutter_tesseract_ocr/FlutterTesseractOcrPlugin.java#L45

Isn't this inafficient? Can we persist it somewhere and expose methods to init/dispose it?

khjde1207 commented 3 years ago

Good idea. It's currently being developed for web support. I'll check it out when the web support development is done.

khjde1207 commented 3 years ago

0.2 seconds faster per page than before I tested it with 10 pages. About 2 seconds faster.

TheLastGimbus commented 3 years ago

This is great! Thanks!!