Experimental optical character recognition app

Overview

android-ocr

An experimental app for Android that performs optical character recognition (OCR) on images captured using the device camera.

Runs the Tesseract OCR engine using tess-two, a fork of Tesseract Tools for Android.

Most of the code making up the core structure of this project has been adapted from the ZXing Barcode Scanner. Along with Tesseract-OCR and Tesseract Tools for Android (tesseract-android-tools), several open source projects have been used in this project, including leptonica, google-api-translate-java, microsoft-translator-java-api, and jtar.

Video

Video

A slightly modified version:

Video

Requires

  • A Windows Azure Marketplace Client ID and Client Secret (for translation) - Documentation
  • A Google Translate API key (for translation) - Documentation

Training data for OCR

A data file is required for every language you want to recognize. For English, this data file is included in the application assets and is automatically installed when the app is first run.

For other languages (Spanish, French, Chinese, etc.), the app will try to download the training data from an old Google Code repository that is no longer available, and the download fails. So if you want to use training data for other languages, you'll need to package the appropriate training data files in the app or change the code to point to your own download location.

Installation

To build and run the app, clone this project, open it as an existing project in Android Studio, and click Run.

License

This project is licensed under the Apache License, Version 2.0

/*
 * Copyright 2011 Robert Theis
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

One of the jar files in the android/libs directory (google-api-translate-java-0.98-mod2.jar) is licensed under the GNU Lesser GPL.

Comments
  • java.lang.RuntimeException: Unable to resume activity : CaptureActivity

    java.lang.RuntimeException: Unable to resume activity : CaptureActivity

    @rmtheis I am facing this issue on running the app.

    This is my directory structure. I am trying to run on android studio 2.0 windows 10 (64 bit) machine. untitled

    Here is stack trace 04-28 02:57:12.025 18385-18385/com.prashantskywalker.newvideoocr E/CaptureActivity: setdefaultpreferences run 04-28 02:57:17.199 18385-18393/com.prashantskywalker.newvideoocr W/art: Suspending all threads took: 8.531ms 04-28 02:57:17.223 18385-18385/com.prashantskywalker.newvideoocr W/art: Verification of java.lang.Object com.prashantskywalker.newvideoocr.ViewfinderView.access$super(com.prashantskywalker.newvideoocr.ViewfinderView, java.lang.String, java.lang.Object[]) took 502.418ms 04-28 02:57:17.310 18385-18385/com.prashantskywalker.newvideoocr W/ResourceType: Failure getting entry for 0x7f0d0003 (t=12 e=3) (error -75) 04-28 02:57:17.310 18385-18385/com.prashantskywalker.newvideoocr W/ResourceType: Failure getting entry for 0x7f0d0002 (t=12 e=2) (error -75) 04-28 02:57:17.311 18385-18385/com.prashantskywalker.newvideoocr D/AndroidRuntime: Shutting down VM 04-28 02:57:17.314 18385-18385/com.prashantskywalker.newvideoocr E/AndroidRuntime: FATAL EXCEPTION: main Process: com.prashantskywalker.newvideoocr, PID: 18385 java.lang.RuntimeException: Unable to resume activity {com.prashantskywalker.newvideoocr/com.prashantskywalker.newvideoocr.CaptureActivity}: android.view.InflateException: Binary XML file line #26: Error inflating class java.lang.reflect.Constructor at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3028) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3063) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2418) at android.app.ActivityThread.access$800(ActivityThread.java:155) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5343) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700) Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class java.lang.reflect.Constructor at android.preference.GenericInflater.createItem(GenericInflater.java:397) at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417) at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428) at android.preference.GenericInflater.rInflate(GenericInflater.java:481) at android.preference.GenericInflater.rInflate(GenericInflater.java:493) at android.preference.GenericInflater.inflate(GenericInflater.java:326) at android.preference.GenericInflater.inflate(GenericInflater.java:263) at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:272) at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:485) at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:444) at com.prashantskywalker.newvideoocr.CaptureActivity.retrievePreferences(CaptureActivity.java:1146) at com.prashantskywalker.newvideoocr.CaptureActivity.onResume(CaptureActivity.java:392) at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1280) at android.app.Activity.performResume(Activity.java:6096) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3011) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3063)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2418)  at android.app.ActivityThread.access$800(ActivityThread.java:155)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5343)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)  Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:288) at android.preference.GenericInflater.createItem(GenericInflater.java:383) at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417)  at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428)  at android.preference.GenericInflater.rInflate(GenericInflater.java:481)  at android.preference.GenericInflater.rInflate(GenericInflater.java:493)  at android.preference.GenericInflater.inflate(GenericInflater.java:326)  at android.preference.GenericInflater.inflate(GenericInflater.java:263)  at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:272)  at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:485)  at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:444)  at com.prashantskywalker.newvideoocr.CaptureActivity.retrievePreferences(CaptureActivity.java:1146)  at com.prashantskywalker.newvideoocr.CaptureActivity.onResume(CaptureActivity.java:392)  at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1280)  at android.app.Activity.performResume(Activity.java:6096)  at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3011)  at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3063)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2418)  at android.app.ActivityThread.access$800(ActivityThread.java:155)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5343)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)  Caused by: java.lang.NullPointerException: Attempt to get length of null array at android.content.res.AssetManager.getResourceTextArray(AssetManager.java:214) at android.content.res.Resources.getTextArray(Resources.java:503) at android.content.res.TypedArray.getTextArray(TypedArray.java:771) at android.preference.ListPreference.(ListPreference.java:51) at android.preference.ListPreference.(ListPreference.java:65) at android.preference.ListPreference.(ListPreference.java:69) at java.lang.reflect.Constructor.newInstance(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:288)  at android.preference.GenericInflater.createItem(GenericInflater.java:383)  at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417)  at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428)  at android.preference.GenericInflater.rInflate(GenericInflater.java:481)  at android.preference.GenericInflater.rInflate(GenericInflater.java:493)  at android.preference.GenericInflater.inflate(GenericInflater.java:326)  at android.preference.GenericInflater.inflate(GenericInflater.java:263)  at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:272)  at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:485)  at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:444)  at **com.prashantskywalker.newvideoocr.CaptureActivity.retrievePreferences(CaptureActivity.java:1146)  at com.prashantskywalker.newvideoocr.CaptureActivity.onResume(CaptureActivity.java:392) ** at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1280)  at android.app.Activity.performResume(Activity.java:6096)  at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3011)  at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3063)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2418)  at android.app.ActivityThread.access$800(ActivityThread.java:155)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5343)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)  04-28 02:57:18.354 18385-18385/com.prashantskywalker.newvideoocr I/Process: Sending signal. PID: 18385 SIG: 9 04-28 03:24:12.214 20903-20903/com.prashantskywalker.newvideoocr W/art: Failed to find OatDexFile for DexFile /data/data/com.prashantskywalker.newvideoocr/files/instant-run/dex/slice-slice_4-classes.dex ( canonical path /data/data/com.prashantskywalker.newvideoocr/files/instant-run/dex/slice-slice_4-classes.dex) with checksum 0x932b9786 in OatFile /data/data/com.prashantskywalker.newvideoocr/cache/slice-slice_4-classes.dex 04-28 03:24:14.219 20903-20903/com.prashantskywalker.newvideoocr W/ResourceType: Failure getting entry for 0x7f0d0003 (t=12 e=3) (error -75) 04-28 03:24:14.219 20903-20903/com.prashantskywalker.newvideoocr W/ResourceType: Failure getting entry for 0x7f0d0002 (t=12 e=2) (error -75) 04-28 03:24:14.220 20903-20903/com.prashantskywalker.newvideoocr D/AndroidRuntime: Shutting down VM 04-28 03:24:14.223 20903-20903/com.prashantskywalker.newvideoocr E/AndroidRuntime: FATAL EXCEPTION: main Process: com.prashantskywalker.newvideoocr, PID: 20903 java.lang.RuntimeException: Unable to resume activity {com.prashantskywalker.newvideoocr/com.prashantskywalker.newvideoocr.CaptureActivity}: android.view.InflateException: Binary XML file line #26: Error inflating class java.lang.reflect.Constructor at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3028) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3063) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2418) at android.app.ActivityThread.access$800(ActivityThread.java:155) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5343) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700) Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class java.lang.reflect.Constructor at android.preference.GenericInflater.createItem(GenericInflater.java:397) at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417) at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428) at android.preference.GenericInflater.rInflate(GenericInflater.java:481) at android.preference.GenericInflater.rInflate(GenericInflater.java:493) at android.preference.GenericInflater.inflate(GenericInflater.java:326) at android.preference.GenericInflater.inflate(GenericInflater.java:263) at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:272) at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:485) at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:444) at com.prashantskywalker.newvideoocr.CaptureActivity.retrievePreferences(CaptureActivity.java:1146) at com.prashantskywalker.newvideoocr.CaptureActivity.onResume(CaptureActivity.java:392) at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1280) at android.app.Activity.performResume(Activity.java:6096) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3011) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3063)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2418)  at android.app.ActivityThread.access$800(ActivityThread.java:155)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5343)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)  Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:288) at android.preference.GenericInflater.createItem(GenericInflater.java:383) at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417)  at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428)  at android.preference.GenericInflater.rInflate(GenericInflater.java:481)  at android.preference.GenericInflater.rInflate(GenericInflater.java:493)  at android.preference.GenericInflater.inflate(GenericInflater.java:326)  at android.preference.GenericInflater.inflate(GenericInflater.java:263)  at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:272)  at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:485)  at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:444)  at com.prashantskywalker.newvideoocr.CaptureActivity.retrievePreferences(CaptureActivity.java:1146)  at com.prashantskywalker.newvideoocr.CaptureActivity.onResume(CaptureActivity.java:392)  at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1280)  at android.app.Activity.performResume(Activity.java:6096)  at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3011)  at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3063)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2418)  at android.app.ActivityThread.access$800(ActivityThread.java:155)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5343)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)  Caused by: java.lang.NullPointerException: Attempt to get length of null array at android.content.res.AssetManager.getResourceTextArray(AssetManager.java:214) at android.content.res.Resources.getTextArray(Resources.java:503) at android.content.res.TypedArray.getTextArray(TypedArray.java:771) at android.preference.ListPreference.(ListPreference.java:51) at android.preference.ListPreference.(ListPreference.java:65) at android.preference.ListPreference.(ListPreference.java:69) at java.lang.reflect.Constructor.newInstance(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:288)  at android.preference.GenericInflater.createItem(GenericInflater.java:383)  at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417)  at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428)  at android.preference.GenericInflater.rInflate(GenericInflater.java:481)  at android.preference.GenericInflater.rInflate(GenericInflater.java:493)  at android.preference.GenericInflater.inflate(GenericInflater.java:326)  at android.preference.GenericInflater.inflate(GenericInflater.java:263)  at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:272)  at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:485)  at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:444)  at **com.prashantskywalker.newvideoocr.CaptureActivity.retrievePreferences(CaptureActivity.java:1146)  at com.prashantskywalker.newvideoocr.CaptureActivity.onResume(CaptureActivity.java:392) ** at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1280)  at android.app.Activity.performResume(Activity.java:6096)  at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3011)  at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3063)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2418)  at android.app.ActivityThread.access$800(ActivityThread.java:155)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5343)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)  04-28 03:34:38.754 22151-22151/com.prashantskywalker.newvideoocr W/ResourceType: Failure getting entry for 0x7f0d0003 (t=12 e=3) (error -75) 04-28 03:34:38.754 22151-22151/com.prashantskywalker.newvideoocr W/ResourceType: Failure getting entry for 0x7f0d0002 (t=12 e=2) (error -75) 04-28 03:34:38.755 22151-22151/com.prashantskywalker.newvideoocr D/AndroidRuntime: Shutting down VM 04-28 03:34:38.759 22151-22151/com.prashantskywalker.newvideoocr E/AndroidRuntime: FATAL EXCEPTION: main Process: com.prashantskywalker.newvideoocr, PID: 22151 java.lang.RuntimeException: Unable to resume activity {com.prashantskywalker.newvideoocr/com.prashantskywalker.newvideoocr.CaptureActivity}: android.view.InflateException: Binary XML file line #26: Error inflating class java.lang.reflect.Constructor at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3028) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3063) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2418) at android.app.ActivityThread.access$800(ActivityThread.java:155) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5343) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700) Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class java.lang.reflect.Constructor at android.preference.GenericInflater.createItem(GenericInflater.java:397) at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417) at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428) at android.preference.GenericInflater.rInflate(GenericInflater.java:481) at android.preference.GenericInflater.rInflate(GenericInflater.java:493) at android.preference.GenericInflater.inflate(GenericInflater.java:326) at android.preference.GenericInflater.inflate(GenericInflater.java:263) at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:272) at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:485) at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:444) at com.prashantskywalker.newvideoocr.CaptureActivity.retrievePreferences(CaptureActivity.java:1146) at com.prashantskywalker.newvideoocr.CaptureActivity.onResume(CaptureActivity.java:392) at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1280) at android.app.Activity.performResume(Activity.java:6096) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3011) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3063)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2418)  at android.app.ActivityThread.access$800(ActivityThread.java:155)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5343)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)  Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:288) at android.preference.GenericInflater.createItem(GenericInflater.java:383) at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417)  at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428)  at android.preference.GenericInflater.rInflate(GenericInflater.java:481)  at android.preference.GenericInflater.rInflate(GenericInflater.java:493)  at android.preference.GenericInflater.inflate(GenericInflater.java:326)  at android.preference.GenericInflater.inflate(GenericInflater.java:263)  at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:272)  at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:485)  at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:444)  at **com.prashantskywalker.newvideoocr.CaptureActivity.retrievePreferences(CaptureActivity.java:1146)  at com.prashantskywalker.newvideoocr.CaptureActivity.onResume(CaptureActivity.java:392) ** at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1280)  at android.app.Activity.performResume(Activity.java:6096)  at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3011)  at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3063)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2418)  at android.app.ActivityThread.access$800(ActivityThread.java:155)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5343)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)  Caused by: java.lang.NullPointerException: Attempt to get length of null array at android.content.res.AssetManager.getResourceTextArray(AssetManager.java:214) at android.content.res.Resources.getTextArray(Resources.java:503) at android.content.res.TypedArray.getTextArray(TypedArray.java:771) at android.preference.ListPreference.(ListPreference.java:51) at android.preference.ListPreference.(ListPreference.java:65) at android.preference.ListPreference.(ListPreference.java:69) at java.lang.reflect.Constructor.newInstance(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:288)  at android.preference.GenericInflater.createItem(GenericInflater.java:383)  at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417)  at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428)  at android.preference.GenericInflater.rInflate(GenericInflater.java:481)  at android.preference.GenericInflater.rInflate(GenericInflater.java:493)  at android.preference.GenericInflater.inflate(GenericInflater.java:326)  at android.preference.GenericInflater.inflate(GenericInflater.java:263)  at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:272)  at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:485)  at android.preference.PreferenceManager.setDefaultValues(PreferenceManager.java:444)  at **com.prashantskywalker.newvideoocr.CaptureActivity.retrievePreferences(CaptureActivity.java:1146)  at com.prashantskywalker.newvideoocr.CaptureActivity.onResume(CaptureActivity.java:392) ** at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1280)  at android.app.Activity.performResume(Activity.java:6096)  at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3011)  at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3063)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2418)  at android.app.ActivityThread.access$800(ActivityThread.java:155)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5343)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)  04-28 03:34:40.587 22151-22151/com.prashantskywalker.newvideoocr I/Process: Sending signal. PID: 22151 SIG: 9

    opened by PrashantYadav 7
  • Portrait Orientation

    Portrait Orientation

    Hey rmtheis,

    Thanks for your awesome prototype ocr app! I've been using it to figure out how to get tesseract working on android. I have a ee signal processing background, and I'm kind of new to android.

    What are the changes needed using your source to switch to portrait mode? I'm sure you have lots of your own stuff to deal with, but if you have a minute I'd appreciate the help! How is it that the camera preview appears orthogonal to reality?

    Thanks Arjun

    opened by arjunvasan 7
  • tess-two Not Found

    tess-two Not Found

    hi,

    I am JAVA / Android Software Engineer in Cygnet Infotech Pvt. Ltd., Ahmedabad, Gujarat, India. I need to integrate OCR in my Android App as client required.

    I am using Android, Eclipse IDE on windows xp. recently, i found your article its awesome with steps.

    but i can't find tess-two library project for running Android OCR application (for Intermediate+) Project. so can you please provide me the successfully compiled tess-two library project with some simple steps on my email id: [email protected]

    and My question is Simple Android OCR Android Project runs in all android Device or some specific device with minimum API Level? please let me know your feedback on above question.

    if you provide me the library and answer of my above query as soon as possible, it will be a great help for me.

    Looking for your cooperation......

    Thanks & Regards, Durgesh Patel JAVA / ANDROID Software Engineer Cygnet Infotech Pvt. Ltd. Ahmedabad, Gujarat, India

    opened by dmpatel123 6
  • Sinhala Language Detection

    Sinhala Language Detection

    Dear Sir,

    Thank you for your code ,

    I add sin.trinddata to assets folder and changed this variables

    /** ISO 639-3 language code indicating the default recognition language. */ public static final String DEFAULT_SOURCE_LANGUAGE_CODE = "sin";

    /** ISO 639-1 language code indicating the default target language for translation. */ public static final String DEFAULT_TARGET_LANGUAGE_CODE = "si";

    But its not working for me.

    can you explain what are the appropriate places and how to change the appropriate places.

    Regards , Aruna

    opened by ArunaMahaGamage 3
  • Gradle build fails

    Gradle build fails

    As mentioned in the README, cloned the project & tried opening it in Android Studio. The gradle build does not complete with error below

    Gradle 'android-ocr' project refresh failed
    Error:Argument for @NotNull parameter 'key' of com/android/tools/idea/gradle/project/model/ide/android/ModelCache.computeIfAbsent must not be null
    
    opened by pocha 3
  • Cannot download

    Cannot download

    I download the source and import to my project ,run,it show me a download dialog and didn't run the
    progress ..Did I need to do some other configuration ??

    opened by zouzhenglu 3
  •  F-droid release crashes immediately

    F-droid release crashes immediately

    When I try to start the app, it just shows a dialog "Unfortunately, OCR Test has stopped." Logcat is empty.

    This only happens with the version from F-droid. If I install it from Google Play Store or compile it myself, it works fine.

    My system is Android 4.4.2, API 19

    opened by cvzi 3
  • Is possible if I use two traineddata

    Is possible if I use two traineddata

    I created my own traineddata since i Can't combine it to the eng.traineddata. Is it possible for the app to use use two or more traineddata at the same time.

    opened by pauljie018 3
  • java.lang.ExceptionInInitializerError

    java.lang.ExceptionInInitializerError

    Hi,

    I managed to get the lib files liblept.so and also libtess.so and put them in the folder armeabi-v7a, x86 and also armeabi alone, and i get the following exception:

    09-18 14:20:10.579: E/AndroidRuntime(16612): java.lang.ExceptionInInitializerError 09-18 14:20:10.579: E/AndroidRuntime(16612): at edu.sfsu.cs.orange.ocr.CaptureActivity.initOcrEngine(CaptureActivity.java:711) 09-18 14:20:10.579: E/AndroidRuntime(16612): at edu.sfsu.cs.orange.ocr.CaptureActivity.onResume(CaptureActivity.java:368) 09-18 14:20:10.579: E/AndroidRuntime(16612): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1189) 09-18 14:20:10.579: E/AndroidRuntime(16612): at android.app.Activity.performResume(Activity.java:5094) 09-18 14:20:10.579: E/AndroidRuntime(16612): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2718) 09-18 14:20:10.579: E/AndroidRuntime(16612): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2760) 09-18 14:20:10.579: E/AndroidRuntime(16612): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2216) 09-18 14:20:10.579: E/AndroidRuntime(16612): at android.app.ActivityThread.access$600(ActivityThread.java:149) 09-18 14:20:10.579: E/AndroidRuntime(16612): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300) 09-18 14:20:10.579: E/AndroidRuntime(16612): at android.os.Handler.dispatchMessage(Handler.java:99) 09-18 14:20:10.579: E/AndroidRuntime(16612): at android.os.Looper.loop(Looper.java:153) 09-18 14:20:10.579: E/AndroidRuntime(16612): at android.app.ActivityThread.main(ActivityThread.java:5086) 09-18 14:20:10.579: E/AndroidRuntime(16612): at java.lang.reflect.Method.invokeNative(Native Method) 09-18 14:20:10.579: E/AndroidRuntime(16612): at java.lang.reflect.Method.invoke(Method.java:511) 09-18 14:20:10.579: E/AndroidRuntime(16612): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821) 09-18 14:20:10.579: E/AndroidRuntime(16612): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584) 09-18 14:20:10.579: E/AndroidRuntime(16612): at dalvik.system.NativeStart.main(Native Method) 09-18 14:20:10.579: E/AndroidRuntime(16612): Caused by: java.lang.NoSuchFieldError: no field with name='mNativeData' signature='I' in class Lcom/googlecode/tesseract/android/TessBaseAPI; 09-18 14:20:10.579: E/AndroidRuntime(16612): at com.googlecode.tesseract.android.TessBaseAPI.nativeClassInit(Native Method) 09-18 14:20:10.579: E/AndroidRuntime(16612): at com.googlecode.tesseract.android.TessBaseAPI.(TessBaseAPI.java:47) 09-18 14:20:10.579: E/AndroidRuntime(16612): ... 17 more

    how do i solve this? Please assist.

    opened by ghost 3
  • App Based on this Library?

    App Based on this Library?

    I found an app that does OCR very similar to this library published on Google Play: https://play.google.com/store/apps/details?id=com.duyp.vision.textscanner

    They don't have any licensing info so I don't know for sure if they are using your code. Given how it's pretty much impossible to build an app without using ANY open source libraries, I find it a bit suspicious.

    Just wanted to give you a heads up that someone may be using your code without following open source licensing requirements.

    opened by searchy2 2
  • [How to] Region of interest to extract specific text

    [How to] Region of interest to extract specific text

    Hi,

    I would like to use region of interest to extract specific text.

    I found ROI tesseract code which is not android.

    What would be the android code to get region of interest ?

    Thanks.

    opened by kirantpatil 2
Owner
Robert Theis
Robert Theis
Highly experimental predefined Bootstrap functions to use in Compose Web

bootstrap-compose Highly experimental predefined Bootstrap functions to use in Compose Web Install This package is uploaded to MavenCentral. repositor

Philip Wedemann 45 Jan 6, 2023
I was fed up with writing Java classes to mirror json models. So I wrote this Java app to automate the process.

Json2Java I was fed up with writing Java classes to mirror json models. So I wrote this Java app to automate the process. What this tool can do right

Jon F Hancock 303 Oct 8, 2022
A plug and play ;) android library for displaying a "rate this app" dialog

Easy Rating Dialog This lib provides a simple way to display an alert dialog for rating app. Default conditions to show: User opened the app more than

Fernando Martínez 111 Dec 30, 2022
Tool for Android app development

RateMeMaybe Asks the user if (s)he wants to open the Play Store to rate your application when certain requirements are met (see below). This can and s

Nicolai Spohrer 98 Dec 30, 2022
Android library that manages your app's cached data with ease.

Teller Android library that makes your apps faster. Teller facilitates the downloading, saving, and reading of the cached data of your app. Keep your

Levi Bostian 14 Apr 2, 2022
基于Appium的 App UI 遍历 & Monkey工具 (支持操作步骤回放)

