0

I'm currently working on an android app utilizing the open source OCR library "Tesseract" to make an app for receipt recognition. I've gotten the library working with the "Tess-two" fork of Tesseract. The problem I'm having is that the recognition is very inconsistent. Even when provided with a good image that is cropped properly, the recognition isn't great. I'd say that when given what I would consider ideal situations, the recognition is about 90% accurate. When provided with any number sub-optimal conditions (dim lighting, blurry image, uncropped, etc...) I find that I'll often get virtually 0% accuracy.

For the purpose of my app, even 90% accuracy pretty much unacceptable, as I need to be able to get the exact information and numbers from the receipt "perfectly" without needing to worry about improperly read information.

So my question: what is the best way to configure Tess-two to get the highest accuracy possible?

In a nutshell, this is what I have done to set up the library:

//prior to running this code, I create the directory for /tessdata and copy my eng.traineddata file in there from the app's assets folder.
baseApi.setVariable("save_best_choices", "T");
baseApi = new TessBaseAPI();
baseApi.init(DATA_PATH, "eng");
baseApi.setVariable("tessedit_char_whitelist", "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$.!?/,+=-*\"'<:&"); //I was experimenting with this to try and improve accuracy, it didn't seem to help tremendously.


baseApi.setImage(photo);//photo is a bitmap that is selected from the phone's gallery.
String tmp = baseApi.getUTF8Text();

Is there something here that I'm doing wrong, or that I could be doing better? Are there any files other than eng.traineddata that I should be including? I know there are multiple files for each language, but honestly I couldn't figure what was what, and what actually needed to be included. From what I could gather, I got the only file that was needed. Are there any other settings that I could/should be modifying with the "setVariable" function?

Additionally, does Tess-two have any built in support for "deskewing" images, or adjusting contrast of provided images? I have not messed with either of these techniques much yet, but this would probably help out, right?

Any help is appreciated!

1 Answers1

0

In case your android app should expect on dictionary words, then have a look at the Minimum Edit Distance algorithm and apply it on the results given by tesseract.

Abdul Wasae
  • 3,614
  • 4
  • 34
  • 56