Tuesday, March 18, 2014

Making Android OCR app using tess-two v3.03 library Without ndk, ant, cygwin and setting environment variables..

In this post, I will show you how to make an android app that will recognize text from an image using the tess-two library.

You will not need to download android ndk, cygwin and ant. You will also not need to set environment variables.

Requirements:

  1. Eclipse or any other IDE that has been configured for android development.
You will not need android ndk to build the tess-two library because I have already done that for you.

Step 1.
Download the pre-built tess-two library as .7za here and extract the tess-two folder to any location. NB/ Do not extract into your workspace!!!!!

Step 2.
Download Simple-Android-OCR-master project from  here and extract to the same location as the tess-two library.

Step 3.
Import the two projects into the eclipse workspace as shown below.
go to File>Import>Existing android code into workspace>Root Folder: Browse. Select the folder that contains the two projects.

Check the two projects and also check Copy projects into workspace.
You may encounter errors in-case you extracted them in you workspace.

Click Finish.


At this time, you should be able to run the  Simple-Android-OCR-master project.In case you have errors, don’t panic.continue reading.

You can import each project at a time in case you had extracted in different locations.


Step 4. Mark the tess-two project as a library if its not marked already.
Right click>properties>Android>Check is library.




Step 5. Reference the tess-two project in the other project.
Right click project >Properties>Android>Add, select tess-two.



At this time, all errors should have disappeared and you should be able to run Simple-Android-OCR-master project and test the app on a device with a camera.


I will write another tutorial very soon on how to improve the output. Feel free to leave a comment.
Refference
android-ocr-tutorial-image-to-text

