GithubHelp home page GithubHelp logo

subhamtyagi / android-ocr Goto Github PK

View Code? Open in Web Editor NEW
329.0 329.0 60.0 19.42 MB

Tesseract based OCR for android

License: Apache License 2.0

Java 100.00%
android fdroid foss image-reader math-ocr ocr ocr-android ocr-recognition ocr-text-reader reader tesseract

android-ocr's People

Contributors

comradekingu avatar ddinghoya avatar drfccv avatar fjuro avatar franconian avatar glemco avatar h4n23s avatar jacktam9999 avatar karm46 avatar laralem avatar matdeluis avatar mmck345 avatar nautilusx avatar oersen avatar og-mrk avatar oymate avatar p-davide avatar praksiz avatar rezaalmanda avatar santossi avatar sggua avatar sguinetti avatar simmon-nplob avatar sr093906 avatar subhamtyagi avatar urlordjames avatar waldist avatar weblate avatar yarons avatar zouhirdehbi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-ocr's Issues

Change "save data" setting titile to more appropriate Title

as it is now the app remembers the last recognized text. even after closing and restarting app . even after delete cache of app. even after reboot of android. this is bad if last recognized text is sensitive data.

please add feature to forget last recognized text.

perhaps easiest implementation is to forget text after closing app. maybe also an option to forget or to remember on close.

workaround for now is to recognize any other text which is not sensitive data.

app gets crashed every time

A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 19541 (AsyncTask #1), pid 19432 (subhamtyagi.ocr).

Please help what i am doing wrong

Language selection menu

When selecting languages, they appear to be sorted alphabetically in English.
So if the phone is configured with another locale, the ordering is wrong.

For instance "anglais" (= English) appears sorted between "grec" (Greek) and "estonien" (Estonian) on my device, even though it starts with an "a".

Why Its accuracy level is that much low ?

I run it successfully. But its not extracting text even after selection of "Best" data set from setting. Its not even proper working with the english ?
So kindly guide me how can i improve it ??

Translations into other languages with weblate.org

Thanks for your great app!

Can you please use weblate.org to further facilitate translations into other languages.
Weblate is really great, easy to use for translation and gratis/free for free software projects.

[FIXED] Help needed side loading trained data?

Hi, internet access doesn't work on my device. So I can't directly download the trained data. But I can side load data.

I've read #29 and I can the see data goes in /storage/emulated/0/Android/data/io.github.subhamtyagi.ocr/files/best

As an example, I've downloaded the "Fast" english data from here
https://github.com/tesseract-ocr/tessdata_fast/blob/master/eng.traineddata

And I copied that eng.traineddata to /storage/emulated/0/Android/data/io.github.subhamtyagi.ocr/files/fast
But the app still doesn't see it!

Am I doing it correctly?
I noticed another directory called .../fast/tesstata
Should I put something in there too?

Any help on side loading would be much appreciated.
Thanks

Loading equation data fails

When I select “equation“ as language and confirm the download of the missing training data, after a short time showing the spinner, I get the message that the training data for equation is missing and the option to download it.

No other error message is shown.

Switching between fast/best/standard data type does not fix that.

Crash on Optionsmenu

Hi

if I try to open the setting the app v3.0 crashes. v2.1 works though.

Android 11
LineageOS 18.1

java.lang.ClassCastException: androidx.preference.ListPreference cannot be cast to androidx.preference.SwitchPreference
	at io.github.subhamtyagi.ocr.SettingsActivity$a.A0(Unknown Source:17)
	at lh.O(:3)
	at ye.e(:1)
	at ye.k(:8)
	at se.E(:8)
	at se.Y(Unknown Source:84)
	at se.C(:4)
	at se.w(:3)
	at fe.onStart(:4)
	at d0.onStart(Unknown Source:0)
	at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1435)
	at android.app.Activity.performStart(Activity.java:8018)
	at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3457)
	at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
	at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loop(Looper.java:223)
	at android.app.ActivityThread.main(ActivityThread.java:7664)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

not downloading data

when i run the project and the downloading data it will be held for more than 8h or long time then i dont see any result

2020-12-05 00:50:29.093 28784-28786/? A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x70 in tid 28786 (Binder:28784_1), pid 28784 (cmd)
and this error shows when the data was downloading

Crashes when having two languages selected

STR

  1. Open app, configure.
  2. Choose to allow multiple languages in the settings.
  3. Select German and English.

what happens

At the next start/going to main screen the app crashes.

FATAL EXCEPTION: main
Process: io.github.subhamtyagi.ocr, PID: 25329
java.lang.RuntimeException: Unable to start activity ComponentInfo{io.github.subhamtyagi.ocr/io.github.subhamtyagi.ocr.MainActivity}: java.lang.ArrayIndexOutOfBoundsException: length=130; index=-1
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3707)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3864)
	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2253)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:7870)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=130; index=-1
	at java.util.ArrayList.get(ArrayList.java:439)
	at io.github.subhamtyagi.ocr.MainActivity.y(Unknown Source:8)
	at io.github.subhamtyagi.ocr.MainActivity.x(Unknown Source:31)
	at io.github.subhamtyagi.ocr.MainActivity.z(:15)
	at io.github.subhamtyagi.ocr.MainActivity.onCreate(:4)
	at android.app.Activity.performCreate(Activity.java:8057)
	at android.app.Activity.performCreate(Activity.java:8037)
	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1345)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3688)
	... 12 more

