3

I'm analysing the ocr-reader sample project: https://github.com/googlesamples/android-vision/tree/master/visionSamples/ocr-reader

The goal would be to replace my custom "text to image" implementation for Android (with OpenCV and Tesseract) with Android Vision.

I could not find any way to apply advanced configuration for the OCR processor. For example, in my application, only a predefined set of symbols is allowed. For that, I'm using the following code in my App:

api.SetVariable("tessedit_char_whitelist", "ABJOKEA1234");

This helps to avoid the confusion between 0 and O for example.

Is there a way to do this with android-vision? I don't see any options while building the TextRecognizer:

TextRecognizer textRecognizer = new TextRecognizer.Builder(context).build();

In a general matter, does Google plan to extend the configurability of the library? For example:

  • Cropping of the source image
  • Providing a custom OCR training file

Or is it supposed to remain a straightforward library, with just common features?

Thanks for your help!

adou600
  • 191
  • 2
  • 5

1 Answers1

0

I am also working on that, i am trying to make a business card reader with mobile vision, so far when the text is detected i am using checks with if conditions using strings which are generated in real time..

  if (mText == null) {
            return;
        }
        if(mText.getValue().contains("@") && mText.getValue().contains(".") && !mText.getValue().equals(mText.getValue().toUpperCase())){
            Log.e("mTextemail",mText.getValue());
            email=mText.getValue();
        }
        if (mText.getValue().startsWith("+")|| mText.getValue().startsWith("0")&& mText.getValue().contains("+-0123456789/-#")&& !mText.getValue().contains("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")){
            Log.e("mTextphone",mText.getValue());
            phone=mText.getValue();
        }
        if (!mText.getValue().contains("ABCDEFGHIJKLMNOPQRSTUVWXYZ")&& !mText.getValue().contains("0123456789-/#") && !mText.getValue().contains("abcdefghijklmnopqrstuvwxyz")){
            Log.e("mTextcompanyName",mText.getValue());
            companyName=mText.getValue();
        }if(mText.getValue().startsWith("ABCDEFGHIJKLMNOPQRSTUVWXYZ" )&& mText.getValue().endsWith("abcdefghijklmnopqrstuvwxyz")){
            name=mText.getValue();
        }
        if(name ==null){
            name="Was not specified";
        }
        if(email ==null){
            email="Was not specified";
        }
        if(phone ==null){
            phone="Was not specified";
        }
        if(companyName ==null){
            companyName="Was not specified";
        }

it prints the logs with 70% accuracy, may be we can help each other and also i want these correct logs to be displayed in an activity i have used interfaces but its not working. If you have any tips or trick that you have discovered please do share.