Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello â I'm @olemoritz on Twitter.
Recognize text from picture
-
@mikael I had also seen that but it supports French, thus ...buggy?
-
BTW, I'm impressed from accuracy ( for Latin based texts ).
-
@mikael @cvp have you tried setting
customWords
attrib of the request? Or, turn offusesLanguageCorrection
? (Since the language is en-US you DON'T want language correction when trying to detect other languages!)I gather they are looking for words you'd find in an English dictionary. So perhaps façade, or tĂȘte-Ă -tĂȘte might recognize, while other examples wouldn't?
-
@JonB I didn't try but we are not alone with this problem, see here.
I've tried with unknown language codes like xx and yy in setRecognitionLanguages_ and the result is the same. It seems that characters are recognized in any languages.
My last test on a French text was entirely correctAsie-Pacifique La mission Ă©conomique belge en Chine cible de cyberattaques massives
-
@JonB said:
usesLanguageCorrection
Tried with False: Ă still recognized as a
Edit : even with
req.setCustomWords_(['Ă '])
-
Is there any code examples of how to recognize text with ios 12.4.3 for the i pad mini 2 that would be cool to add it to my sodoku app game
-
@sodoku, yes, but it seems a bit more involved. Check this thread where @cvp does all kinds of magic.
-
def pil2ui(pil_image): buffer = io.BytesIO() pil_image.save(buffer, format='PNG') return ui.Image.from_data(buffer.getvalue())
is memory leaking buffer which has been proven to crash Pythonista when multiple images are processed. A better approach is to use a context manager to force the .close().
def pil2ui(pil_image): with io.BytesIO() as buffer: pil_image.save(buffer, format='PNG') return ui.Image.from_data(buffer.getvalue())
-
Revisiting this.
Regardless of language restrictions, I have found the simple and reliable ability to pick text from paper to be useful for me almost weekly - URLs, email addresses, reservation codes, laptop serial numbers, etc.
With the use, I noted that the original script had some issues:
- Difficult to find and open when quickly needed.
- Slow to get from the picked photo to recognized text.
- Results are a pain to copy from the Console as it likes to jump around just as youâve selected the text to copy.
Point #1 was fixed with a simple Apple Shortcuts shortcut to make the script easy to run.
Point #3 was resolved by presenting the recognized text in a TableView, with tap to copy.
Point #2 took a bit more doing.
Pythonista
photos
module wants to return PIL images, and that results in two very slow conversions - first the module converts the UIImage to PIL, and then I converted that back to a PNG image for recognition. I found some @cvp code in this thread and replacedphotos
module withobjc_util
pickers, which return PNG data almost directly.And hey presto! Not just faster recognition, but instantaneous - and with much better quality than with the only contender app I could find (Prizmo Go).
Updated script here.
-
@mikael Thanks for your great đfor New Year
-
-
Happy last day of the decade to everyone who shares my calendar!
I finessed the script a bit with the ability to select, copy or share multiple items, and nicer icons.
@cvp, noted and wondered about the lack of the link for your handle, no idea why.
-
Does this work with the new iPad OS ????
-
@sodoku, do you mean if the latest versions have included robust support for non-English characters? Not to my knowledge.
-
So good news I got an iPhone 11 and Iâm testing this on it, for sudoku, do the pictures taken save anywhere when used, just curious if I have to delete them because after I use it the pictures donât show up in my pictures app
-
Also whatâs the updated code posted by Mikael on GitHub used for is it same as this one posted here or not because itâs so much longer and bigger then this code posted on the forum, is it a better version then this one on the forum
-
@sodoku, the code on Github is more of a tool, and much faster than the version at the beginning of this thread. For your purposes, you probably just want pieces of it.
It supports taking a picture normally and then selecting it from the photo library when you use the tool, or just snapping a quick âdisposableâ in-tool image which is not saved.
-
This post is deleted! -
So there are a few edits in this thread I donât know how to piece together to have the best edited version of this???
-
@sodoku, the one on github is the latest version.