UICrawler 基于Appium的App UI遍历 & Monkey 工具 针对个人和公司提供有偿UI自动化技术、接口自动化技术、接口mock技术等培训及测试工具定制开发 QQ 技术交流群 : 728183683 环境搭建及基本使用说明 环境搭建(感谢网友harsayer倾力之作): https

JustinMa 402 Dec 1, 2022
Demonstration of calling requestFocusFromTouch() in WebView is changing colors in Android app

webview-changing-colors-bug Demonstration of calling requestFocusFromTouch() in WebView is changing colors in Android app This is the problematic code

Konstantin Tabere 0 Oct 15, 2021
Makes Google play in app purchase library (BillingClient) into a flowable that can easily be used in compose world

Billy the android Our goal is to make a modern api of BillingClient so that it is easier to use in compose world. This library is still early beta and

Stefan Wärting 16 Dec 14, 2022
The Android Version in Kotlin of The Dialer App (in SwiftUI)

Dialer An intuitive USSD client to handle most of the common actions for you. Contains common MTN Rwanda USSD activation codes, which drastically simp

Cédric Bahirwe 1 Dec 14, 2021
Extension for Voisek App on React Native

react-native-voisek-app-extension Voisek App Extension for React Native Installation npm install react-native-voisek-app-extension Usage import Voisek

