B4A Library OCR

This library will extract text from images via OCR.

Requirements:

1- B4A 3.82.

2- Get an API Key HERE (you need to create an account).

3- Internet connection.


How to install:

- Copy the OCR.jar and OCR.xml to your additional libraries directory.

Usage:
B4X:
Expand Collapse Copy
Private myOCR As OCR

myOCR.Initialize(Me, "myOCR", "<YOUR_API_KEY>")

myOCR.ExtractFromImage(File.Combine(File.DirAssets, "sample.gif"), "", "scene", 20000)

That's it.

You can upload an image or reference one via a URL, the service will return the extracted text (if any).


NOTES:

- OCR is not perfect, so, expect some weird results or no results at all.

- It is a free service but some quotas apply.


For more details, see the attached project.
 

Attachments

Last edited:
@NJDude you know the diference of scene , Photo etc?
I see the coments on your lib, but working i realy dont see diference
what you recomend to use?
 
The default is "photo", but in some cases you have to use the other ones depending on what kind of picture you are submitting, you will see that in some cases the default (photo) will not return any text and by changing it to scan (or any other) it will, you will have to try.
 
i go make a chosse option when user go send
and about socket time error?
its possible add on the request a timeout? 60000 seconds etc ?
 
thx man, the requests for portuguese is more time *-* sometimes works in 20s , english is very fast *-*
i go wait thx
 
Very cool! I fed it a php source code file saved as a gif. It did a great job for a work in progress. Do you know if it works better with a particular Windows font and size? I'd like to play around with it some more.
It is hard to say, OCR can be very picky, but, so far, during testing it did a decent job.
 
Hi,

I have tested in android 2.3.6 it is working fine, but in 4.0.4 its showing error " javax.net.ssl.sslpeerunverifiedexception no peer certificate ".

plz help me to fix this.

Thanks
 
I obviously appreciate (and "Like"d) this in your library and your job, NJDude.

But I'm thinking about how many times we rest to external sites for our apps: and if the site in question shut?

I should open a thread for this, although I do not know exactly where.

I'll do it in chit-chat with a reference in the questions
 
Hi NJDude.
One question... but work only with characters latin. Because with russian , chinese characters dont work.
Any idea ?
Thank's
 
Back
Top