what should happen

No crash.

system

Device: Pixel 4 (flame)
OS: Android 12, CalyxOS 3.6.0
source: F-Droid
version: v3.2
Build-ID: SQ3A.220605.009.A1.22306002

Translation.

As i understand now app works only in text recognition mode, it will be useful to add setting to translate recognized text to language X and output this translation instead of recognized text.

What do you think?

Not usable running Android 12

I just heard about this app, installation and initial start was successful. After downloading the training data, app crashed. Now I was not able to open the app anymore.

Device: Google Pixel 4a
Android version 12 (build SQ1A.211205.008)

updated app icon

I have redesigned the app icon. Maybe you want to replace it? What do you think?

OCR-app-logo

German recognition of word breaks at the end of lines not treated correctly when concatenating lines

In German word breaks at the end of some line are represented by a "-" directly after the last character of the word.

The Android App "OCR" concatenates lines appending a space after the line-break character.
Otherwise OCR does a superb job!

The issue could easily be fixed with the following procedure when concatenating lines:

If a line contains a "-" at the end, check the first word of the next line:

if the word is "und" or "oder" keep the "-" and insert a space when concatenating the lines (current procedure)
with other first word: when the word starts with a lower case character drop the "-" when concatenating the lines, otherwise keep the "-"; do NOT insert an additional space when concatenating the lines.

TesseractOcrAndroid-TestPage
2021-06-13 08_Tesseract-German-Recognition

Add Floating support, crop issue

Can you make this a floating app? As it will greately be functional because you do not neead to download the image before being process.

Can we not crop the image? I mean i dont want to crop the image that i want to ocr. I just want the image as is coz i dont want to edit the image and make it larger so that it needs to be cropped.

Sorry english is not my first language.

Activity memory leak caused by anonymous threads

Possible Memory Leak

An anonymous inner class will hold a reference to the this pointer of the outer class and will not be released until the thread ends.
It will hold the Activity and prevent its timely release. Please check the links below.

Occurrences

https://github.com/SubhamTyagi/android-ocr/blob/master/app/src/main/java/io/github/subhamtyagi/ocr/MainActivity.java#L314

Possible Solution

If it is necessary, it can be changed to static class + weak reference to eliminate the reference to the activity, which may cause memory leaks.
Further discussion is welcome.

training data missing!

For proper functioning of TesseractocR additional training data needs tobe downloaded to your device.
Do you want to download selectedlanguage(English) data?

May I ask, that is, my mobile phone has a network, but I can't download the data all the time?

Add to Play Store

Adding it to the Play Store would offer users a convenient and secure way to access the app.

Migration of cropper

This app is using this library for image cropping which is not maintained and causing so many issues for newer android version.

Issues #37 , #39 and #40 will be fixed if migration to another copper library take place:

Some promising alternative to current library:

https://github.com/CanHub/Android-Image-Cropper

https://github.com/ParkSangGwon/TedBottomPicker

https://github.com/Dhaval2404/ImagePicker

https://github.com/esafirm/android-image-picker

https://github.com/nguyenhoanglam/ImagePicker

https://github.com/SimformSolutionsPvtLtd/SSImagePicker

Requirement: minimum sdk support, oss license,

Picture source

setImage(byte[] imagedata, int width, int height, int bpp, int bpl)

What do the last two arguments of this method mean

Vertical text not detect in image to text

I am trying to detect text from images in horizontal orientation is working perfectly but Vertical orientation text is not detected.
Anyone has a solution for this or another way to achieve this functionality

Add Akkadian language

Hello everybody,

I would like to ask you to add support for Akkadian language. Recently, a model for it was added to the tesseract-ocr/tessdata_contrib repository.

These are the links to model files:

To use these models, the source URLs here have to be converted to arrays, as well as the code using it.

This addition also allows the app to use additional languages, for example Santali, like Text Fairy app does here.

Can't import images from any source

Pressing the "gallery" icon in the bottom right shows the following:

From #37, I understand that this should at least show my camera app? I have no issues with the camera in any other app.

Device: Pixel 4a
Android: 12

Fastlane error

Just a minor thing: I noticed you've "misnamed" full_description.txt (you've named it full_discription.txt, so it won't be found). A simple git mv full_discription.txt full_description.txt should fix that 😉

app crashes when selecting multiple languages

Steps to reproduce:

  1. Go to settings
  2. Enable the multiple languages toggle
  3. Select 2 or more languages.

As soon as I confirm the languages, the app crash and refuse to open. Log:

