2

I was doing a variation of Simple Android OCR in Android Studio with the help of Tesseract OCR. After camera is used, the application was stopped and given the following Errors..

How can it be solved?

E/Zygote﹕ Zygote:  error closing descriptor
libcore.io.ErrnoException: close failed: EBADF (Bad file number)
        at libcore.io.Posix.close(Native Method)
        at libcore.io.BlockGuardOs.close(BlockGuardOs.java:75)
        at com.android.internal.os.ZygoteInit.closeServerSocket(ZygoteInit.java:224)
        at com.android.internal.os.ZygoteConnection.handleChildProc(ZygoteConnection.java:879)
        at com.android.internal.os.ZygoteConnection.runOnce(ZygoteConnection.java:242)
        at com.android.internal.os.ZygoteInit.runSelectLoop(ZygoteInit.java:704)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
        at dalvik.system.NativeStart.main(Native Method)

Also these
06-04 22:06:07.857    3183-3183/com.startup.vrvijay.liccamera E/﹕ appName=com.startup.vrvijay.liccamera, acAppName=/system/bin/surfaceflinger

06-04 22:06:07.857 3183-3183/com.startup.vrvijay.liccamera E/﹕ 0 06-04 22:06:07.857 3183-3183/com.startup.vrvijay.liccamera E/﹕ appName=com.startup.vrvijay.liccamera, acAppName=/system/bin/surfaceflinger 06-04 22:06:07.857 3183-3183/com.startup.vrvijay.liccamera E/﹕ 0

vijayvr
  • 61
  • 8

1 Answers1

2

You need to download the training data and put it into the correct directory (based on what you're passing to TessBaseApi.init()).

You can download it from here: https://code.google.com/p/tesseract-ocr/downloads/list

Tushar
  • 8,019
  • 31
  • 38
  • Thank you. Can I paste the 'tessdata' in the 'libs' directory?? – vijayvr Jun 04 '15 at 10:20
  • 1
    Normally you should put such files in `assets` or `raw` directory. `libs` folder is for libraries. – Abhishek V Jun 04 '15 at 10:21
  • @VRVijay see http://stackoverflow.com/questions/9563373/the-reason-for-assets-and-raw-resources-in-android for the difference between `assets` and `raw`. – Tushar Jun 04 '15 at 10:29
  • Hi. I placed the files in correct directory (src/main/assets) . But Still same errors. What to do?? – vijayvr Jun 04 '15 at 10:38
  • @VRVijay can you post your TessBaseApi.init() code? – Tushar Jun 04 '15 at 10:45
  • `TessBaseAPI baseApi = new TessBaseAPI(); baseApi.setDebug(true); baseApi.init(DATA_PATH, lang); baseApi.setImage(bitmap); String recognizedText = baseApi.getUTF8Text(); baseApi.end();` – vijayvr Jun 04 '15 at 10:56
  • `public static final String DATA_PATH = Environment .getExternalStorageDirectory().toString() + "/SimpleAndroidOCR/";` – vijayvr Jun 04 '15 at 10:58
  • @VRVijay check http://stackoverflow.com/questions/22906068/how-to-get-file-path-of-asset-folder-in-android – Tushar Jun 04 '15 at 12:08
  • @Tushar Tessdata problem solved.. but the other errors remaining! – vijayvr Jun 04 '15 at 13:05
  • Should I delete this question and re-post another one with the other errors? – vijayvr Jun 04 '15 at 13:44
  • 1
    Leave this question open and post a new question as well. – Tushar Jun 04 '15 at 13:45