Using Tesseract Tools for Android to Create a Basic OCR App
Jan. 24, 2012 UPDATE: This tutorial is out of date. The tesseract-android-tools build files and the Android SDK Tools have both been updated, so the build should now succeed without requiring the modifications shown below. The steps for importing the project into Eclipse as a library project have not changed.
Note: The below instructions were written for the Android SDK Tools r12. To compile using r14+, after ndk-build do rm build.xml, then android update project --path . , then ant release (without modifying build.xml). Running the test cases on new versions of the SDK Tools will require other modifications.
These instructions assume you have already installed the Android SDK and NDK along with Eclipse and Subversion on Ubuntu.
Overall, what you need to do is to set up the tesseract-android-tools project as a library project in Eclipse, and tell your project to refer to the library project. So you’ll need two projects in Eclipse, whereas for an ordinary app you would have just one.
Step-by-step:
Check out the latest tesseract-android-tools source code using Subversion (don’t use the outdated code from “Downloads”):
svn checkout http://tesseract-android-tools.googlecode.com/svn/trunk/ tesseract-android-tools
Build the project according to the instructions in the readme file. Make sure that ndk-build successfully creates the .so object files, and that you get “BUILD SUCCESSFUL” when ant finishes. You may need to make three modifications:
Modification 1. Apparently the kernel.org site is unavailable for the libjpeg download, and it’s been pointed out elsewhere that using an alternative repository works, so use the following command instead of the existing git clone command:
git clone git://github.com/android/platform_external_jpeg.git libjpeg
Modification 2. Before running ant, edit the existing build.xml as a workaround for Android bug #13024. Put the following lines immediately before the ending </project> tag:
<!-- beginning of modification --> <path id="android.libraries.src"><path refid="project.libraries.src" /></path> <path id="android.libraries.jars"><path refid="project.libraries.jars" /></path> <!-- end of modification -->
Modification 3. Do ant compile instead of ant release.
Create an AVD running Android 2.2 or higher, and with an SD card.
Import the tesseract-android-tools project into Eclipse:
File->Import->Existing Projects Into Workspace->Choose tesseract-android-tools->Finish
If you get an error complaining about a compiler level 5.0 compatibility problem, right-click the project name for tesseract-android-tools and do Properties->Java Compiler->Enable project specific settings and Uncheck “Use default compliance settings,” then set “Generated .class files compatibility” to 1.5, and set “Source compatibility” to 1.5. Answer yes if asked to rebuild.
Add tesseract-android-tools as a library project:
Right-click tesseract-android-tools project name->Properties->Android->check “Is Library”.
[Optional] Install the built-in test case package by importing the tesseract-android-tools-test project:
File->Import->Existing Projects Into Workspace->Choose tesseract-android-tools-test->Finish
[Optional] Start the AVD, wait for it to boot, and install the traineddata file required by the test cases:
wget http://tesseract-ocr.googlecode.com/files/eng.traineddata.gz
gunzip eng.traineddata.gz
adb shell mkdir /mnt/sdcard/tesseract
adb shell mkdir /mnt/sdcard/tesseract/tessdata
adb push eng.traineddata /mnt/sdcard/tesseract/tessdata
[Optional] Run the test cases–the test cases should pass, saying “OK (3 tests)”:
adb install tesseract-android-tools-test/bin/tesseract-android-tools-test.apk
adb shell am instrument -w -e package com.googlecode.tesseract.android.test \
com.googlecode.tesseract.android.test/android.test.InstrumentationTestRunner
Create your new app as a new Android project.
Configure your project to use the tesseract-android-tools project as a library project: Right click your new project name, do Properties->Android->Library->Add, and choose tesseract-android-tools.
You can now create a TessBaseAPI object in your app’s onCreate():
File myDir = getExternalFilesDir(Environment.MEDIA_MOUNTED); TessBaseAPI baseApi = new TessBaseAPI(); baseApi.init(myDir.toString(), "eng"); // myDir + "/tessdata/eng.traineddata" must be present baseApi.setImage(myImage); String recognizedText = baseApi.getUTF8Text(); // Log or otherwise display this string... baseApi.end();
Run your project on the AVD.
Other basic examples can be found in the TessBaseAPITest.java file in the tesseract-android-tools-test project.
Will it work as well on windows xp?
I haven’t tried it on Windows/Cygwin.
Tried on XP & Cygwin. I had no success after a full-day of searching and debugging. Same exact process attempted on cygwin works perfectly fine on Ubuntu and took maybe roughly 5 minutes.
Once you have set up the tesseract-android-tools library with Ubuntu (I’m using a VM), can you transfer the library files (the 3 .so files, I presume) to Mac and Windows? If yes, do you also need the NDK for those platforms as well?
I routinely build the libraries on an Ubuntu VirtualBox VM that runs on top of Windows 7, and it works great. I have a shared folder set up between the VM and Windows. I’m not really sure beyond that. I think you still need the NDK on both.
anyone know how to pass a image from camera??
i have tryed to put Bitmap bitmap = (Bitmap) data.getExtras().get(“data”);
the image works fine, but when i try to baseApi.setImage(bitmap);
Its come up with error
Try loading it using Bitmap.Config.ARGB_8888.
tnks, but how can I use Bitmap.Config.ARGB_8888???
Check http://code.google.com/p/tesseract-android-tools/source/browse/trunk/tesseract-android-tools-test/src/com/googlecode/tesseract/android/test/TessBaseAPITest.java
I’m trying to build now on Ubuntu, hope to get better results =]
when I follow those steps from README after ndk-build
I have tryed the command “android update project –path .”
but it doest work
how I use this command ???
my app is on /home/rafael/tesseract
Do this:
rm build.xml
android update project --path .
ant release
rafael@rafael:~/tesseract$ rm build.xml
rafael@rafael:~/tesseract$ android update project –path .
Updated local.properties
No project name specified, using project folder name ‘tesseract’.
If you wish to change it, edit the first line of build.xml.
Added file ./build.xml
Error: Could not access ./proguard.cfg: ./proguard.cfg (Permission denied)
rafael@rafael:~/tesseract$
What do I have to do??
and thnks for helping me =]
If there’s an existing proguard.cfg file in the directory, you may need to remove that first too.
after I got a BUILD SUCESS from “ant release”, when I try to
add the project into eclipse I get a error “Specified buildfile does not contain a javac task”
my build.xml code is:
<!–
/* This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir} */
–>
<!– Import the actual build file.
To customize existing targets, there are two options:
– Customize only one target:
– copy/paste the target into this file, *before* the
task.
– customize it to your needs.
– Customize the whole content of build.xml
– copy/paste the content of the rules files (minus the top node)
into this file, replacing the task.
– customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read ‘custom’ instead of an integer,
in order to avoid having your file be overridden by tools such as “android update project”
–>
Don’t modify the build.xml, just use the one that gets generated.
But I always get this mensage ““Specified buildfile does not contain a javac task” when I open with eclipse after I run “ant release”
Do you get “BUILD SUCCESSFUL”? Is this when doing File->Import->Existing Project in Eclipse? Are you using SDK Tools r15?
for the “ndk-build” step it gave me the following error. The .SO file is not prepared…
“Install : libjpeg.so => libs/armeabi/libjpeg.so
make: *** No rule to make target `//cygdrive/e/AndroidReference/VisitingCardTess
eract/tesseract-android-tools/external/leptonlib-1.66/src/adaptmap.c’, needed by
`/cygdrive/e/AndroidReference/VisitingCardTesseract/tesseract-android-tools/obj
/local/armeabi/objs/lept//cygdrive/e/AndroidReference/VisitingCardTesseract/tess
eract-android-tools/external/leptonlib-1.66/src/adaptmap.o’. Stop.”
Have you tried the suggestions at http://stackoverflow.com/questions/7334040/compiling-tesseract-through-android-ndk ?
I’d like to know if the suggestions at that link work well–please leave a follow up message to help other people.
I answer this question on stackoverflow, and I’ḿ using this solution on windows 7 and windows xp, with you need I can share my modified Android.mk files with you.
That would be helpful, if it works on both Linux and Cygwin. I’ll test it and include it in my fork of tesseract-android-tools, which I’ll be posting to Github. Please email to app.ocr@gmail, or just wait for my tesseract fork project to be posted and issue a pull request on Github. Thank you!
I did use that but it isn’t a solution for me
I am not getting the “libjpeg” folder coz of the error.
I also had something similar to this, ubuntu 11.10 sdk 14.
Tried the hack on stack overflow, didn’t work.
Fixed the two google android.mk files instead :
LOCAL_PATH := $(call my-dir)/../..
i.e. (call my-dir) must return the current build folder in the hierarchy, as it moves around.
Seems to build ok now.
Thanks that worked for me!
I needed to change that in both the leptonica and tesseract google dirs to get it to work
First, I would like to congratulate the excellent work in Test OCR application and would like to tell you what is happening to me.
I compiled tesseract-android-tools and tested using the Android test project, and is working normally, no errors. I created another project in order to use images from the real world, but my OCR failure in 80% of the tests and your program have fewer failures using the same library. Do you have any tips to give me?
Do you say on android market codes will be on github, so can you send me the code?
My only suggestion is to allow the user to pass a subset of the camera view to the OCR engine. In the OCR Test app I just use setImage() in TessBaseAPI–I’m not doing any additional image processing.
I’ll post on Android Market when the code is available on Github–it should be available in a few weeks.
Ok, I have better results using zxing Camera code, like you did, but I need to do a customized View, like google goggles, like you did too, Did you get this part of code from other project?
No, I just added some new code to parse getX/getY touch events in CaptureActivity.java in onTouch, case MotionEvent.ACTION_MOVE.
Okay, so any suggestions on how to create an OCR app using AppInventor? I am a web developer and haven’t used Eclipse because I am not familiar with the coding. However, I have done hours of research and finally ended up here. This app would be basic and is a “niche” so the users would only be taking a picture of one particular object. The picture would contain digital numeral characters (same as used in digital alarm clocks) I need the app to recognize the characters and output them to a text, pdf, or perhaps even and email or word file. Any suggestions? Also, what method do barcode scanners use on mobile phones to scan the barcode? Whew, thanks!
I haven’t tried AppInventor but I would guess that it’s probably better suited to simpler projects than what you have in mind.
For recognizing the digital-style characters, you might want to ask on the tesseract-ocr mailing list, and post an example of an actual image that you want to recognize. I think getting the OCR to work properly will be a lot more challenging than the outputting to text and emailing, etc. On Tesseract, I know it’s possible to create a custom “traineddata” file (see http://code.google.com/p/tesseract-ocr/wiki/TrainingTesseract3) to recognize your specific style of characters, but I’m not sure of the difficulty or effectiveness.
Barcode scanners repeatedly scan the captured image data for barcodes using a fast algorithm. My “OCR Test” app does the same thing, but looks for text instead of bar codes. I made it by modifying an open source barcode scanner app (ZXing).
Hello, I am developing an android application named ‘Barcode Scanner’. Can u help me out regarding how can I send my images captured from Camera to the OCR for Image processing?
Try forking my project at https://github.com/rmtheis/android-ocr.
Rmt,
Could you possible share with me the source code of your modified ZXing scanner. I have been trying to use an OCR method to recognize bar codes for a school project that I am trying to finish. I have not had any luck so far. If you could help me out I would really appreciate it.
Sure–it’s at https://github.com/rmtheis/android-ocr.
Rmt,
What I need to do is take OCR extracted images that I created using an OCR program and have my barcodes be recognized when a picture is taken in my app. I just need to link the OCR file of each barcode to my database of products (I have 100 products embedded into app). Could you tell me how I would write the code so the OCR file is recognized?
Thank you,
Jay
Are you trying to recognize characters, or barcodes? What are you taking a picture of?
I am taking a picture of upc barcodes. I just want to read the numerical digits on the bottom of the UPC. I want to then link each barcode with a database that I have created. Could you give your email and I.could send you the code I have so far?
Thank you for your help,
Jay
I don’t have time to look at your code, but I can point you in the direction of a barcode scanner project. Google ZXing if you want to scan the barcode itself, that would be faster than OCR-ing the characters. For OCR of the numbers, you’d need to have some way to separate the characters from the barcode itself, because the OCR engine tends to interpret the barcode as characters.
I had no success on this step:
export TESSERACT_PATH=${PWD}/tesseract-3.00
export LEPTONICA_PATH=${PWD}/leptonlib-1.66
export LIBJPEG_PATH=${PWD}/libjpeg
nothing happen when I typing that command
Help me!
Those commands set environment variables, so there’s no output.
Thank mate!
after command ndk-build have been done, I run command: android update project –path and getting error: android command not found.
so what can I do?
sorry for my English!
Add the Android SDK to your PATH in your .bashrc:
PATH=$PATH:/home/$USER/android-sdk-linux_x86/tools
PATH=$PATH:/home/$USER/android-sdk-linux_x86/platform-tools
PATH=$PATH:/home/$USER/android-ndk-r6b
export PATH
Finally I have complied successful tesseract-android-tools but tesseract-android-tools-test was not.
I run test cases by create new Android project and here is my code
TessBaseAPI api = new TessBaseAPI();
api.init(“/mnt/sdcard/tesseract/tessdata/”, “eng”);
File f = new File(Environment.getExternalStorageDirectory() + “”/mnt/sdcard/tesseract/digits.jpg”); // test image file including path.
if (f == null || !f.canRead() || f.length()>>” + text + “<<<");
It's getting error Force close when running.
Logcat
10-21 23:54:58.361: D/dalvikvm(7304): Trying to load lib /data/data/com.google.tesseract.android/lib/liblept.so 0×40515228
10-21 23:54:58.381: D/dalvikvm(7304): Added shared lib /data/data/com.google.tesseract.android/lib/liblept.so 0×40515228
10-21 23:54:58.391: D/dalvikvm(7304): Trying to load lib /data/data/com.google.tesseract.android/lib/libtess.so 0×40515228
10-21 23:54:58.571: D/dalvikvm(7304): Added shared lib /data/data/com.google.tesseract.android/lib/libtess.so 0×40515228
10-21 23:54:58.581: V/Tesseract(native)(7304): Java_com_googlecode_tesseract_android_TessBaseAPI_nativeClassInit
10-21 23:54:58.581: V/Tesseract(native)(7304): Java_com_googlecode_tesseract_android_TessBaseAPI_nativeConstruct
10-21 23:54:58.591: D/AndroidRuntime(7304): Shutting down VM
10-21 23:54:58.591: W/dalvikvm(7304): threadid=1: thread exiting with uncaught exception (group=0×40015560)
10-21 23:54:58.622: E/AndroidRuntime(7304): FATAL EXCEPTION: main
10-21 23:54:58.622: E/AndroidRuntime(7304): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.tesseract.android/com.google.tesseract.android.OCRandroid233Activity}: java.lang.IllegalArgumentException: Data path must contain subfolder tessdata!
10-21 23:54:58.622: E/AndroidRuntime(7304): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
10-21 23:54:58.622: E/AndroidRuntime(7304): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
10-21 23:54:58.622: E/AndroidRuntime(7304): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-21 23:54:58.622: E/AndroidRuntime(7304): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
10-21 23:54:58.622: E/AndroidRuntime(7304): at android.os.Handler.dispatchMessage(Handler.java:99)
10-21 23:54:58.622: E/AndroidRuntime(7304): at android.os.Looper.loop(Looper.java:123)
10-21 23:54:58.622: E/AndroidRuntime(7304): at android.app.ActivityThread.main(ActivityThread.java:3683)
10-21 23:54:58.622: E/AndroidRuntime(7304): at java.lang.reflect.Method.invokeNative(Native Method)
10-21 23:54:58.622: E/AndroidRuntime(7304): at java.lang.reflect.Method.invoke(Method.java:507)
10-21 23:54:58.622: E/AndroidRuntime(7304): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-21 23:54:58.622: E/AndroidRuntime(7304): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-21 23:54:58.622: E/AndroidRuntime(7304): at dalvik.system.NativeStart.main(Native Method)
10-21 23:54:58.622: E/AndroidRuntime(7304): Caused by: java.lang.IllegalArgumentException: Data path must contain subfolder tessdata!
10-21 23:54:58.622: E/AndroidRuntime(7304): at com.googlecode.tesseract.android.TessBaseAPI.init(TessBaseAPI.java:139)
10-21 23:54:58.622: E/AndroidRuntime(7304): at com.google.tesseract.android.OCRandroid233Activity.onCreate(OCRandroid233Activity.java:25)
10-21 23:54:58.622: E/AndroidRuntime(7304): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-21 23:54:58.622: E/AndroidRuntime(7304): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
10-21 23:54:58.622: E/AndroidRuntime(7304): … 11 more
Help me!
sr, this is full code
TessBaseAPI api = new TessBaseAPI();
api.init(“/mnt/sdcard/tesseract/tessdata/”, “eng”);
File f = new File(Environment.getExternalStorageDirectory() + “/mnt/sdcard/tesseract/digits.jpg”); // test image file including path.
if (f == null || !f.canRead() || f.length()>>” + text + “<<<");
Did the built-in test cases pass? Did you install eng.traineddata?
Huh, I can not send full of my code in above comment
sorry for inconvenient!
Hi I am new on this subject and I need your help.I am having some problems with installation.It is good until the comment “ndk-build” when I wirte it ndk-build it gives that error. what must I do?
hasan@hasan:~/workspace$ /home/hasan/Desktop/opencv-android/android-ndk-r6/ndk-build
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/home/hasan/Desktop/opencv-android/android-ndk-r6/build/core/build-local.mk:85: *** Android NDK: Aborting . Stop.
Thanks.
Change into the tesseract-android-tools project directory before running ndk-build.
Yes, I have download eng.traineddata and copy to /mnt/sdcard/tesseract/tessdata on ADV
Hi all,
I have some questions.
The first 1, in the readme tutorial, it says:
cd
what does project-directory mean?
Must I create an android project using eclipse first before building tesseract library?
I have tried both tutorials here and on http://code.google.com/p/tesseract-android-tools/source/browse/trunk/tesseract-android-tools/README
But it seems that doesn’t work for me. Im working on windows 7 platform and use cygwin to do linux command line. But when I run ndk-build, it creates .so file for my another existing project instead of libjpeg.so. And then when I run “android” command, an error occurred “bash : android: command not found”
My android-sdk located in C:/android-sdk
android-ndk located in C:/android-ndk-r6b
and usually my workspace is beneath my android-ndk-r6b directory
You need to build it using Linux, not Cygwin. I use Ubuntu running on VirtualBox.
The project directory is the directory where you downloaded tesseract-android-tools. You need to add the Android SDK to your PATH in your .bashrc in order to be able to run it from another directory.
Oke. I have only win7 and now Im trying to download Ubuntu and VirtualBox.
After creating .so files I just need to import that file into my android project or full android-tesseract directory?
I also can use the .so files for developing in win7 right?
I almost build the libjpeg.so using cygwin, but at the rest an error occurred like this:
Compile arm : jpeg <= jidctint.c
Compile arm : jpeg libs/armeabi/libjpeg.so
make: *** No rule to make target `//cygdrive/c/android-ndk-r6b/external/leptonli
b-1.66/src/adaptmap.c’, needed by `/cygdrive/c/android-ndk-r6b/external/tesserac
t-android-tools-1.00/obj/local/armeabi/objs/lept//cygdrive/c/android-ndk-r6b/ext
ernal/leptonlib-1.66/src/adaptmap.o’. Stop.
what should i do with this issue?
The “no rule to make target” problem is due to the build file not working on Cygwin.
After you make the .so files, just follow the directions above for setting up tesseract-android-tools as a library project, and make sure your project is set to use tesseract-android-tools as a library project like described in the instructions. That will take care of the “importing.” It will work in Windows 7 after building in Ubuntu–that’s how I do it.
I need you who understands these problems to help me out.
Thanks you a bunch
Regards,
Priska
Hi again,
I am getting a new error while running tesseract-android-tools-test.
I did everything on command line so files are created. I imported tesseract-android-tools to workspace on eclipse and after that I imported tesseract-android-tools-test into workspace.I chose tesseract-android-tools to use as library.
When I run the tesseract-android-tools-test it doesn’t give any error but it writes in console
tesseract-android-tools] Could not find tesseract-android-tools.apk!
and continues but nothing happens on emulator.
if you can help I will be glad.
You can’t run the test cases directly from Eclipse, as far as I know, but you can run them using the instructions marked “Optional” above.
btw how about the result for recognizing hangul korean characters ?
Im going to make an android application for Korean and then translate them into English or Bahasa.
Does Tesseract include dictionary for translating? or I have to create my own database to save all the translation based on Korean character utf-16 encoding?
How can i get the utf-16 codes of each character from tesseract and compare them with data stored in database for translating?
No, Tesseract just does the OCR. You’d need a separate solution for doing the translation. You can get the UTF-8 character codes from Tesseract using getUTF8Text().
Thank you very much for your all reply, I really appreciate
.
Finally, the VirtualBox and ubuntu downloading process is just done.
First I will try to build the .so file using ubuntu first.
If I have any problem with it I will post it here.
Once again, Thank you a bunch
Hi again
I am getting closer to end but there is a new problem.
until
“adb install tesseract-android-tools-test/bin/tesseract-android-tools-test.apk”
everything is ok but when I run this on console it says
can’t find ‘tesseract-android-tools-test/bin/tesseract-android-tools-test.apk’ to install
what’s wrong with that ?,please help.
Thanks.
You need to import the tesseract-android-tools-test project into Eclipse to build the APK.
problem again
an error occurred when i run ./ndk-build
priska@PriskAprilia:~/android-ndk$ NDK_PROJECT_PATH=”/home/priska/android-ndk/external/tesseract-3.00″
priska@PriskAprilia:~/android-ndk$ export=NDK_PROJECT_PATH
priska@PriskAprilia:~/android-ndk$ ./ndk-build
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/home/priska/android-ndk/build/core/build-local.mk:85: *** Android NDK: Aborting . Stop.
what my ndk_project_path should be?
Can I build tesseract-3.00 ?
When I try on cygwin :
“Compile arm : jpeg <= jidctint.c
Compile arm : jpeg libs/armeabi/libjpeg.so
make: *** No rule to make target `//cygdrive/c/android-ndk-r6b/external/leptonli
b-1.66/src/adaptmap.c’, needed by `/cygdrive/c/android-ndk-r6b/external/tesserac
t-android-tools-1.00/obj/local/armeabi/objs/lept//cygdrive/c/android-ndk-r6b/ext
ernal/leptonlib-1.66/src/adaptmap.o’. Stop."
I build tesseract-android-1.00 not tesseract-3.00. Tesseract-3.00 doesnt have jni file
Need help!
Thank you
I try this one : priska@PriskAprilia:~/android-ndk/tesseract-android$ /home/priska/android-ndk/ndk-build
instead of set my NDK_PROJECT_PATH
and it works now
I think something wrong with the read me file, it is tesseract-3.00 (i think this one is not for android, it doesn’t contain any jni folder, android.mk file). So I build Tesseract-android-tools-1.00
Does this version already include korean traindata?
Does it work, or not? I haven’t tried Tesseract v1, and I don’t recommend it.
I haven’t tried to create project. Last night I just succeeded in building the library.
I don’t know why i succeeded in building Tesseract-android-tools-1.00 instead of Tesseract-3.00.
Can I really use tesseract-3.00 for creating android app even though there is no any android name in it ?
Tesseract Tools for Android (tesseract-android-tools) is an Android API for Tesseract OCR v3.00.
i can open this link : http://tesseract-android-tools.googlecode.com/svn/trunk/ tesseract-android-tools
The page not found
That’s a parameter for svn, not a web link.
Hi,
Tesseract V3.01 has been released on Oct 21 2011
Can I use it to build project on android?
I haven’t tried it.
I updated my fork (https://github.com/rmtheis/tess-two) of tesseract-android-tools to work with Tesseract v3.01, so you can give that one a try.
If your network setup blocks git’s port 9148, it worked for me to replace git:// with http:// in modification #1.
android update project –path
What project path that i should update?
You should run that command as shown in the instructions, “android update project –path .” in your tesseract-android-tools directory.
by the way, where is the build.xml location?
In the tesseract-android-tools directory.
Any help will be appreciated. Thank you
Hi I need help. I got this error while update android project path:
C:/android-ndk-r6b/external/tesseract-android-tools/tesseract-android-tools$ android update project -p /media/00B42E57B42E5008/android-ndk-r6b/external/tesseract-android-tools/tesseract-android-tools
Error: The project either has no target set or the target is invalid.
Please provide a –target to the ‘android update’ command.
Yep, I think you get that if you build with SDK Tools r14+. Try –target 12 or –target 14.
Then I think you’ll need to delete the build.xml and do “ant release”.
I think you need to do
android list target
first, and find the number for the target AVD you want, to use in the “–target” param. It’s not the same number as an ADK rev number, like 12 or 14. In my case, there are only ids 1 through 4 (but maybe I’m unusual).
That’s right–thanks–the target is the API level. Use 8, to indicate Android 2.2+.
another error :
priska@PriskAprilia:/media/00B42E57B42E5008/android-ndk-r6b/tesseract-android-tools/tesseract-android-tools$ android update project -t 12 -p /media/00B42E57B42E5008/android-ndk-r6b/tesseract-android-tools/tesseract-android-tools
Error: Target id ’12′ is not valid. Use ‘android list targets’ to get the target ids.
priska@PriskAprilia:/media/00B42E57B42E5008/android-ndk-r6b/tesseract-android-tools/tesseract-android-tools$ android list targets
Available Android targets:
priska@PriskAprilia:/media/00B42E57B42E5008/android-ndk-r6b/tesseract-android-tools/tesseract-android-tools$
My android targets are empty. I have installed android-sdk and eclipse on my Ubuntu 11.10.
I’m trying to build Tesseract on windows 7 using ndk-build on Ubuntu 11.10
Finally I successfully built it by combining linux terminal and windows command prompt. But while exporting tesseract-android-tools-tests many errors appear
[2011-11-08 01:44:45 - tesseract-android-tools-test] ERROR: Unknown option ‘–no-crunch’
[2011-11-08 01:44:45 - tesseract-android-tools-test] Android Asset Packaging Tool
[2011-11-08 01:44:45 - tesseract-android-tools-test]
[2011-11-08 01:44:45 - tesseract-android-tools-test] Usage:
[2011-11-08 01:44:45 - tesseract-android-tools-test] aapt l[ist] [-v] [-a] file.{zip,jar,apk}
[2011-11-08 01:44:45 - tesseract-android-tools-test] List contents of Zip-compatible archive.
[2011-11-08 01:44:45 - tesseract-android-tools-test]
[2011-11-08 01:44:45 - tesseract-android-tools-test] aapt d[ump] [--values] WHAT file.{apk} [asset [asset ...]]
[2011-11-08 01:44:45 - tesseract-android-tools-test] badging Print the label and icon for the app declared in APK.
[2011-11-08 01:44:45 - tesseract-android-tools-test] permissions Print the permissions from the APK.
[2011-11-08 01:44:45 - tesseract-android-tools-test] resources Print the resource table from the APK.
[2011-11-08 01:44:45 - tesseract-android-tools-test] configurations Print the configurations in the APK.
[2011-11-08 01:44:45 - tesseract-android-tools-test] xmltree Print the compiled xmls in the given assets.
[2011-11-08 01:44:45 - tesseract-android-tools-test] xmlstrings Print the strings of the given compiled xml assets.
[2011-11-08 01:44:45 - tesseract-android-tools-test]
[2011-11-08 01:44:45 - tesseract-android-tools-test] aapt p[ackage] [-d][-f][-m][-u][-v][-x][-z][-M AndroidManifest.xml] \
[2011-11-08 01:44:45 - tesseract-android-tools-test] [-0 extension [-0 extension ...]] [-g tolerance] [-j jarfile] \
[2011-11-08 01:44:45 - tesseract-android-tools-test] [--debug-mode] [--min-sdk-version VAL] [–target-
What should i do with those errors?
Exporting? Which step of the instructions are you on? Where are you seeing this error?
while importing tesseract-androids-tools and tesseract-android-tools-test into eclipsse but it had been resolved now. I Copy android-support-4 to my eclipse folder. it was about android compatibility issue
Resolved I copy android-support-4 to my eclipse folder.
Well, can I download korean.tessdata and place it in a folder under my android project (not inside the SDcard) ?
How can I print the string of getUTF8Text(); into android view ?
I do this
final String outputText = baseApi.getUTF8Text();
TextView v = new TextView(this);
but the string didn’t appear when running android’s emulator
((TextView)v).setText(outputText);
[...] checkout Robert Theis’s Android OCR application on Github too (for intermediate+)!References:Using Tesseract Tools for Android to Create a Basic OCR App by Robert TheisSimple Android Photo Capture by MakeMachine.tess-two READMELeave a Reply Cancel [...]
Hello, I’ve made the process smooth but I have an error in the line “ant release”, the output of the error is:
Dritan @ drito7: ~ / android-tools tesseract-$ ant release
BuildFile: build.xml
BUILD FAILED
/ home / Dritan / tesseract-android-tools / build.xml: 77: The Android Ant-based build system Requires Ant 1.8.0 or later. Current version is 1.7.1
Total time: 0 seconds
Can anyone help me? Thanks..
If you’re using Ubuntu, try:
sudo apt-get upgrade ant
Thanks..
I think something happened to the text of the original post. I now see
— start of quote
Modification 2. Before running ant, edit the existing build.xml as a workaround for Android bug #13024. Put the following lines immediately before the ending tag:
1
2
— end quote
There’s nothing between those two comments!
Well, dang – the XML comments got eaten by the blog! Perhaps I should have said
Modification 2. Before running ant, edit the existing build.xml as a workaround for Android bug #13024. Put the following lines immediately before the ending tag:
1 <!– beginning of modification –>
2 <!– end of modification –>
How’s that?
lol you’re funny—>”Well, dang – the XML comments got eaten by the blog!”
Thanks for noticing that–it’s fixed now.
Please refer to http://code.google.com/p/android/issues/detail?id=13024
there are two lines modification for your build.xml as the writer said above. Place it after before
hi, i got the following error when i try ndk-build on ubuntu. any help? thanks..
user@user-pc:~/tesseract-android-tools$ ndk-build
/home/user/android-ndk-r7/prebuilt/linux-x86/bin/awk: 1: ELF: not found
/home/user/android-ndk-r7/prebuilt/linux-x86/bin/awk: 4: Syntax error: word unexpected (expecting “)”)
Android NDK: Host ‘awk’ tool is outdated. Please define HOST_AWK to point to Gawk or Nawk !
/home/user/android-ndk-r7/build/core/init.mk:258: *** Android NDK: Aborting. . Stop.
Hi RMT,
Thanks for the work. My basic application is working fine, but I’d like to move on to using some of the more sophisticated features of Tesseract like retrieving bounding boxes. TessBaseAPI.java doesn’t seem to have them. Are you planning on implementing the wrappers? I wouldn’t want to do duplicate work.
I’ve added some bounding box retrieval methods to my fork of tesseract-android-tools at https://github.com/rmtheis/tess-two.
If you end up implementing the JNI for additional features from Tesseract, it would be great if you’d consider contributing your code to the project.
I’ve added the wrapper, built it and put it in my Eclipse project, but it looks like a simple wrapper of the existing code is not enough. How did you debug errors in C++ like the one below? Is it likely to be a problem like removing STL code as I see in the comments for other functions? (Should I be doing this on Tesseract 3.0.1?)
I/DEBUG ( 1032): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 1032): Build fingerprint: 'lge/lge_star/p990_EUR-xx:2.3.4/GRJ22/lgp990-V20l.422C563E:user/release-keys'
I/DEBUG ( 1032): pid: 13611, tid: 13611 >>> adchange.fbk.eu <<<
I/DEBUG ( 1032): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
I/DEBUG ( 1032): r0 00000000 r1 00000000 r2 fffffff1 r3 00000031
I’m not sure there’s any STL in Tesseract that needs to be removed. I’ve gotten good (good, as in “it doesn’t blow up”) results without making modifications to the Tesseract code.
You can try to debug these segmentation faults using the debug tool that came with the NDK, but I only saw these errors when I tried to OCR an image in an unsupported format.
If you have problems in building, you might try this:
http://code.google.com/p/tesseract-android-tools/issues/detail?id=4#c16
the command:
> git clone git://github.com/android/platform_external_jpeg.git libjpeg
fails for me (in windows 7). My cmd throws the message:
error: cannot run index-pack: No such a file or directory
Something may be wrong with your local git installation–I’d try reinstalling git.
I get an error stating:
“tesseract-android-tools] Could not find tesseract-android-tools.apk!”
I have added the tesseract-android-tools project as a Library project in Eclipse and included it in the build path of the test project. When I try to run the test project, after installing the test project apk on the emulator, I get this error.
Console Output Log:
[2012-01-19 01:46:02 - AndroidOCR] ——————————
[2012-01-19 01:46:02 - AndroidOCR] Android Launch!
[2012-01-19 01:46:02 - AndroidOCR] adb is running normally.
[2012-01-19 01:46:02 - AndroidOCR] Performing android.ocr.Main activity launch
[2012-01-19 01:46:03 - AndroidOCR] Automatic Target Mode: using existing emulator ‘emulator-5554′ running compatible AVD ‘Test’
[2012-01-19 01:46:03 - AndroidOCR] Uploading tess-test.apk onto device ‘emulator-5554′
[2012-01-19 01:46:08 - AndroidOCR] Installing tess-test.apk…
[2012-01-19 01:46:25 - AndroidOCR] Success!
[2012-01-19 01:46:25 - tesseract-android-tools] Could not find tesseract-android-tools.apk!
Add the tesseract-android-tools project as a library project. Don’t manually add it to the build path.
dear rmt
i have followed step by step instructions from tesseract android tools’ readme file. until the “ndk-build” command it doesn’t work and the error message said “ndk-build: command not found”
please help me fix this thing
Add the NDK directory to your PATH.
i have a couple of questions
1. i have downloaded ndk r6b from this source :
http://www.facebook.com/l.php?u=http%3A%2F%2Fmingw-and-ndk.googlecode.com%2Ffiles%2Fandroid-ndk-r6b-gdb-7.3.50.20110709-binutils-2.22.51-linux-x86.7z&h=FAQHGuhekAQF3zcElEWN5m8i1gMfvRW9yQ0mrO_yqH1YRAg.
this file zipped as 7zip file
can i use this version of ndk
2. how do i add ndk to my PATH. is it just copy and paste NDK folder to project directory or by changing a command line that refers to some PATH?
Hi sir!!
why this is happening to me? Please i tried diffrent way but couldn’t got success in any case.. what could be the problem?
I got this Error while ndk-build
Install : libjpeg.so => libs/armeabi/libjpeg.so
make: *** No rule to make target `/home/funfil/external/rmtheis-esrect/tess-two/jni/com_googlecode_leptonica_android/../..//home/funfil/external/rmtheis-esrect/tess-two/jni/../external/leptonica-1.68/src/adaptmap.c’, needed by `/home/funfil/external/rmtheis-esrect/tess-two/obj/local/armeabi/objs/lept//home/funfil/external/rmtheis-esrect/tess-two/jni/../external/leptonica-1.68/src/adaptmap.o’. Stop.
I can’t reproduce this–I’m able to build the current version of the tess-two project successfully. Which NDK version and which SDK Tools version are you using? What operating system are you using?
Sir!!
m using ndk7 and sdkr16, and ubuntu 11.10..
hello,
can anyone provide me trained data from kannada language (kan.trainneddata file) or atleast tell me where i can find it..
Appreciate any help on that. Thanks in advance
Sir!!
With your gr8 tutorial i am able to compile and run the projects,,,,Thanx for all your efforts ..
Kindly, provide me the solution for digital Font detection,,,It is not recognizing.
Do you have any guidance for me so i can detect Digital Fonts ex–Like digital
numbers in calculator.
You’ll need to train Tesseract using your font: http://code.google.com/p/tesseract-ocr/wiki/TrainingTesseract3
i was trying to build the project using tess-two. it produces a error
nstall : libjpeg.so => libs/armeabi/libjpeg.so
make: *** No rule to make target `/home/funfil/external/rmtheis-esrect/tess-two/jni/com_googlecode_leptonica_android/../..//home/funfil/external/rmtheis-esrect/tess-two/jni/../external/leptonica-1.68/src/adaptmap.c’, needed by `/home/funfil/external/rmtheis-esrect/tess-two/obj/local/armeabi/objs/lept//home/funfil/external/rmtheis-esrect/tess-two/jni/../external/leptonica-1.68/src/adaptmap.o’. Stop.
when i build the project tesseract-tool and run the project then it will forced closed and error in logcat is
unsatisfied linked error: library lept not found…..
i am using ubuntu…..
please help me,
The unsatisfied link error is because the build was unsuccessful. It looks like the path is a little weird. How did you clone the project? Exactly what did you type?
when i build the project using tesseract-android-tool using ndk-build command then following error message shows
No rule to make target `/home/kashif/tesseract-android-tools/tesseract-android-tools//jni/../external/libjpeg/jidctfst.S’, needed by `/home/kashif/tesseract-android-tools/tesseract-android-tools//obj/local/armeabi/objs/jpeg/jidctfst.o’. Stop.
please help anyone…….
sir i download the project from the link you mention above
svn checkout http://tesseract-android-tools.googlecode.com/svn/trunk/ tesseract-android-tools
then i follow the step of readme open the project folder after setting the project path in ubuntu.
and simple type the commands
ndk-build
then it will display the error
No rule to make target `/home/kashif/tesseract-android-tools/tesseract-android-tools//jni/../external/libjpeg/jidctfst.S’, needed by `/home/kashif/tesseract-android-tools/tesseract-android-tools//obj/local/armeabi/objs/jpeg/jidctfst.o’. Stop.
and after i type the command android update project –path command and release ant
there is no error in the commands and sucessfully build the file….
after complete the all step application is forced closed and unsatisfied linked error.
i try the project tess-two
but it will also display an error when i type ndk-build command after all steps perform sucessfully.
i am totally stuck for a couple of week.
please help me what i do?????
Tell me what you typed so I can try to reproduce your build error for the tess-two project.
sir i am using ndk-r5b, and i only follow these steps to build the project.
git clone git://github.com/rmtheis/tess-two tess
cd tess/tess-two
ndk-build
android update project –path .
ant release
when i typed ndk-build command then it display error
make: *** No rule to make target `/home/kashif/tess/tess-two//jni/com_googlecode_leptonica_android/../..//home/kashif/tess/tess-two//jni/../external/leptonica-1.68/src/adaptmap.c’, needed by `/home/kashif/tess/tess-two//obj/local/armeabi/objs/lept//home/kashif/tess/tess-two//jni/../external/leptonica-1.68/src/adaptmap.o’. Stop.
NDK r7 is required.
hi
i’ve an issue:
my program failed at TessBaseAPI initializing
W/dalvikvm(11691): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/googlecode/tesseract/android/TessBaseAPI;
this is the error.
how can i solve it?
Is your project properly pointing to the library project?
sir, now i also try on NDK r7. and when i build tess-two then it will display this error
make: *** No rule to make target `/home/kashif/tess/tess-two/jni/com_googlecode_leptonica_android/../..//home/kashif/tess/tess-two/jni/../external/leptonica-1.68/src/adaptmap.c’, needed by `/home/kashif/tess/tess-two/obj/local/armeabi/objs/lept//home/kashif/tess/tess-two/jni/../external/leptonica-1.68/src/adaptmap.o’. Stop.
what i do????
now i try on NDK-r7 and using ubuntu linux operating system
Install : libjpeg.so => libs/armeabi/libjpeg.so
make: *** No rule to make target `/home/kashif/tess/tess-two/jni/com_googlecode_leptonica_android/../..//home/kashif/tess/tess-two/jni/../external/leptonica-1.68/src/adaptmap.c’, needed by `/home/kashif/tess/tess-two/obj/local/armeabi/objs/lept//home/kashif/tess/tess-two/jni/../external/leptonica-1.68/src/adaptmap.o’. Stop.
sir when i do command android update project –path
and ant release
then i will update the build.xml sucessfully…………
sir, i only stuck when i type ndk-build the it will display
Install : libjpeg.so => libs/armeabi/libjpeg.so
make: *** No rule to make target `/home/kashif/tess/tess-two/jni/com_googlecode_leptonica_android/../..//home/kashif/tess/tess-two/jni/../external/leptonica-1.68/src/adaptmap.c’, needed by `/home/kashif/tess/tess-two/obj/local/armeabi/objs/lept//home/kashif/tess/tess-two/jni/../external/leptonica-1.68/src/adaptmap.o’. Stop.
and when compile the project then its gives
unsatisfied linked error, and lept library not found
please help me
I can’t reproduce this on Ubuntu 11.04. Which version of Ubuntu are you using? Did you try building with NDK r7b?
i also follow the following link but i am useless efforts and not reached at end point
http://gaut.am/making-an-ocr-android-app-using-tesseract/
02-17 17:42:57.369: E/AndroidRuntime(330): FATAL EXCEPTION: main
02-17 17:42:57.369: E/AndroidRuntime(330): java.lang.ExceptionInInitializerError
02-17 17:42:57.369: E/AndroidRuntime(330): Caused by: java.lang.UnsatisfiedLinkError: Couldn’t load lept: findLibrary returned null
02-17 17:42:57.369: E/AndroidRuntime(330): java.lang.ExceptionInInitializerError
when i compile the project this is the error display in the logcat.
sir i am using 11.10 version is using and Android ndkr7 not r7b.
sir what i do???
now i again tess-two using android ndk-r7b….
same issue…..
make: *** No rule to make target `/home/kashif/tess/tess-two/jni/com_googlecode_leptonica_android/../..//home/kashif/tess/tess-two/jni/../external/leptonica-1.68/src/adaptmap.c’, needed by `/home/kashif/tess/tess-two/obj/local/armeabi/objs/lept//home/kashif/tess/tess-two/jni/../external/leptonica-1.68/src/adaptmap.o’. Stop.
i have build ndk r5b, ndk r7 and now ndkr7b, but problem is same.
make: *** No rule to make target `/home/kashif/tess/tess-two/jni/com_googlecode_leptonica_android/../..//home/kashif/tess/tess-two/jni/../external/leptonica-1.68/src/adaptmap.c’, needed by `/home/kashif/tess/tess-two/obj/local/armeabi/objs/lept//home/kashif/tess/tess-two/jni/../external/leptonica-1.68/src/adaptmap.o’. Stop.
please help me out.
sir this is kernal issue how can i resolve, can you help me ????
A kernel issue? I’m able to build on a VM running Ubuntu 11.04–why don’t you try that.
I don’t have time to try to reproduce this issue and debug on Ubuntu 11.10 right now.
Thank you rmt sir, i sucessfully build app using ubuntu 11.04 and android Android ndk-r7.
Thanks a lot again.
baseApi.setImage(myImage);…i am getting error on argument myImage….please help me….
Can you be more specific? What error message did you see in LogCat?
I have successfully done all the steps…when i have create a new project on eclipse and add tess-two as a library project…on my new project onCreate() method….i paste this code:
File myDir = getExternalFilesDir(Environment.MEDIA_MOUNTED);
2
3 TessBaseAPI baseApi = new TessBaseAPI();
4 baseApi.init(myDir.toString(), “eng”); // myDir + “/tessdata/eng.traineddata” must be present
5 baseApi.setImage(myImage);
6
7 String recognizedText = baseApi.getUTF8Text(); // Log or otherwise display this string…
8 baseApi.end();
and i got error at line 5…myImage not found…???
plz help me…
Look at the documentation. You have to pass an image as the myImage parameter.
I’ve been looking into getting a live camera preview working in the Android emulator. Currently the Android emulator just gives a black and white chess board animation. ..plz help me ?
I don’t have experience with this. Try asking your question on Stack Overflow.
when clicking on camera in android emulator….an error message occurs “unfortunately camera stop working”….help me??/
What do you mean? The camera button? What were you doing before you clicked on it?
Good day Sir,
Currently, i am doing my Final Year Project. My question is : How can i export the resulting text for another purpose? For example, i wanna use the resulting text to search in my server’s database. What function do i need to satisfy that?
Newbie.
The OCR quality can be poor, especially with bad lighting conditions, so you may want to do some data validation before searching a database, but the OCR result is a String so you can pretty much do whatever with it.
Sir, do you have any suggestion website for me to refer to starting compiling in Linux VM, because i tried to research before, but cant find. I need no start compiling this source code from scratch. Really need your attention and help.
https://www.virtualbox.org/
how to install eclipse, ndk, etc on Linux VM (Oracle VM)? Do you have any reference regarding this? why cant just sompile it in window 7? I need your help. Greetings.
Try it on Windows using NDK r7b–I’m not sure if you can compile it on Windows.
http://rmtheis.wordpress.com/2011/06/02/setting-up-a-virtualbox-ubuntu-development-environment/
i have installed already NDK r6b before. i want to install NDK r7b, can i just download NDK r7b and install it? or it will overlapped the NDK r6b? Or can i just update from NDK r6b?
You can install the new NDK and add it to your Path (and you should remove the old NDK from your Path to avoid a conflict).
hi i’m getting error at this step
adb shell am instrument -w -e package com.googlecode.tesseract.android.test \
com.googlecode.tesseract.android.test/android.test.InstrumentationTestRunner
Errors :2
Error in testGetUTF8Text
Error in testSetImage
Please help me
Did the project build successfully? I’m not sure how up to date the test cases are–you’ll need to track down the problem yourself on this.
aminalzanki@aminalzanki-VirtualBox:~/rmtheis-tess-two-071820a/tess-two$ /home/aminalzanki/android-sdk-linux/tools/
bash: /home/aminalzanki/android-sdk-linux/tools/: Is a directory
aminalzanki@aminalzanki-VirtualBox:~/rmtheis-tess-two-071820a/tess-two$ ant release
Buildfile: build.xml
BUILD FAILED
/home/aminalzanki/rmtheis-tess-two-071820a/tess-two/build.xml:7: Source resource does not exist: /home/aminalzanki/rmtheis-tess-two-071820a/tess-two/local.properties
Total time: 0 seconds
aminalzanki@aminalzanki-VirtualBox:~/rmtheis-tess-two-071820a/tess-two$
what should i do sir?
I don’t know–you need to give more information. Are you trying to compile tess-two? Have you seen the instructions? What did you type before this? What OS, SDK, and NDK version are you using?
Hi, thanks for your sharing.
I have a problem.
How do you implement whitelist function?
Could you give me some point or code?
Thanks again.
Like this:
baseApi.setVariable(TessBaseAPI.VAR_CHAR_WHITELIST, “0123456789.-”);
There’s an example here:
https://github.com/rmtheis/android-ocr/blob/master/android/src/edu/sfsu/cs/orange/ocr/CaptureActivity.java
Sir,
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/googlecode/leptonica/android/AdaptiveMap;
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at com.android.dx.command.dexer.Main.processClass(Main.java:486)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at com.android.dx.command.dexer.Main.access$400(Main.java:67)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at com.android.dx.command.dexer.Main.processOne(Main.java:418)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at com.android.dx.command.dexer.Main.run(Main.java:206)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at java.lang.reflect.Method.invoke(Method.java:616)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:179)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:745)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:634)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at org.eclipse.core.internal.resources.Project.build(Project.java:124)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at com.android.ide.eclipse.adt.internal.project.ProjectHelper.doFullIncrementalDebugBuild(ProjectHelper.java:961)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:146)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:854)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:937)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1141)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Dx 1 error; aborting
[2012-04-02 21:48:19 - com_googlecode_tesseract_android] Conversion to Dalvik format failed with error 1
see the last message. Conversion to Dalvik format failed with error 1. Help me !!
Thanks, Robert. One thing– is it possible to get the latest source version (0.5.11)? I grabbed and built the version you have on github and it was 0.5.10, but the latest in the Android Market Place is 0.5.11. Thanks.
Sure–done.
Hi,
After update tess-two to tesseract 3.02 and rebuild I have error like below in my app:
06-02 01:13:36.220: D/dalvikvm(4897): Trying to load lib /data/data/com.ocr/lib/liblept.so 0x40d823a0
06-02 01:13:36.220: D/dalvikvm(4897): Added shared lib /data/data/com.ocr/lib/liblept.so 0x40d823a0
06-02 01:13:36.220: D/dalvikvm(4897): Trying to load lib /data/data/com.ocr/lib/libtess.so 0x40d823a0
06-02 01:13:36.255: D/dalvikvm(4897): Added shared lib /data/data/com.ocr/lib/libtess.so 0x40d823a0
06-02 01:13:36.465: I/Tesseract(native)(4897): Initialized Tesseract API with language=eng
06-02 01:13:36.490: D/dalvikvm(4897): Trying to load lib /data/data/com.ocr/lib/liblept.so 0x40d823a0
06-02 01:13:36.490: D/dalvikvm(4897): Shared lib ‘/data/data/com.ocr/lib/liblept.so’ already loaded in same CL 0x40d823a0
06-02 01:13:36.495: D/dalvikvm(4897): Trying to load lib /data/data/com.ocr/lib/liblept.so 0x40d823a0
06-02 01:13:36.495: D/dalvikvm(4897): Shared lib ‘/data/data/com.ocr/lib/liblept.so’ already loaded in same CL 0x40d823a0
06-02 01:13:36.625: A/libc(4897): Fatal signal 11 (SIGSEGV) at 0×00000000 (code=1)
what can be the problem?
I don’t know offhand. Did it crash at baseApi.init()?
Some more debug info:
06-02 10:55:06.145: I/OCR(6478): Last line: 5168. 31.05.2012 5,29,32,33,38,41
06-02 10:55:25.385: D/dalvikvm(6478): Trying to load lib /data/data/com.ocr/lib/liblept.so 0x40d83ec8
06-02 10:55:25.390: D/dalvikvm(6478): Added shared lib /data/data/com.ocr/lib/liblept.so 0x40d83ec8
06-02 10:55:25.390: D/dalvikvm(6478): Trying to load lib /data/data/com.ocr/lib/libtess.so 0x40d83ec8
06-02 10:55:25.440: D/dalvikvm(6478): Added shared lib /data/data/com.ocr/lib/libtess.so 0x40d83ec8
06-02 10:55:25.440: I/OCR(6478): TessBaseAPI instace
06-02 10:55:25.635: I/Tesseract(native)(6478): Initialized Tesseract API with language=eng
06-02 10:55:25.635: I/OCR(6478): baseApi after init
06-02 10:55:25.670: I/OCR(6478): baseApi set image
06-02 10:55:25.675: D/dalvikvm(6478): Trying to load lib /data/data/com.ocr/lib/liblept.so 0x40d83ec8
06-02 10:55:25.675: D/dalvikvm(6478): Shared lib ‘/data/data/com.ocr/lib/liblept.so’ already loaded in same CL 0x40d83ec8
06-02 10:55:25.685: D/dalvikvm(6478): Trying to load lib /data/data/com.ocr/lib/liblept.so 0x40d83ec8
06-02 10:55:25.685: D/dalvikvm(6478): Shared lib ‘/data/data/com.ocr/lib/liblept.so’ already loaded in same CL 0x40d83ec8
06-02 10:55:25.685: I/OCR(6478): baseApi getUTF8Text
06-02 10:55:25.825: A/libc(6478): Fatal signal 11 (SIGSEGV) at 0×00000000 (code=1)
So its looks like it crashes on getUTF8Text :/
Is your image formatted as ARGB_8888?
// Convert to ARGB_8888, required by tess
bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
I have this so it is.
The same image worked with 3.01.
Do other images work properly? For example, do the test cases pass?
OK. Some images works and some doesnt :/
There is no exception I cant catch it :/ I havent this before.
Maybe this depend on resolution of image?
If you think it’s a memory problem, try running it on an emulator with a large amount of RAM defined.
My device is Galaxy S2 so can RAM be a problem?
some more debug from logcat http://pastebin.com/75BxyBTP
When I took image from device to emulator it works
Well, if it works on the emulator, then it’s not a problem with the library project, so you can rule that out. Unfortunately the log information from the SIGSEGV is not really helpful, so you have to use trial and error to find the source of the problem.
Can you post a link to the image?
Link to image:
http://imageshack.us/photo/my-images/525/croppedp.jpg/