Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with tesseract #100

Open
paktalin opened this issue Mar 3, 2018 · 14 comments
Open

Doesn't work with tesseract #100

paktalin opened this issue Mar 3, 2018 · 14 comments

Comments

@paktalin
Copy link

paktalin commented Mar 3, 2018

Hi! First of all, big thanks for the application, for publishing the source code and for helping us with issues. I don't know what would I do without you.

But I've got an issue. Here it is:

When I add a tesseract dependency
compile 'com.rmtheis:tess-two:8.0.0'
I get an error "OpenCv was not initialised correctly. Application will be shut down" on my device.

Could you help me, please?

@allgood
Copy link
Owner

allgood commented Mar 4, 2018

Hi @korbi-oranssi

good to know you are working on ONS code.

I can't tell what incompatibility you got, maybe I can tell something if you paste the logcat output.

All you have done was add the dependency? is there any other change on ONS code?

Best regards,
Claudemir

@paktalin
Copy link
Author

paktalin commented Mar 4, 2018

Thanks for a quick response! Yes, everything I have done was just adding the dependency (I checked it once again now, downloading the project, successfully running it and then adding the dependecny - so I'm pretty sure).

Here's the log, starting from the problem part:

03-04 15:07:58.756 28835-28835/com.todobom.opennotescanner D/OpenCVManager/Helper: Service connection created
03-04 15:07:58.758 28835-28835/com.todobom.opennotescanner D/OpenCVManager/Helper: Trying to get library path
03-04 15:07:58.759 28835-28835/com.todobom.opennotescanner D/OpenCVManager/Helper: Trying to get library list
03-04 15:07:58.759 28835-28835/com.todobom.opennotescanner D/OpenCVManager/Helper: Library list: "null"
03-04 15:07:58.759 28835-28835/com.todobom.opennotescanner D/OpenCVManager/Helper: First attempt to load libs
03-04 15:07:58.759 28835-28835/com.todobom.opennotescanner D/OpenCVManager/Helper: Trying to init OpenCV libs
03-04 15:07:58.759 28835-28835/com.todobom.opennotescanner D/OpenCVManager/Helper: Trying to load library /data/app/org.opencv.engine-1/lib/arm64/libopencv_java3.so
03-04 15:07:58.760 28835-28835/com.todobom.opennotescanner E/art: dlopen("/data/app/org.opencv.engine-1/lib/arm64/libopencv_java3.so", RTLD_LAZY) failed: dlopen failed: "/data/app/org.opencv.engine-1/lib/arm64/libopencv_java3.so" is 64-bit instead of 32-bit
03-04 15:07:58.761 28835-28835/com.todobom.opennotescanner D/OpenCVManager/Helper: Cannot load library "/data/app/org.opencv.engine-1/lib/arm64/libopencv_java3.so"
03-04 15:07:58.761 28835-28835/com.todobom.opennotescanner W/System.err: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/org.opencv.engine-1/lib/arm64/libopencv_java3.so" is 64-bit instead of 32-bit
03-04 15:07:58.766 28835-28835/com.todobom.opennotescanner W/System.err:     at java.lang.Runtime.load(Runtime.java:332)
03-04 15:07:58.766 28835-28835/com.todobom.opennotescanner W/System.err:     at java.lang.System.load(System.java:981)
03-04 15:07:58.766 28835-28835/com.todobom.opennotescanner W/System.err:     at org.opencv.android.AsyncServiceHelper.loadLibrary(AsyncServiceHelper.java:347)
03-04 15:07:58.766 28835-28835/com.todobom.opennotescanner W/System.err:     at org.opencv.android.AsyncServiceHelper.initOpenCVLibs(AsyncServiceHelper.java:380)
03-04 15:07:58.766 28835-28835/com.todobom.opennotescanner W/System.err:     at org.opencv.android.AsyncServiceHelper.access$000(AsyncServiceHelper.java:18)
03-04 15:07:58.766 28835-28835/com.todobom.opennotescanner W/System.err:     at org.opencv.android.AsyncServiceHelper$3.onServiceConnected(AsyncServiceHelper.java:300)
03-04 15:07:58.766 28835-28835/com.todobom.opennotescanner W/System.err:     at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1326)
03-04 15:07:58.766 28835-28835/com.todobom.opennotescanner W/System.err:     at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1343)
03-04 15:07:58.766 28835-28835/com.todobom.opennotescanner W/System.err:     at android.os.Handler.handleCallback(Handler.java:815)
03-04 15:07:58.766 28835-28835/com.todobom.opennotescanner W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:104)
03-04 15:07:58.766 28835-28835/com.todobom.opennotescanner W/System.err:     at android.os.Looper.loop(Looper.java:214)
03-04 15:07:58.766 28835-28835/com.todobom.opennotescanner W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6102)
03-04 15:07:58.766 28835-28835/com.todobom.opennotescanner W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
03-04 15:07:58.766 28835-28835/com.todobom.opennotescanner W/System.err:     at java.lang.reflect.Method.invoke(Method.java:372)
03-04 15:07:58.766 28835-28835/com.todobom.opennotescanner W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
03-04 15:07:58.766 28835-28835/com.todobom.opennotescanner W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
03-04 15:07:58.767 28835-28835/com.todobom.opennotescanner D/OpenCVManager/Helper: First attempt to load libs fails
03-04 15:07:58.767 28835-28835/com.todobom.opennotescanner D/OpenCVManager/Helper: Init finished with status 255
03-04 15:07:58.767 28835-28835/com.todobom.opennotescanner D/OpenCVManager/Helper: Unbind from service
03-04 15:07:58.769 28835-28835/com.todobom.opennotescanner D/OpenCVManager/Helper: Calling using callback
03-04 15:07:58.769 28835-28835/com.todobom.opennotescanner D/OpenNoteScannerActivity: opencvstatus: 255
03-04 15:07:58.770 28835-28835/com.todobom.opennotescanner E/OpenCVLoader/BaseLoaderCallback: OpenCV loading failed!
03-04 15:07:58.774 28835-28835/com.todobom.opennotescanner D/FeatureProxyBase: FeatureProxyBase class constructor
03-04 15:07:58.774 28835-28835/com.todobom.opennotescanner D/FeatureProxyBase: getService(), serviceName = multiwindow_service_v1
03-04 15:07:58.775 28835-28835/com.todobom.opennotescanner D/FeatureProxyBase: FeatureProxyBase class constructor
03-04 15:07:58.775 28835-28835/com.todobom.opennotescanner D/FeatureProxyBase: getService(), serviceName = multiwindow_service_v1
03-04 15:07:58.818 28835-28835/com.todobom.opennotescanner D/ViewRootImpl: hardware acceleration is enabled, this = ViewRoot{2245eda7 OpenCV error,ident = 1}
03-04 15:07:58.832 28835-28835/com.todobom.opennotescanner D/Dialog: show
03-04 15:07:58.834 28835-28835/com.todobom.opennotescanner I/SurfaceView: updateWindow -- onWindowVisibilityChanged, visibility = 0, this = android.view.SurfaceView{3515ffc5 G.E...C. ......I. 0,0-0,0 #7f0d0078 app:id/surfaceView}
03-04 15:07:58.886 28835-28884/com.todobom.opennotescanner W/HTCLOG: use specified tag [OpenGLRenderer], func [3].
03-04 15:07:58.886 28835-28884/com.todobom.opennotescanner W/HTCLOG: mask=0x18
03-04 15:07:58.889 28835-28884/com.todobom.opennotescanner W/HTCLOG: use specified tag [libEGL], func [3].
03-04 15:07:58.889 28835-28884/com.todobom.opennotescanner W/HTCLOG: mask=0x18
03-04 15:07:58.891 28835-28835/com.todobom.opennotescanner I/SurfaceView: updateWindow -- OnPreDrawListener, mHaveFrame = false, this = android.view.SurfaceView{3515ffc5 G.E...C. ......I. 0,0-0,0 #7f0d0078 app:id/surfaceView}
03-04 15:07:58.909 28835-28884/com.todobom.opennotescanner E/GED: Failed to get GED Log Buf, err(0)
03-04 15:07:58.912 28835-28884/com.todobom.opennotescanner D/MALI: eglCreateContext:206: [MALI] eglCreateContext display 0xab4bafe0, share context 0x0 here.
03-04 15:07:58.926 28835-28884/com.todobom.opennotescanner D/MALI: gles_context_new:249: Create GLES ctx 0xde287010 successfully
03-04 15:07:58.927 28835-28884/com.todobom.opennotescanner E/[PropSet]: connect fail
03-04 15:07:58.927 28835-28884/com.todobom.opennotescanner E/libc: __system_property_set error : retry fail, errno 13(Permission denied)
03-04 15:07:58.927 28835-28884/com.todobom.opennotescanner E/[PropSet]: send_prop_msg return err -5
03-04 15:07:58.927 28835-28884/com.todobom.opennotescanner D/MALI: eglCreateContext:543: [MALI] eglCreateContext end. Created context 0xab610df8 here.
03-04 15:07:58.928 28835-28884/com.todobom.opennotescanner W/HTCLOG: use specified tag [OpenGLRenderer], func [3].
03-04 15:07:58.928 28835-28884/com.todobom.opennotescanner W/HTCLOG: mask=0x18
03-04 15:07:58.929 28835-28884/com.todobom.opennotescanner W/HTCLOG: use specified tag [ProgramBinary/Service], func [0].
03-04 15:07:58.929 28835-28884/com.todobom.opennotescanner W/HTCLOG: mask=0x18
03-04 15:07:58.937 28835-28884/com.todobom.opennotescanner W/HTCLOG: use specified tag [OpenGLRenderer], func [3].
03-04 15:07:58.937 28835-28884/com.todobom.opennotescanner W/HTCLOG: mask=0x18
03-04 15:07:58.938 28835-28884/com.todobom.opennotescanner W/HTCLOG: use specified tag [OpenGLRenderer], func [3].
03-04 15:07:58.938 28835-28884/com.todobom.opennotescanner W/HTCLOG: mask=0x18
03-04 15:07:58.938 28835-28884/com.todobom.opennotescanner W/HTCLOG: use specified tag [Surface], func [3].
03-04 15:07:58.938 28835-28884/com.todobom.opennotescanner W/HTCLOG: mask=0x18
03-04 15:07:58.939 28835-28884/com.todobom.opennotescanner D/mali_winsys: new_window_surface returns 0x3000
03-04 15:07:58.976 28835-28884/com.todobom.opennotescanner D/mali_winsys: new_window_surface returns 0x3000
03-04 15:07:58.991 28835-28835/com.todobom.opennotescanner I/SurfaceView: updateWindow -- OnPreDrawListener, mHaveFrame = false, this = android.view.SurfaceView{3515ffc5 G.E...C. ......I. 0,0-0,0 #7f0d0078 app:id/surfaceView}
03-04 15:07:59.021 28835-28884/com.todobom.opennotescanner W/HTCLOG: use specified tag [GraphicBufferMapper], func [3].
03-04 15:07:59.021 28835-28884/com.todobom.opennotescanner W/HTCLOG: mask=0x18
03-04 15:07:59.029 28835-28884/com.todobom.opennotescanner W/HTCLOG: use specified tag [GraphicBuffer], func [3].
03-04 15:07:59.029 28835-28884/com.todobom.opennotescanner W/HTCLOG: mask=0x18
03-04 15:07:59.032 28835-28884/com.todobom.opennotescanner W/MALI: glDrawArrays:770: [MALI] glDrawArrays takes more than 5ms here. Total elapse time(us): 13115
03-04 15:07:59.041 28835-28884/com.todobom.opennotescanner W/HTCLOG: use specified tag [GraphicBufferExtra], func [0].
03-04 15:07:59.041 28835-28884/com.todobom.opennotescanner W/HTCLOG: mask=0x18

@allgood
Copy link
Owner

allgood commented Mar 4, 2018

It is very strange... the error:

03-04 15:07:58.761 28835-28835/com.todobom.opennotescanner W/System.err: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/org.opencv.engine-1/lib/arm64/libopencv_java3.so" is 64-bit instead of 32-bit

indicates it is trying to load the wrong version of the opencv library. can you test again disabling tesseract?

@paktalin
Copy link
Author

paktalin commented Mar 4, 2018

03-04 15:57:06.075 7746-7746/com.todobom.opennotescanner D/OpenCVManager/Helper: Service connection created
03-04 15:57:06.076 7746-7746/com.todobom.opennotescanner D/OpenCVManager/Helper: Trying to get library path
03-04 15:57:06.077 7746-7746/com.todobom.opennotescanner D/OpenCVManager/Helper: Trying to get library list
03-04 15:57:06.077 7746-7746/com.todobom.opennotescanner D/OpenCVManager/Helper: Library list: "null"
03-04 15:57:06.077 7746-7746/com.todobom.opennotescanner D/OpenCVManager/Helper: First attempt to load libs
03-04 15:57:06.077 7746-7746/com.todobom.opennotescanner D/OpenCVManager/Helper: Trying to init OpenCV libs
03-04 15:57:06.077 7746-7746/com.todobom.opennotescanner D/OpenCVManager/Helper: Trying to load library /data/app/org.opencv.engine-1/lib/arm64/libopencv_java3.so
03-04 15:57:06.098 7746-7746/com.todobom.opennotescanner D/OpenCVManager/Helper: OpenCV libs init was ok!
03-04 15:57:06.098 7746-7746/com.todobom.opennotescanner D/OpenCVManager/Helper: First attempt to load libs is OK
03-04 15:57:06.100 7746-7746/com.todobom.opennotescanner I/OpenCVManager/Helper:   videoio: Removing WinRT API headers by default
03-04 15:57:06.100 7746-7746/com.todobom.opennotescanner I/OpenCVManager/Helper: General configuration for OpenCV 3.0.0 =====================================
03-04 15:57:06.100 7746-7746/com.todobom.opennotescanner I/OpenCVManager/Helper:   Version control:               3.0.0-6-gc1f114b-dirty

@paktalin
Copy link
Author

paktalin commented Mar 4, 2018

I think I figured it out. To make it work, I need to use OpenCV locally, building it in the project directly, so it will load only 32-bit libraries. I'll try it

@allgood
Copy link
Owner

allgood commented Mar 4, 2018 via email

@paktalin
Copy link
Author

paktalin commented Mar 4, 2018

I found something similar for tess-two : link

@allgood
Copy link
Owner

allgood commented Mar 4, 2018 via email

@paktalin
Copy link
Author

paktalin commented Mar 4, 2018

Yes, most likely. It seems to be by default in tess-two. To make it 64-bit I need to build it in the app directly, not just referencing from dependencies. I spent 3 hours, trying to do it, but it's very hard for such a novice as I am. So I came back to you. Is there any way to build in OpenCV in the app, so it won't use OpenCV Manager?

I would be very grateful if you could help me. I tried my best to solve it on my own, but it seems that I can't :( Sorry for bothering.

@allgood
Copy link
Owner

allgood commented Mar 4, 2018 via email

@paktalin
Copy link
Author

paktalin commented Mar 4, 2018

It's very cool for the only Android app :D and very useful. I'm gonna find the solution anyways and will text you about the results.

Thank you for being so helpful and kind.

@allgood
Copy link
Owner

allgood commented Mar 4, 2018 via email

@paktalin
Copy link
Author

paktalin commented Mar 5, 2018

I've done it. Had to import tess-two manually as a module, like it's described here and then repair millions of errors :) If you wish to use it, feel free to contact me any time here or by email (it's written in my account).

Thanks a lot again, you saved me.

@allgood
Copy link
Owner

allgood commented Mar 5, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants