2

I want to do that I have thousands of images on my phone and I want to fetch text from an image like below image: for example, i have above image on my phone and I want to fetch text "Sample Source Code" which is written in image. so how can we do that in android I have to try Google Vision API also gives sometimes correct text but sometimes not accurate. so is there any other option for this?

Abhishek Bhardwaj
  • 1,164
  • 3
  • 14
  • 39
  • As far as image processing it will never be that accurate Vision API does decent job in this scenario – Akshay Katariya Nov 03 '17 at 05:40
  • @AkshayKatariya i have try vision api but if your images full with different design and colors and then text also then it will not give proper result it works only when simple images there like thoughts only written in image or some quotes or something else which only textable image . – Shailendrasinh Gohil Nov 03 '17 at 05:45

2 Answers2

1

First you need to create a Demo for

Optical Character Recognition on Android – OCR

to fetch text from images.

Here posted some helpful links:-

1.Android OCR Library

2.https://github.com/abbyysdk/ocrsdk.com

3.http://www.truiton.com/2016/11/optical-character-recognition-android-ocr/

4.https://github.com/renard314/textfairy

5.https://github.com/rmtheis/android-ocr

6.https://github.com/priyankvex/Easy-Ocr-Scanner-Android

Many Examples you get from internet just Google it. hope this helps you.

InsaneCat
  • 2,115
  • 5
  • 21
  • 40
1
try {
    TextRecognizer txtRecognizer = new TextRecognizer.Builder(getApplicationContext()).build();
    if (!txtRecognizer.isOperational()) {
    } else {
        Frame frame = new Frame.Builder().setBitmap(bitmap).build();
        SparseArray items = txtRecognizer.detect(frame);
        StringBuilder strBuilder = new StringBuilder();
        for (int i = 0; i < items.size(); i++) {
            TextBlock item = (TextBlock) items.valueAt(i);
            strBuilder.append(item.getValue());
        }
        Log.d("My Text : ", strBuilder.toString() + " okok");
    }
} catch (Exception e) {
    e.printStackTrace();
}
David Buck
  • 3,752
  • 35
  • 31
  • 35