shelarbapurao / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

Hard to use JavaCV with Tesseract OCR and others on Android #199

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run successfully face detection project using javacv  
2. Add tesseract ocr library for android to project(tesseract library test 
successfully in another project without javacv) 
3. Getting error and force close

What is the expected output? What do you see instead?
How to add both library tesseract ocr and javacv in a android project?

What version of the product are you using? On what operating system?
xperia x10 android 2.3.3 - JAVCV - Tesseract OCR android

Please provide any additional information below.
I have attach log file.

Original issue reported on code.google.com by mmnn...@gmail.com on 6 May 2012 at 12:13

Attachments:

GoogleCodeExporter commented 9 years ago
Just add everything needed by both JavaCV and Tesseract OCR. Your package is 
obviously missing the libjniopencv_core.so file because according to your error 
log:
"Couldn't load jniopencv_core: findLibrary returned null"

Original comment by samuel.a...@gmail.com on 6 May 2012 at 12:46

GoogleCodeExporter commented 9 years ago
Thank for your reply!

Before added Tesseract OCR library, JavaCV is ok, no error. But after add 
Tesseract OCR, this error was appeared. So, if I remove Tessreact, every thing 
is ok.
I sure Tesseract OCR work well.

Original comment by mmnn...@gmail.com on 6 May 2012 at 2:03

GoogleCodeExporter commented 9 years ago
Then the problem may lie with Android, since it is the call to 
System.loadLibrary() that is failing to find the file named 
"libjniopencv_core.so". I cannot do anything about that. Can you ask the 
developers of Android see what they tell you? Thank you

Original comment by samuel.a...@gmail.com on 6 May 2012 at 2:14

GoogleCodeExporter commented 9 years ago
Me too with mmnn in Comment 2. I'm also using Tessreact and JavaCV.
So System.loadLibrary() and samuel's JavaCpp technology cannot be used toghther?

Original comment by xyxzfj@gmail.com on 17 May 2012 at 12:02

GoogleCodeExporter commented 9 years ago
This issue can easily be repruduced:
1. Build and run project FacePreview (see download javacv-bin-20120512.zip)
(File will be added along with FacePreview.java under package 
com.googlecode.javacv.facepreview)
(The result will be OK.)
2. Build and add library tesseract-android-tools () to project FacePreview.
3. Add "TessBaseAPI tessBaseAPI = new TessBaseAPI();" to 
com.googlecode.javacv.facepreview.FacePreview.onCreate(), run.
The error stack trace: (see the attached file for detail)
05-17 20:49:34.959: E/AndroidRuntime(16679): Caused by: 
java.lang.UnsatisfiedLinkError: Couldn't load jniopencv_core: findLibrary 
returned null
05-17 20:49:34.959: E/AndroidRuntime(16679):    at 
java.lang.Runtime.loadLibrary(Runtime.java:429)
05-17 20:49:34.959: E/AndroidRuntime(16679):    at 
java.lang.System.loadLibrary(System.java:554)
05-17 20:49:34.959: E/AndroidRuntime(16679):    at 
com.googlecode.javacpp.Loader.loadLibrary(Loader.java:409)
05-17 20:49:34.959: E/AndroidRuntime(16679):    at 
com.googlecode.javacpp.Loader.load(Loader.java:342)
05-17 20:49:34.959: E/AndroidRuntime(16679):    at 
com.googlecode.javacpp.Loader.load(Loader.java:316)
05-17 20:49:34.959: E/AndroidRuntime(16679):    at 
com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:131)
05-17 20:49:34.959: E/AndroidRuntime(16679):    ... 26 more

Original comment by xyxzfj@gmail.com on 17 May 2012 at 12:52

Attachments:

GoogleCodeExporter commented 9 years ago
Can you list me the files you have in the APK?

Original comment by samuel.a...@gmail.com on 17 May 2012 at 1:02

GoogleCodeExporter commented 9 years ago
Hi Samuel,
Fantastic! In preparing for you my error illustration project based on 
FacePreview, I got Javacv and Tesseract run together peacefully!
It is: Do not use 
"android.library.reference.1=../tesseract-android-tools/tesseract-android-tools"
 to reference project tesseract-android-tools, instead add 
tesseract-android-tools.jar and liblept.so and libtess.so into project 
FacePreview. Then everything is OK!
The attached file FacePreview(Javacv and Tesseract).zip is an OK project now. 
javacpp.jar, javacv.jar and libs from OpenCV-2.4.0-android-arm.zip 
and javacv-android-arm.jar are missing and you should add them to run the 
project.

Original comment by xyxzfj@gmail.com on 17 May 2012 at 11:56

Attachments:

GoogleCodeExporter commented 9 years ago
Ah, thanks for the update! I guess JavaCV could be more Android friendly, but I 
am not sure how to do it without making it less Java SE friendly... Let me know 
if you figure this out, thanks

Original comment by samuel.a...@gmail.com on 18 May 2012 at 1:10

GoogleCodeExporter commented 9 years ago
Hi Samuel,
could you tell us what's the smallest required *.so set to build a specific 
project?
In my example, I just used constants and methods from 
com.googlecode.javacv.cpp.opencv_core, com.googlecode.javacv.cpp.opencv_highgui 
and com.googlecode.javacv.cpp.opencv_highgui, but folder armeabi is 22.4 MB, 
which makes the zipped AndroidVIQ.apk 9.70 MB. With out the folder armeabi, 
it's only 648 KB!
I tried to remove all .so files except what I know -- libjniopencv_highgui.so, 
libopencv_highgui.so, libjniopencv_imgproc.so, libopencv_imgproc.so, 
libjniopencv_core.so, libopencv_core.so and my libtess.so andliblept.so, But 
programme goes wrong saying library missing...

Original comment by xyxzfj@gmail.com on 21 May 2012 at 12:12

GoogleCodeExporter commented 9 years ago
Yes, that should work. What library does it say is missing?

Original comment by samuel.a...@gmail.com on 21 May 2012 at 1:07

GoogleCodeExporter commented 9 years ago
Yes, that really works! I've just wrongly removed libjniopencv_core.so.

Original comment by xyxzfj@gmail.com on 21 May 2012 at 1:39

GoogleCodeExporter commented 9 years ago
FYI, this should get better with the new Gradle-based build system in Android:
    http://tools.android.com/tech-docs/new-build-system
If someone figures out how to make everything work well together, please post 
your findings here, thanks!

Original comment by samuel.a...@gmail.com on 4 Jan 2014 at 2:37