119 comments:

  1. Thanks a hell lot brother. You saved my life! Looking forward to more such tutorials from you that make life easier for us novice programmers.
    One question - how do I improve on the recognition?

    ReplyDelete
    Replies
    1. Thanks. Please recommend this blog on Google +. About your issue, am researching on that, if i find a solution i will definitely share here.

      Delete
    2. https://github.com/rmtheis/android-ocr

      try this project it's more power full then Simple-Android-OCR-master project

      but remember use tess-two library that provided by over master mind Francis Solomon

      Delete
    3. hello Shaurya sen....How can you success to this project? cna you help me?

      Delete
    4. sir kindly make its video tutorial. I shall be thankful of you.
      please please please please

      Delete
  2. hi Francis, i am new user to android, honestly i started today itself, and facing some problems in step 4. its showing something like " could not accept changes". i know it would be appearing kinda silly to you but can you help me out. i will be grateful.

    ReplyDelete
    Replies
    1. Check if the tess-two project is already added but marked "x " in red. If that so, first remove it and make sure you have nothing then add again.

      Delete
    2. Could you make a screen shot and send to me on whatsapp or facebook? my whatsapp is +254732382597 facebook email is email2mefrancis@gmail.com

      Delete
  3. Solo went through that work, it is great bro. Thank you for expanding open source concepts

    ReplyDelete
  4. Thanks a lot bro this is amazing blog for me it works 110% for me

    After Making long google search of one month i found your blog that helps me using tess-two library..


    i am not able to generate tess-two's .SO file and your library provides pre-build .SO file that enables me to run my project

    https://github.com/rmtheis/android-ocr

    Which is more accurate then the

    Simple-Android-OCR-master project


    Thanks Again Bro...

    Keep Continue with this nice and lovely Blog..

    ReplyDelete
    Replies
    1. Sony for not replying earlier. I haven’t come up with a way to get accurate results. but there are lot of suggestions like, image cropping.Once I get time to experiment, I will post the results in another blog.Thanks

      Delete
    2. try this it gives accurate results

      APK : https://play.google.com/store/apps/details?id=edu.sfsu.cs.orange.ocr


      SOURCE CODE : https://github.com/rmtheis/android-ocr


      try and give me reply how it is ....

      Delete
    3. This comment has been removed by the author.

      Delete
  5. hi guys This tessaract Eg read single Line Text Image, what About multiple ?

    ReplyDelete
  6. Thank you , For This Example !!!!!!

    ReplyDelete
  7. Great job, but i have a problem when in my phone, a force close, any have a idea?

    ReplyDelete
  8. In the project import window i could not see the downloaded tess-two.7za file. I only see simple-android-OCR_master file, why is that? Do i need to do something with that .7za file?

    ReplyDelete
    Replies
    1. I confirmed that the download is still active

      Delete
  9. This comment has been removed by the author.

    ReplyDelete
  10. Thank you for your help in this page :)
    Btw, if I want to extract words in Chinese, how can I do?

    ReplyDelete
  11. One more question
    Result seems not accurate, how can I fix it?

    ReplyDelete
  12. Thank you for your help in this page!
    I'm Korean, so I cannot english well. sorry!
    After picture, press confirm -> app automatically off
    Please give me help..
    Thank you!

    ReplyDelete
  13. Hi Francis Solomon , thank you so much for this nice blog and I hope to provide us with such easy examples about many android implementations .

    I have a problem when I want to start running Simple-Android-OCR-master , everything is fine and no error at all but when I start to run Simple-Android-OCR-master it doesn't run and the console show this message:
    [2014-07-17 14:04:58 - Simple-Android-OCR] Dx 1 error; aborting
    [2014-07-17 14:04:58 - Simple-Android-OCR] Conversion to Dalvik format failed with error 1
    ----------------------------
    I made my own application and tried to use the TessBaseAPI but it tells that "cannot find tess-two.apk!!" , also tells me "cannot find TessBaseAPI"

    please help me, thank you.

    ReplyDelete
    Replies
    1. I have the same problem, could you help us please Francis Solomon? Thanks!

      Delete
    2. i was helping a friend who had the same problem and the issue was that he was using the tess-two project which he had extracted from the Tess-two-master.zip.you need to use the tess-two project i have provided here and NOT just any other tess-two project.

      Delete
    3. Sir francis, is this applicable in windows? can you do for that? thank you

      Delete
  14. good day. I would just like to ask if the simple OCR android app that you have provided here can read any type of fonts like : times new roman, calibri, comic sans, etc.? I was able to run the application but sometimes the results are not accurate. Letter "B" sometimes become letter "O". If it does read any type of font, I am thinking that I may have gone wrong at some points or I might be lacking something to make it work perfectly. I am new to android programming but I am really interested to learn.. please help me.

    ReplyDelete
  15. please to reupload tess-two.7za
    because tess-two file in dropbox it was deleted or moved. thanks

    ReplyDelete
  16. The file you're looking for has been moved or deleted.

    ReplyDelete
  17. i have added the tess-two library again on dropbox

    ReplyDelete
  18. I am making ocr app in android i want sample code for taking picture from or loading from gallery and correcting its perspective (Perspective Correction) Work done in this app https://play.google.com/store/apps/details?id=com.cyberlink.yousnap&hl=en

    http://1.bp.blogspot.com/-ro9hniPj52E/TkoM0kTlEnI/AAAAAAAAAbQ/c2R5VrgmC_w/s640/s4.jpg I will be very much thank full for your help. :)

    ReplyDelete
  19. This comment has been removed by the author.

    ReplyDelete
  20. By following your nicely written Instructions I am getting an error:
    Error:Execution failed for task ':tesstwo:compileReleaseNdk'.
    > com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    /Developer/android-ndk-r7c/ndk-build NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/myName/AndroidStudioProjects/Simple-Android-OCR-master-2/tesstwo/build/intermediates/ndk/release/Android.mk APP_PLATFORM=android-10 NDK_OUT=/Users/myName/AndroidStudioProjects/Simple-Android-OCR-master-2/tesstwo/build/intermediates/ndk/release/obj NDK_LIBS_OUT=/Users/myName/AndroidStudioProjects/Simple-Android-OCR-master-2/tesstwo/build/intermediates/ndk/release/lib APP_ABI=all
    Error Code:
    2
    Output:
    make: *** No rule to make target `/Users/myName/AndroidStudioProjects/Simple-Android-OCR-master-2/tesstwo/build/intermediates/ndk/release//Users/myName/AndroidStudioProjects/Simple-Android-OCR-master-2/tesstwo/src/main/jni/com_googlecode_leptonica_android/box.cpp', needed by `/Users/myName/AndroidStudioProjects/Simple-Android-OCR-master-2/tesstwo/build/intermediates/ndk/release/obj/local/armeabi/objs/tesstwo//Users/myName/AndroidStudioProjects/Simple-Android-OCR-master-2/tesstwo/src/main/jni/com_googlecode_leptonica_android/box.o'. Stop.
    I am coding on a mac with Android Studio, th ndk r7c is working best (various errors with r10d).

    ReplyDelete
  21. Hey anyone suggest me, how can I implement in Simple-Android-OCR project for multiple languages?

    ReplyDelete
  22. how can i open the OCR on android studio

    ReplyDelete
  23. If you could post some details on how to import the projects on Android studio and avoid errors with gradle etc it would be awesome :)

    ReplyDelete
  24. i need a little more help..How to recognize special characters from ocr??

    ReplyDelete
    Replies
    1. You need to train tesseract.
      check this link. [ https://peepswrite.wordpress.com/2013/05/26/training-tesseract-3-02/ ]

      Delete
  25. my app shows random ocrED text even on blank images

    ReplyDelete
  26. Thanks a lot Francis.Now i need to replace the english trained data file with my own trained data file.i have completed training.now how can i replace it?

    ReplyDelete
  27. This comment has been removed by the author.

    ReplyDelete
  28. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. This comment has been removed by the author.

      Delete
  29. For ANDROID STUDIO developers, here's what I did on my Windows 8.1 machine.

    --PART 1--

    1) Download and install the ndk from here https://developer.android.com/tools/sdk/ndk/index.html. I had some trouble with its path in following steps so i put it in "C:\".

    2) Add that path to environment variables of the system (eg: "C:\android_ndk_r10d") and then reboot so your machine can find it.

    3) Download "tess-two-master" from here https://github.com/rmtheis/tess-two, extract it (for example in "C:\") and rename it in "tess".

    4) Open "tess" folder and then open "tess-two" folder. Click on a blank space while pressing the shift button and select "Open command window here".

    5) Write "ndk-build" and wait until it completes (about 20min).

    6) Go back in the parent folder, select "eyes-two" folder and again click on a blank space while pressing the shift button in order to open the command window.

    7) Write "ndk-build" and wait.

    8) Write "android update project --target 1 --path C:\tess\tess-two". Of course I assume your "tess" folder is located in "C:\"

    9) Write "ant release". IF IT COMPLAINS go where you change your system environment variables as you did in step 2 and ADD a new variable with name "JAVA_HOME" and value the path to your jdk (eg: "C:\Program Files\Java\jdk1.8.0_40")

    ReplyDelete
    Replies
    1. Hi, i have a problem when i run "android update project --target 1 --path C:\tess\tess-two", this is the error "android update project --target 1 --path C:\tess\tess-two". Can you help me?

      Delete
    2. When i type the "android update project --target 1 --path C:\tess\tess-two" command at start i get some errors but in the end it says that some files where indeed update. Is that how its supposed to work?

      Also even though i added the JAVA_HOME variable as you explain i still cant get "ant release" to work.

      I am looking desperately for some help if you could so kind. You will save me from so much trouble.

      Thanks in advance.

      Delete
    3. I'm sorry but I don't know very much how Tesseract works. All I can suggest is to reboot your machine after adding JAVA_HOME variable but I'm pretty sure you have already done this :/
      Anyway at first ignore errors if you can still reach the end of the execution. I remember somewhere I had errors too but in the end everything worked correctly. Good luck!

      Delete
    4. Hey, first of all thanks a lot for your response, i was away for a couple of days and i just saw it.

      I did try out both parts you have posted despite of the errors and everything seems to be working until i press the "check" in order to OCR my pic. If you faced the same mistake please share any info :)

      Either way i'll try to configure some stuff around and run it again today and hope for the best.

      If you have any info related to my reply it would really appreciated if you could share it.

      Again, thanks in advance.

      Delete
    5. Oh, when i said everything works until OCR-ing the image i meant that the app crashes and you need to restart it. Just to clarify :)

      Delete
    6. I'm glad to help don't worry^^ This because I faced so much pain by trying to figure out how to get it work..
      Well, if you can execute every instruction on your command prompt, you probably have successfully intall it on your machine. If you can also correctly build your source code, I guess you are still on the right way. For errors on execution (such crashes) it is probably just a simple issue of your code: by googling your Logcat output or checking the available source code of this post everything you should work.

      Delete
    7. Hello once again,
      i did try your guide step by step extremely carefully and i never moved on the next step unless i had no problems or errors on the previous one.
      Right now everything looks good in android studio since i have 0 errors but when i run the app on my phone everything works fine until i press the "check" to OCR the image (as mentioned in a previous post).
      I get 0 Logcat or Run errors but still no results :( .

      I would really appreciate if you have any heads up to share or any update and if you could possibly share a picture with how does the app look like after successfully OCR-ing an image.

      I know i might be asking too much but from all the tutorials i have ran through, your tutorial has helped me a lot.

      Once again, thanks in advance.

      Delete
    8. Do you have in your code these following lines?

      Bitmap bitmap = *get a bitmap of your image*;
      bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
      TessBaseAPI baseApi = new TessBaseAPI();
      baseApi.setDebug(true);
      baseApi.init(DATA_PATH, lang);
      baseApi.setImage(bitmap);
      String recognizedText = baseApi.getUTF8Text();
      baseApi.end();
      Log.v("Check", "OCRED TEXT: " + recognizedText);

      NOTE:
      1) DATA_PATH is defined like this:
      public static final String DATA_PATH = Environment.getExternalStorageDirectory().toString() + "/YourAppName/";

      2) "lang" is a string representing your tess language (eg: String lang = "eng")

      3) "bitmap" is the input bitmap image

      4) If you have no error with the third line it means that you installed tesseract successfully and that it is just a problem in your code. Be sure to have your bitmap not rotated.

      5) Check what Log is reporting with his recognizedText string

      Delete
    9. PS: Check this out (the complete code):

      https://github.com/GautamGupta/Simple-Android-OCR

      And in particular this, where I found those lines:

      https://github.com/GautamGupta/Simple-Android-OCR/blob/master/src/com/datumdroid/android/ocr/simple/SimpleAndroidOCRActivity.java

      Delete
    10. This comment has been removed by the author.

      Delete
    11. This comment has been removed by the author.

      Delete
    12. Removed both detailed problem info because i finally made it work :D
      It was a small uppercase error in settings.gradle (which didnt even show as warning and i had to almost zoom my face in the screen to see it :P).

      The only "issue" im trying to deal with atm is the fact that words are not recognized really accurate so if you have any thoughts to share on this i'd glad to test them.

      Thanks for your help so far, im really happy it finally works for me too :)

      Delete
    13. I'm glad to be helpful :D
      Yeah, recognition is not really accurate with standard sets... I can suggest to train tessdata by yourself, as I did (pain is never ending:) ). For more info you can read here
      http://www.resolveradiologic.com/blog/2013/01/15/training-tesseract/

      Please, in case be sure to enumerate your file in the right order, without skip any numer with files "tla.test_font.exp0.tif" (ie: 0,2,3,5 is wrong but 0,2,3,3 is correct, I had hard long times to figure it out).

      Again, good luck!

      Delete
    14. *I mean... 0,2,3,5 is wrong but 0,1,2,3 is correct XD Dunno what happened

      Delete
    15. Awesome i will check that first thing tomorrow.
      By the way, if i wanna put 2 or more languages to be recognized at the same time do i just move the "lang.traineddata" in the same file?

      Should i do any major changes to the "lang" variable in the activity.java?

      Delete
    16. Well, if your 2 language are similar maybe one global .traineddata may be enough. If you want a perfect match I don't suggest that but, you know, I don't know what you are doing so I show you every possibility. Anyway keep in mind that doing the training by yourself means that you have to take your own pictures and then tell Tesseract "this rectangle represents an A", "this other represents a O" ecc. It's quite boring and time consuming. Of course, if the text is very clear everything will be much quicker since it will be able to correctly recognize most of your character at first shot.

      However, in the general case, you'll have 2 different .traineddata and, yes, you will keep 2 different possibilities for "lang" variable.

      NOTE: for the hand-training there are many tools that will help you. I use Qt-box-editor http://zdenop.github.io/qt-box-editor/
      You can download it from here
      https://github.com/zdenop/qt-box-editor/downloads
      Pick qt-box-editor-dependecies-1.09.zip, unzip it and, in that unzipped folder, add the executable qt-box-editor-1.08win32.zip (there are more updated executable but on my machine they make trouble....). This is the never ending Tesseract Saga XD

      NOTE2: before proceed with suggestions above, make sure to understand what a box file is (a simple .txt file with a list of paris "coordinates - character"), otherwise you will not be able to figure out what to do with Qt-box-editor

      Delete
    17. Had some troubles during the weekend and didnt have much time to work on it. Thanks so much for the advice. I'll give them a try as soon as i can.
      Again thanks so much for all the help.

      Delete
    18. Guys I am trying to do "ant release" but I am getting this error: 'ant' is not recognized as an internal or external command,
      operable program or batch file.

      I had added jdk many days ago to the path I really dont know what to do I googled million times but I didn't find something useful. I hope one of you show up and help me enjoy my holidays :)

      Delete
    19. hello
      i have been searching for a while , as i knew from my past experience programming for windows , using an API and DLL is a peace of cake to link , use , and distribute the final app to clients , when i came to android and i saw how much is integrated with java , so with same concept i was looking for a pure java written library assuming it will be easier to link, use and distribute with android , found this one
      http://roncemer.com/software-development/java-ocr/
      with links to https://sourceforge.net/projects/javaocr/
      the liberality passed a lot of modification and development , many releases and not enough documentation , after getting used to i discovered it wont work direct on android as it relies on the java.awt which do not exist in android , android have its own android,graphics literary , tried to work around , put got suspicious to try to use any porting options to use within android , after i know that it might be a nightmare to distribute your app later ,,,


      Delete
    20. sorry ..for the intro , let's get the long story short ...
      anyone tried the literary in distribution to mobile devices , is it working , any documentation , any limitations , that will save a lot of time before giving a try
      thnx

      Delete
  30. For ANDROID STUDIO developers, here's what I did on my Windows 8.1 machine.

    --PART 2--

    10) Open a completely new Android Studio project and follow these instructions https://coderwall.com/p/eurvaq/tesseract-with-andoird-and-gradle from section "Configure tess-two with gradle" but for safety don't delete any folder or file even if he suggests to do so.
    I had some trouble with "build.gradle" file in "libraries\tess-two" directory, but it is sufficient to change some value on it. In my case I have:

    "classpath 'com.android.tools.build:gradle:0.14.0'" instead of "classpath 'com.android.tools.build:gradle:0.9.+' "

    and

    " compileSdkVersion 21
    buildToolsVersion "21.0.2"
    defaultConfig {
    minSdkVersion 15
    targetSdkVersion 21
    } "

    instead of

    " compileSdkVersion 19
    buildToolsVersion "19.0.3"

    defaultConfig {
    minSdkVersion 8
    targetSdkVersion 19}".

    Note that the last step means you have to go in "File -> Project Structure -> Select a module from the left subwindow -> Dependencies (last tab) ->Press the green "+" on your right -> Module Dependency -> OK"

    11) Download this project https://github.com/GautamGupta/Simple-Android-OCR and copy&paste in your new project the code in these files: "SimpleAndroidOCRActivity.java", "main.xml", "strings.xml". Of course your files may have different names (in my case "MainActivity.java", "activity_main.xml", "strings.xml") so some renaming in the code may be necessary.
    Also open your "AndroidManifest.xml" and add at the end (but before "/manifest") what you find between "/application" and "/manifest" in the just downloaded "AndroidManifest.xml" (it means that you have to add "uses-permissions" and "uses-feature" tag).

    12) Download from here https://code.google.com/p/tesseract-ocr/downloads/list the file in the language you prefer (eg: tesseract-ocr-3.02.eng.tar.gz ), extract it and locate the file "yourLanguage.traineddata" (eg: "eng.traineddata"). Forget for a moment your Android Studio IDE, open the folder of your project and go in "app-->src-->main". Create here a new folder and name it "assets". Open it and create another folder named "tessdata". Put there your .traineddata file.

    13) Hope it was helpful, I obtained this after weeks of googling during free time, sometimes reaching page #10+. If I forgot something please forgive me and please reply this post without hesitation. Since I started android programming only 2 months ago I won't be able to answer your questions. Forgive the mess I made in this blog due to special character issues and my bad english too.
    Ciao belli!

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. Hello,

      Thanks a lot for such a helpful article. I cloud run the application according to your instruction, but it cloud not read the English text properly.Please help me to resolve the issue.

      Delete
    3. Sorry for late reply, I'm glad it was useful for you.
      If you can not read english text properly I suggest you to train tesseract as I wrote in a reply of the first part post. Meanwhile, besides Qt-box-editor, I found Cowboxer, another box editor much faster than the first one. If you are interested, this is the link:
      https://code.google.com/p/cowboxer/

      Hope this reply was useful too, greetings!

      Delete
    4. This comment has been removed by the author.

      Delete
    5. Hi Matz,
      I have done all steps successfully,app is running also but here problem is : after convert text is not same which is in image.only 20 % text match with actual image and extra unused character also add automatically.
      pls tell me how to get exact text after read the image

      Delete
  31. Hye, im a newbie to android and OCR...my question is can i use this OCR library for plate number recognition that recognize image capture in black background and plate number in white color?

    ReplyDelete
  32. Thanks Mr.Francis Solomon for your post, but it not give acurate output...

    ReplyDelete
  33. My app is crashing and what type of text it will read

    ReplyDelete
  34. i follow your tutorial but i got this error and i am working on android studio linux based os
    Error:Execution failed for task ':tesstwo:compileReleaseNdk'.
    > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/root/Android/Sdk/ndk-bundle/ndk-build'' finished with non-zero exit value 2

    ReplyDelete
  35. This comment has been removed by the author.

    ReplyDelete
  36. Its only work for one line of text ..... How to improve it to work also for multiple lines of text ?

    ReplyDelete
  37. This comment has been removed by the author.

    ReplyDelete
  38. I'm not a developer, i always use the free online ocr to recognize and scan text from image.

    ReplyDelete
  39. Hello ,

    I am getting the following error, Please let me know the reason...


    09-29 16:24:08.926 14099-14099/com.ocr.ocrapplication E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.ExceptionInInitializerError
    at com.ocr.ocrapplication.MainActivity.onPhotoTaken(MainActivity.java:197)
    at com.ocr.ocrapplication.MainActivity.onActivityResult(MainActivity.java:121)
    at android.app.Activity.dispatchActivityResult(Activity.java:5347)
    at android.app.ActivityThread.deliverResults(ActivityThread.java:3175)
    at android.app.ActivityThread.handleSendResult(ActivityThread.java:3222)
    at android.app.ActivityThread.access$1100(ActivityThread.java:140)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1276)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4895)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
    at dalvik.system.NativeStart.main(Native Method)
    Caused by: java.lang.UnsatisfiedLinkError: Couldn't load pngt: findLibrary returned null
    at java.lang.Runtime.loadLibrary(Runtime.java:365)
    at java.lang.System.loadLibrary(System.java:535)
    at com.googlecode.tesseract.android.TessBaseAPI.(TessBaseAPI.java:43)
                at com.ocr.ocrapplication.MainActivity.onPhotoTaken(MainActivity.java:197)
                at com.ocr.ocrapplication.MainActivity.onActivityResult(MainActivity.java:121)
                at android.app.Activity.dispatchActivityResult(Activity.java:5347)
                at android.app.ActivityThread.deliverResults(ActivityThread.java:3175)
                at android.app.ActivityThread.handleSendResult(ActivityThread.java:3222)
                at android.app.ActivityThread.access$1100(ActivityThread.java:140)
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1276)
                at android.os.Handler.dispatchMessage(Handler.java:99)
                at android.os.Looper.loop(Looper.java:137)
                at android.app.ActivityThread.main(ActivityThread.java:4895)
                at java.lang.reflect.Method.invokeNative(Native Method)
                at java.lang.reflect.Method.invoke(Method.java:511)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
                at dalvik.system.NativeStart.main(Native Method)

    ReplyDelete
  40. how i impot this project in android studio?
    i am android studio user

    ReplyDelete
  41. this is really working good...but if i want to get a particular string from the text in image..what is the procedure..can u help me francis?

    ReplyDelete
  42. Result seems not accurate, how can I fix it?

    ReplyDelete
  43. HI,
    For me the OCRed text is returning null.Can you help me

    ReplyDelete
    Replies
    1. And when i am trying to download tess-two_library from the link provided its giving me page not available error.
      So i downloaded the library from https://github.com/rmtheis/tess-two/.

      Delete
  44. there are some errors in TessBaseAPI.java on your tess-two. is there any other way to fix this? Thanks for guiding.

    ReplyDelete
  45. there are some errors in TessBaseAPI.java on your tess-two. is there any other way to fix this? Thanks for guiding.

    ReplyDelete
  46. Thank You Very Much Soloman Bro ...Your project is like a gift to me.
    Can you please publish next code on how to improve output ...
    Thanking you very much...
    Mandar

    ReplyDelete
  47. Thank You Very Much Soloman Bro ...Your project is like a gift to me.
    Can you please publish next code on how to improve output ...
    Thanking you very much...
    Mandar

    ReplyDelete
  48. hi , my app is crashing !! when i click ok after taking a pic !! any idea please ?

    ReplyDelete
  49. Dear Soloman,

    i have implemented your code its not giving actual text which is in image instead its giving unknown character.please suggest
    Gmail id is : shankarsid1984@gmail.com

    ReplyDelete
  50. I am having this exception, can you please provide a direction for me, The project works on some emulated devices, but not on real devices. More specifically what is libhoudini.so and how can I include it in the project

    Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: load_library[1098]: Library '/system/lib/libhoudini.so' not found
    02-22 07:00:01.580 5306-5306/com.pwc.za.helloandroid E/AndroidRuntime: at java.lang.Runtime.loadLibrary(Runtime.java:370)
    02-22 07:00:01.580 5306-5306/com.pwc.za.helloandroid E/AndroidRuntime: at java.lang.System.loadLibrary(System.java:535)
    02-22 07:00:01.580 5306-5306/com.pwc.za.helloandroid E/AndroidRuntime: at com.googlecode.tesseract.android.TessBaseAPI.(TessBaseAPI.java:44)
    02-22 07:00:01.580 5306-5306/com.pwc.za.helloandroid E/AndroidRuntime: at com.pwc.za.helloandroid.SimpleAndroidOCRActivity.onPhotoTaken(SimpleAndroidOCRActivity.java:219)

    ReplyDelete
  51. while clicking ocr button its opening camera.then if i take any photo its showing force close.

    ReplyDelete
  52. Great tutorial :)
    can you explain which code that processing the ocr so the application can knowing text from picture that taken?
    thanks before :)

    ReplyDelete
  53. Awesome tutorial. It worked. But how to train the ocr?

    ReplyDelete
  54. Thanks Solo for the tutorial.
    The project builds successfully without any errors in eclipse but as soon as I run it ,it gives StackOverFlowError and eclipse asks to close due to internal error.I am using MacBook Pro with Yosemite and 4GB RAM.Can you please suggest a remedy?
    Is anybody else facing the same issue?

    ReplyDelete
  55. This tutorial and some people on the comments are way to awesome with all the work and the help they give.
    I would like to ask something somewhat irrelevant for some bonus work that im trying out.

    How could someone get the OCRed text when it shows and store into a database?
    Any help would be appreciated.
    Thanks in advance.

    ReplyDelete
  56. Can you say how it can be done in android studio.

    ReplyDelete
  57. seems that cloud based OCR service API will be the solution for now

    ReplyDelete
  58. App Crash when i click the image

    ReplyDelete
  59. This tutorial is helpful, Thanks for sharing but its not reading exactly from the image.

    ReplyDelete
  60. How it can be done in Android studio

    ReplyDelete
  61. how do you improve accuracy when doing the OCR, and is it possible to OCR handwritten text

    ReplyDelete
  62. How it can be done in Android studio?

    ReplyDelete
  63. Hey gyss! Fantastic app there out.
    I tried this. It works really well. But sometimes I dont know why i get an error like

    12-26 11:40:16.019: A/libc(22627): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 22627 (roid.ocr.simple)


    I am not able to detect where correctly the program is going wrong. Please help me.

    ReplyDelete
  64. Hey gyss! Fantastic app there out.
    I tried this. It works really well. But sometimes I dont know why i get an error like

    12-26 11:40:16.019: A/libc(22627): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 22627 (roid.ocr.simple)


    I am not able to detect where correctly the program is going wrong. Please help me.

    ReplyDelete
  65. This is an excellent tutorial, and works exactly as advertised. Kudos to you Francis! Do you have any idea why the OCR conversion is so poor? Have you had better success with this tess-two?

    ReplyDelete
  66. Thank you for sharing. Your blog has given me that thing which I never expect to get from all over the websites. Nice post guys!

    Melbourne Web Developer

    ReplyDelete