Omar Ramos Espinosa 2 Dec 21, 2021
Android App development internship project to create woman home screen for clothing company The Swastika.

Android App development internship project to create woman home screen for clothing company The Swastika.

Shradha Suryawanshi 2 Jun 12, 2022
Brief description of the app architecture

Readme App Brief description of the app architecture The application has a simple MVVM architecture based on a single Activity coupled with his own Vi

Alessandro Persiano 0 Nov 2, 2021
Recruitment Task App - record time which a user spends on tasks defined by himself

Recruitment-Task The purpose of this application is to record time which a user spends on tasks defined by himself. The user can add new tasks. New ta

Sylwester Zieliński 0 Feb 9, 2022
SmartLens uses Google's ML Kit for Barcode scanning, Face recognition, Text recognition, and Image labeling.

SmartLens SmartLens uses Google's ML Kit for Barcode scanning, Face recognition, Text recognition, and Image labeling. ?? Screen Shots ?? Features It

Prince Fahad 2 Sep 14, 2022
Paimondex App is an Android App that contains super mini wiki for playable characters from Genshin Impact, where you can favorite to save the character

Paimondex App is an Android App that contains super mini wiki for playable characters from Genshin Impact, where you can favorite to save the character. This could also show you the description of the each character with their talents and constellations.

Ervin Suriandi 1 Apr 13, 2022
Bukkit library written in Kotlin to make with compatibility and ease non-playable-character (NPC)

mc-npk Easy to use, fast and efficient library to make non-playable-characters (

Luiz Otávio 3 Aug 4, 2022
Deep AR android APP (Augmented reality) with face recognition and filters

quickstart-android-java To run the example Go to https://developer.deepar.ai, sign up, create the project and the Android app, copy the license key an

Arjun Kheni 3 Mar 30, 2022
Android App Face recognition using MobiFacenet + text to speech

Face_Recognition real time #Android App Face recognition using MobileFacenet.

Tran Quyen 1 Feb 17, 2022
Emotion recognition by speech in android.

Vokaturi - Android Library Android port of the Vokaturi emotion recognition API. Overview Vokaturi is an emotion recognition software, that can unders

Owais 82 Nov 11, 2022
Continuous speech recognition library for Android with options to use GoogleVoiceIme dialog and offline mode.

Android Speech Recognition This library lets you perform continuous voice recognition in your android app with options to either use Google Voice Ime

Maxwell Obi 75 May 21, 2022