Open jagged91 opened 8 years ago
I had exactly the same issue. Is there any way to solve this? It happens right after you take the picture. It tries to scan for a while, then crashes. That's my first time working with an OCR API, and I must say your code helped me a lot to have the basis. If you could tell how to go through this, it would be great. Thanks!
I am having my exams. Will look into this after exams. If you write steps to reproduce it, that would be great.
Thanks for your reply. I repeated all the steps carefully to run the app, and for some reason it works now. One thing I dont now how to deal with is the quality of the recognition and also the time spent, very long sometimes, and not returning a satisfactory result after it. Do you know how I could improve this?
Thanks again.
@gsiqueira Time spent depends on the quality of the image. Large image size means more time needed to process it.
Yes, I tried some things to solve this problem, I reduced the size (640x460 and smaller) of the image taken, tried to binarize it, turn flash on, to improve brightness, but I still get the same result, which takes about one and two minutes to finish the process. The image I used to test has just 10 short lines, is this normal?
I was looking at the code here, and I found the following:
https://cloud.githubusercontent.com/assets/7751486/15730868/c7a96e24-2846-11e6-8c09-5de5607f2443.png
It is strange, because android studio builds the app and it works. I am just showing you this because I don't know if it has something to do with my problem.
Below you find the image I used and the best result I took. Thank you a lot for your attention in my problem.
Source image https://cloud.githubusercontent.com/assets/7751486/15731177/83f3e27e-2849-11e6-8975-08bb5604edf2.jpg
Result https://cloud.githubusercontent.com/assets/7751486/15731159/559518f8-2849-11e6-9368-9f0cfd988663.png
Well the accuracy of OCR is not 100% accurate, at least this is the case for the ones those are open sourced.
Hi, I had received exactly the same error.
i have also issue.facing crash.Any solution priyankvex. Thanks in advance
logcat result:
01-02 00:54:02.801 19607-19607/com.wordpress.priyankvex.easyocrscanner E/WindowManager: Activity com.wordpress.priyankvex.easyocrscannerdemo.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{41f8c370 V.E..... R......D 0,0-304,96} that was originally added here
01-02 00:54:02.801 19607-19607/com.wordpress.priyankvex.easyocrscanner E/WindowManager: android.view.WindowLeaked: Activity com.wordpress.priyankvex.easyocrscannerdemo.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{41f8c370 V.E..... R......D 0,0-304,96} that was originally added here
01-02 00:54:02.801 19607-19607/com.wordpress.priyankvex.easyocrscanner E/WindowManager: at android.view.ViewRootImpl.
From the original post...
couldn't find "libpngt.so"
I ran into this before. In Android studio, right click the module, select "Open Module Settings", click the "Dependencies" tab, remove the "easy_ocr_library", click "OK". Then right click the "easy_ocr_library" in your project, select "Open Module Settings" and remove the "easy_ocr_library" module by using the red "-". Close Android Studio then go to your folder that contains the "easy_ocr_library" and delete the whole "easy_ocr_library" folder and rebuild it from new.
This doesn't solve the core problem but gets you back to where you were I've found.
Facing the same issue. Any solution?
Here is my log:
08-22 15:14:39.674 15432-16033/com.wordpress.priyankvex.easyocrscanner D/OcrScanner: tessdata already present
08-22 15:14:39.721 15432-16033/com.wordpress.priyankvex.easyocrscanner E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.wordpress.priyankvex.easyocrscanner, PID: 15432
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.UnsatisfiedLinkError: com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader[DexPathList[[dex file "/data/data/com.wordpress.priyankvex.easyocrscanner/files/instant-run/dex/slice-support-annotations-22.2.1_d1acf46021f20f049c52e8e8d2eef24d273c7976-classes.dex", dex file "/data/data/com.wordpress.priyankvex.easyocrscanner/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.wordpress.priyankvex.easyocrscanner/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.wordpress.priyankvex.easyocrscanner/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.wordpress.priyankvex.easyocrscanner/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.wordpress.priyankvex.easyocrscanner/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.wordpress.priyankvex.easyocrscanner/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.wordpress.priyankvex.easyocrscanner/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.wordpress.priyankvex.easyocrscanner/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.wordpress.priyankvex.easyocrscanner/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.wordpress.priyankvex.easyocrscanner/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.wordpress.priyankvex.easyocrscanner/files/instant-run/dex/slice-internal_impl-22.2.1_e15adb6504281a2254b4ee3bf34531e1c042464d-classes.dex", dex file "/data/data/com.wordpress.priyankvex.easyocrscanner/files/instant-run/dex/slice-com.android.support-support-v4-22.2.1_f36f4d36fecc7b76b177aa9708feabdb64dd924c-classes.dex", dex file "/data/data/com.wordpress.priyankvex.easyocrscanner/files/instant-run/dex/slice-com.android.support-appcompat-v7-22.2.1_4daf6349f79e575f360e5411107bef913a07530a-classes.dex"],nativeLibraryDirectories=[/data/app/com.wordpress.priyankvex.easyocrscanner-1/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libpngt.so"
at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:1076)
at com.googlecode.tesseract.android.TessBaseAPI.
Hi,
I get the same error, while running in LG G3:
10-31 09:58:20.790 19999-22301/com.wordpress.priyankvex.easyocrscanner E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1 Process: com.wordpress.priyankvex.easyocrscanner, PID: 19999 java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:300) ...
@gsiqueira Do you have any ideas what was the root cause in your case?
Hi all, seems studio removes build directory, i fixed the problem by: git checkout easy_ocr_library/libs/tess-two/build/*
Check that needed files not deleted by git status
.
Changing the dependency of easy_ocr_library module should solve the problem:
com.rmtheis:tess-two:6.1.1
Still not working for me...!! Cannot resolve ImageProcessingThread
Hi,
Building the sample app, I get the following crash when returning the image to the activity:
04-20 16:18:07.068 454-1975/com.wordpress.priyankvex.easyocrscanner E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1 Process: com.wordpress.priyankvex.easyocrscanner, PID: 454 java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:304) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.wordpress.priyankvex.easyocrscanner-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libpngt.so" at java.lang.Runtime.loadLibrary(Runtime.java:366) at java.lang.System.loadLibrary(System.java:988) at com.googlecode.tesseract.android.TessBaseAPI.<clinit>(TessBaseAPI.java:43) at com.wordpress.priyankvex.easyocrscannerdemo.ImageProcessingThread.scanImage(ImageProcessingThread.java:142) at com.wordpress.priyankvex.easyocrscannerdemo.ImageProcessingThread.doInBackground(ImageProcessingThread.java:58) at com.wordpress.priyankvex.easyocrscannerdemo.ImageProcessingThread.doInBackground(ImageProcessingThread.java:26) at android.os.AsyncTask$2.call(AsyncTask.java:292) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818) 04-20 16:18:07.838 454-454/com.wordpress.priyankvex.easyocrscanner E/WindowManager: android.view.WindowLeaked: Activity com.wordpress.priyankvex.easyocrscannerdemo.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{285963da V.E..... R......D 0,0-1368,464} that was originally added here at android.view.ViewRootImpl.<init>(ViewRootImpl.java:527) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:287) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:87) at android.app.Dialog.show(Dialog.java:325) at com.wordpress.priyankvex.easyocrscannerdemo.MainActivity.onOcrScanStarted(MainActivity.java:59) at com.wordpress.priyankvex.easyocrscannerdemo.ImageProcessingThread.onPreExecute(ImageProcessingThread.java:51) at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:591) at android.os.AsyncTask.execute(AsyncTask.java:539) at com.wordpress.priyankvex.easyocrscannerdemo.EasyOcrScanner.onImageTaken(EasyOcrScanner.java:44) at com.wordpress.priyankvex.easyocrscannerdemo.MainActivity.onActivityResult(MainActivity.java:46) at android.app.Activity.dispatchActivityResult(Activity.java:6808) at android.app.ActivityThread.deliverResults(ActivityThread.java:4698) at android.app.ActivityThread.handleSendResult(ActivityThread.java:4745) at android.app.ActivityThread.access$1500(ActivityThread.java:197) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1730) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6872) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)