1. Download tesseract library for android https://github.com/rmtheis/tess-two/downloads. Download as .zip for
windows, as .tar.gz for linux user.
2. Software requirement
- Eclipse
- Java JDK
- Android SDK
- Android NDK
- Cygwin ( for windows users)
- Apache-ant
3. For windows user, make sure you already installed cygwin ( you can download it and install it from http://www.cygwin.com/ make sure during the cygwin installation, install also these source and library gcc-core, gcc-g++, make, swig)
4. Download apache-ant from http://ant.apache.org/bindownload.cgi choose .zip for windows, .tar.bz for linux user.
5. Unzip the apache and set the environment variable (mine is C:\apache-ant-1.8.3\bin)
6. Run cygwin (for windows user only,for linux user,run terminal)
a.cd <project-directory>/tess-two
b.export TESSERACT_PATH=${PWD}/external/tesseract-3.01
c.export LEPTONICA_PATH=${PWD}/external/leptonica-1.68
d.export LIBJPEG_PATH=${PWD}/external/libjpeg
e.ndk-build(for windows user, /cygdrive/<ndk-directory>/ndk-build)
f. android update project --path . (for windows user, sometime cygwin cannot execute this command, so
use command prompt to execute this command).
Note: The “.” after --path must be included in the command.
g. ant release ( sometimes you will get error like java tools.jar not found, set environment variable
JAVA_HOME to the jdk folder, mine is C:\Program Files\Java\jdk1.7.0)
7. Run Eclipse. Right click on package explorer, import>> General >> Existing Project into Workspace >>
Next >> Select Root Directory >> Browse the tess-two folder location >> Finish.
You will see tess-two folder in your package explorer.
8. Right click on the project >> Android Tools >> Fix Project Properties. Right click >> Properties >>
Android >> Check Is Library.
Download the simple OCR android app from https://github.com/GautamGupta/Simple-Android-OCR.
Right click on package explorer, import the simple OCR android app folder.
9. Right click on the project >> Android >> Add >> click tess-two >> OK
10. Run the app. Good luck
References
[1] http://gaut.am/making-an-ocr-android-app-using-tesseract/
[2] http://ant.apache.org/bindownload.cgi
[3] http://wolfpaulus.com/journal/android-and-ocr
[4] http://rmtheis.wordpress.com/2011/08/06/using-tesseract-tools-for-android-to-create-a-basic-ocr-app/
[5] https://github.com/rmtheis/tess-two




+1
ReplyDeleteyou can download tess-two library by clicking tot this link
ReplyDeletehttp://www.4shared.com/folder/SinVRg1O/_online.html
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteunzip the one http://www.4shared.com/folder/SinVRg1O/_online.html
ReplyDelete-using msdos, cd to the extracted tess-two folder then type "/android-sdk-windows/tools/android update project --path . "
-create new Environment (computer -> properties->advance) for JAVA_HOME, value: C:\Program Files\Java\jdk1.7.0, ANT_HOME value: C:\apache-ant-1.8.4, PATH, value:;C:\Program Files\Java\jdk1.7.0\bin; C:\apache-ant-1.8.4\bin
-then on cygwin, cd the tess-two then type " ant release "
-sometime the environment does not update without restarting ur pc
-then follow the upper example starting from no 7.
usually android-sdk-windows folder in C, so, after cd to tess-two folder, if using command prompt,type "C:\android-sdk-windows\tools\android update project --path ." or "/cygdrive/c/android-sdk-windows/tools/android update project --path ." if using cygwin. you can try either one.
ReplyDeletehow can i use other language?
ReplyDeleteI haven't try other language yet.. but this link might be useful for you http://vannait.blogspot.com/2009/06/how-to-train-tesseract-ocr.html
ReplyDeletecan you make video for this tutorial sorry but i'm beginner with android
ReplyDeleteLater we will provide the video for you
ReplyDelete___________________________________________________________________
Wanna go job online? Learn how to make money by doing online job as survey taker..
http://mellore107.daywealth.hop.clickbank.net/
Thanks for sharing!
ReplyDeleteGood accurate post..
ReplyDeletei'm widnows use and i'm getting this error at step 6,e
ReplyDeleteE:/adt-bundle-windows-x86_64/android-ndk-r8d/ndk-build
SharedLibrary : liblept.so
E:/adt-bundle-windows-x86_64/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: error: cannot open ./obj/local/armeabi/libgnustl_static.a: Permission denied
collect2: ld returned 1 exit status
/cygdrive/e/adt-bundle-windows-x86_64/android-ndk-r8d/build/core/build-binary.mk:397: recipe for target `obj/local/armeabi/liblept.so' failed
make: *** [obj/local/armeabi/liblept.so] Error 1
Hi Firas, here I found some post about permission denied at libgnustl_static.a. Check this http://stackoverflow.com/questions/12469711/building-tesseract-with-android-ndk
ReplyDeletewould you tell me whats this command for ??
ReplyDeletechmod 777 obj/local/armeabi/libgnustl_static.a
I don't know how to thank you for your thread and you quick response :-)
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHi firas, chmod =sets permissions for a file eg: read, write, execute for the owner (you) and guests (any one who views the file...this includes programs). 777 means anyone can do anything with the file. If the suggestion does not work, try chmod -R 777 /cygdrive/(eclipse workspace folder)
ReplyDeleteI found it at http://stackoverflow.com/questions/11551742/ndk-build-error-with-cygwin
building tesseract library with ndk a bit tiring, you can just download the already built library at http://www.4shared.com/folder/SinVRg1O/_online.html then follow the suggestion did by wany (see the earlier comments).
ReplyDeletethank you very much, I did it with chmod -R 777 /cygdrive/(eclipse workspace folder) and chmod -R 777 file without permission.
ReplyDeletenow my engine work perfectly,
do you know how to add continuous mode or crop the image to let the user choose the text from the image ??
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
Deletei dont know how do the step 6 i'm not aware of cygwin could u please help me
ReplyDeleteHi Rex,
ReplyDeleteIf you use windows, you should install cygwin to do step 6.
Then run cygwin and just write the command as in step 6 for example, for 6 a,cd /tess-two, in my case, my workspace is in D:\workspace\opencv\tess-two , so the command that i should write will be cd /cygdrive/d/workspace/opencv/tess-two . Hope this can help
i dont know why but when my application runs i run the camera take the picture and when i save it my application crashes saying that the application stopped unexpectedly! any reasons in mind why??
ReplyDeleteand oh yea when i ran the logcat on eclipse i could see something like could not find class 'com.googlecode.tesseract.android.TessBaseAPI' referenced from method com.datumdroid.android.ocr.simple.SimpleAndroidOCRActicity.picturetaken'. Just to help you know the problem specifics! :)
ReplyDeleteWhy sometimes the recognized text is a bunch of random characters? I get this result even if there is no character in the picture.
ReplyDeleteThe OCR tutorial in this blog is quite simple and sometimes unstable. Follow this tutorial for more stable http://gaut.am/making-an-ocr-android-app-using-tesseract/
ReplyDeleteThank you! But what is the difference between these two tutorials?
DeleteThis comment has been removed by the author.
ReplyDeletecan you send us video tutorial? i have done all the steps but the ocr app shows 'force close' message
ReplyDeletei made them in windows 7
ReplyDeletePlease make a video on you tube !
ReplyDeleteYup it is working for me... thanks kurup ;)
ReplyDeletei have and error when building the ndk, this is the error: jni/../external/libjpeg/jidctfst.S: Assembler messages:
ReplyDeletejni/../external/libjpeg/jidctfst.S:66: Error: missing ')'
jni/../external/libjpeg/jidctfst.S:66: Error: garbage following instruction -- ` pld (r2,#0)'
jni/../external/libjpeg/jidctfst.S:259: Error: missing ')'
jni/../external/libjpeg/jidctfst.S:259: Error: garbage following instruction -- `pld (sp,#32)'
jni/../external/libjpeg/jidctfst.S:271: Error: missing ')'
jni/../external/libjpeg/jidctfst.S:271: Error: garbage following instruction -- `pld (ip,#32)'
/cygdrive/d/Programming/Programs/android/android-ndk-r8d/build/core/build-binary .mk:267: recipe for target `obj/local/armeabi/objs/jpeg/jidctfst.o' failed
make: *** [obj/local/armeabi/objs/jpeg/jidctfst.o] Error 1
i already checked this file and didn't find that missing ')'
can any one help ?
i'm windows use,too
ReplyDeleteand i'm getting this error at step 6,f
cygwin cannot execute command "android update projrct --path ."
here's what i got [-bash: android:Command can not find]
so I use command prompt to execute same command above, and I got " 'android' is not internal or external command, operable program or batch file"
did i make any mistakes about commands?
Oh! Finally! I got it!!
Deletebut now I have a new error to be solved..
after I execute "android update projrct --path ."
I got
Error: Expected verb after global parameters but found 'projrct' instead.
I also not sure about this.. but maybe because you misspell "project" with "projrct" in the command.. maybe..
DeleteI cant believe I make such mistake...
DeleteTHANNNNK you!!!!
still a little question : why do I need to download Apache-ant, what is it for?
$ /cygdrive/c/adt-bundle-windows-x86_64-20130219/adt-bundle-windows-x86_64-20130219/sdk/tools/android.bat update project --path .
ReplyDeleteError: The project either has no target set or the target is invalid.
Please provide a --target to the 'android.bat update' command.
I am not sure hot to set target
any help
/cygdrive/c/adt-bundle-windows-x86_64-20130219/adt-bundle-windows-x86_64-20130219/sdk/tools/android.bat update project -p . --target android-17
Deleteworked
hi .. i am stuck on the 6th step.. in the ndk-build part i am getting the following error
ReplyDeleteManish@Kadaba-PC /cygdrive/c/Users/Manish/Downloads/tess-two-master
$ /cygdrive/C:\android-ndk-r8d/ndk-build
-bash: /cygdrive/C:android-ndk-r8d/ndk-build: No such file or directory
Manish@Kadaba-PC /cygdrive/c/Users/Manish/Downloads/tess-two-master
$ /cygdrive/C:/android-ndk-r8d/ndk-build
-bash: /cygdrive/C:/android-ndk-r8d/ndk-build: No such file or directory
someone please help me out here...thank you
Hi Manish.
ReplyDeleteTry this:-
Instead using /cygdrive/C:\android-ndk-r8d/ndk-build, try this way
/cygdrive/c/android-ndk-r8d/ndk-build
hope it will works :)
hey kurup one question
Deletewill it recognise power functions and other math expressions like +,-,= etc ??
=============================================
ReplyDeleteNicky Valiant@Nicx-7 /cygdrive/c/android/android-ndk-r8e
$ cd /cygdrive/c/android/android-ndk-r8e/
Nicky Valiant@Nicx-7 /cygdrive/c/android/android-ndk-r8e
$ ndk-build
-bash: ndk-build: command not found
====================OR==========================
Nicky Valiant@Nicx-7 /cygdrive/c/android/android-ndk-r8e
$ cd /cygdrive/c/android/android-ndk-r8e/ndk-build
-bash: cd: /cygdrive/c/android/android-ndk-r8e/ndk-build: Not a directory
==============================================
my problem is same as Manish...at 6,e....
I am downloading NDK build now, heavy download, meanwhile could I get an apk of this project? Not the source, the apk file. :)
ReplyDeleteafter scanning with ocr, i want to save the ocr text into a .txt or .png file for other purpose. how to do that?
ReplyDeleteThanks for the tutorial. Anyway, why do you need cygwin to build the project? In the official site of tess-two, they only need Android NDK.
ReplyDeleteThis comment has been removed by the author.
DeleteOk. Finally, I can build it (Anyway, I did not use the cygwin terminal). So, which part I can use to import to my project? Do i need to include the whole project?
DeleteThanks a lot, it is working, but does not recognize the characters, my intention is to read characters in a lottery ticket, how can I improve it?
ReplyDelete