java.lang.RuntimeException: Unable to resume activity {io.github.subhamtyagi.ocr/io.github.subhamtyagi.ocr.MainActivity}: java.lang.ArrayIndexOutOfBoundsException: length=130; index=-1
	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4774)
	at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4807)
	at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:57)
	at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:179)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:7924)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=130; index=-1
	at java.util.ArrayList.get(ArrayList.java:439)
	at io.github.subhamtyagi.ocr.MainActivity.t(Unknown Source:8)
	at io.github.subhamtyagi.ocr.MainActivity.onResume(Unknown Source:7)
	at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1570)
	at android.app.Activity.performResume(Activity.java:8474)
	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4764)
	... 13 more

Recognize simple handwriting

I've been looking for a tool that could work similarly to a QR code scanner but without the need printing labels, both for the ease of marking but also for the possibility easily to put marks on ie metal or or something that won't fit through a printer.

My thought was to be able to set up a 5-10 character code series that you could have a conversion table for, maybe a website that could redirect to anywhere.
As it's only random characters I guess the language settings are for no use, maybe even messes things up while trying to find sentences, could this be a problem?

Made some test with gImageReader on Linux with tesseract 4.1.1 that worked well and made me think recognizing handwriting is possible, but didn't manage to replicate this with OCR app.

gImageReader (you see the recognized text at the top left, very small but correct )
Screenshot from 2021-04-11 10-07-11

OCR app, no success:
Screenshot_20210411-101316_OCR

Screenshot_20210411-101309_OCR

Are there any settings that could be adjusted to improve this, did have a look around the settings menu but didn't find any obvious, or is there a major difference that makes this hard/impossible with OCR app?

Additional dataset for LCDs

HI guys,

Thanks for your work here! A friend and I have a project to record some LCDs. Unfortunately, it does not work with the display we have.

We thought to use your project to make use of per-existing training data0 to allow to OCR it via the phone. But, we can't add any custom training's data to your app. I might wonder if it would be possible to extend your list of languages to host also that LCD trainings data, OR have the ability to add custom URLs to fetch given data.

Best regards,
akendo

BUG: Freezed app after the try to install 3rd language & no possibility to switch languages

Hello, i allowed multiple languages setting as i wanted to intsall several languages (about 10). I installed and downloaded learning data for 1st and then for 2nd language. When i tried to install 3rd language (i choosed the third language and i clicked "back"), then the OCR app freezed and since this time I am not able open it. The only solution is to reinstalled it.

So it seems that only two languages are functional with OCR. I thought that i can download multiple learning language data and then i can switch between them. But this is not obviously possible. Even i have two languages downloaded there is no way to switch from one to each other. Why? The only way to choose desired language is to go to the settings and select new languages... This is too cumbersome!

Can you fix it, please? I think that it will be great to have downloaded several languages and then to switch in between them.

Thank you.

LineageOS 16.0 (Android 9) / OCR 4.0

F-Droid build failed

https://monitor.f-droid.org/builds/log/io.github.subhamtyagi.ocr/10#site-footer Could you please take a look?

Execution failed for task ':app:checkReleaseDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class com.googlecode.leptonica.android.AdaptiveMap found in modules jetified-tesseract4android-4.1.0-runtime (cz.adaptech.tesseract4android:tesseract4android:4.1.0) and jetified-tesseract4android-openmp-4.1.0-runtime (cz.adaptech.tesseract4android:tesseract4android-openmp:4.1.0)
     Duplicate class com.googlecode.leptonica.android.Binarize found in modules jetified-tesseract4android-4.1.0-runtime (cz.adaptech.tesseract4android:tesseract4android:4.1.0) and jetified-tesseract4android-openmp-4.1.0-runtime (cz.adaptech.tesseract4android:tesseract4android-openmp:4.1.0)
     Duplicate class com.googlecode.leptonica.android.Box found in modules jetified-tesseract4android-4.1.0-runtime (cz.adaptech.tesseract4android:tesseract4android:4.1.0) and jetified-tesseract4android-openmp-4.1.0-runtime (cz.adaptech.tesseract4android:tesseract4android-openmp:4.1.0)
     Duplicate class com.googlecode.leptonica.android.Boxa found in modules jetified-tesseract4android-4.1.0-runtime (cz.adaptech.tesseract4android:tesseract4android:4.1.0) and jetified-tesseract4android-openmp-4.1.0-runtime (cz.adaptech.tesseract4android:tesseract4android-openmp:4.1.0)
     Duplicate class com.googlecode.leptonica.android.Clip found in modules jetified-tesseract4android-4.1.0-runtime (cz.adaptech.tesseract4android:tesseract4android:4.1.0) and jetified-tesseract4android-openmp-4.1.0-runtime (cz.adaptech.tesseract4android:tesseract4android-openmp:4.1.0)
     Duplicate class com.googlecode.leptonica.android.Constants found in mod

Thanks!

Add preserve_interword_spaces=1 argument

Hi, when I OCR Japanese text, it comes out with random spaces.

This can be easily fixed by adding "-c preserve_interword_spaces=1" as an argument when executing tesseract.

I tried it on my PC with the same result. Adding that argument fixes the issue.

For what I've been reading, it's the same for Chinese and Korean, (though I haven't tried with those) so maybe there should be an option to enable / disable that specific argument, as these languages don't have any interword spaces whatsoever.

Import pictures from gallery

Pressing the gallery button shows only camera to choose, please add an option to choose pics from gallery also

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.