Reading text on image

Is there any possibility to read any text on image imported on Perspective page.

You mean like text recognition from a png file?

Whats the goal?

1 Like

Thanks for reply.
Yes, want to read text on PNG file and also want animate that text with some color.

Not going to be possible.
Maybe with an svg. But cant you just upload the background image and fill in the text separately?

2 Likes

Ignition does not have any built in OCR capabilities, I just checked the module showcase but I don’t see any existing modules that do OCR parsing of an image for text, meaning the only way to do this in Ignition is to build your own module. If you can find a java library that does it you can build your own module and integrate it that way but I this won’t be any easy feat.

There are a number of python libraries however that do OCR like pytesseract. Perhaps you are better off trying to do the following - writing a (c)python script that uses one of the OCR libraries that you can call with a file path. Like python detecttext.py /some/path/myimage.png. If you get this working, then when an image is uploaded to your gateway via perspective you would run that script on the newly uploaded image using system.util.execute. Still complicated but less complicated than building a module from scratch imo.

oke but all that just to animate a text on an image? xd

@R_P
I guess you want the text for something else too…
What kinda images are we talking about? a print of a paper? a camera photo of a licence plate? a photo of a number on a box?
how important is accuray of the text? because ocr are not 100% accurate

Sounds like the point of his program is trying do OCR on user uploaded images, and the animated text I think is just to show the result

1 Like

yh i guess… its going to be hard to find something for python 2.7 that is accurate, unless you use some apicall to google’s ai maybe (which is proabably not going to be free).
One of our projects has a camera on a forklift connectede to google ai, to read text from boxes.
I havent really worked on that one, but i heard it was quite a bother to finetune to get a decent enough accuraty, and its not free

If the server that hosts the gateway has python 3.X installed you can run a regular python 3.X file with system.util.execute which greatly opens up the number of OCR libraries and options available to you, that is where I was going with this. If the gateway does not have or does not allow you to install CPython then yes this is going to become either very difficult or very costly.

And as you mentioned accuracy is limited regardless.

1 Like

system.util.execute does not return anything though… and your python3 script cant interact with the gateway, i guess it could write to something else, but an ocr takes a while to read the text, so timing to get a result will be quite a bother xd

1 Like

You can absolutely get results out of system.util.execute. I do this with a winscp script I use to log results of SFTP file transfers. Alternatively he could have his python script log directly to a text file that the gateway can look at or give his python script the db credentials to write directly to the database that Ignition is also looking at.

Timing will definitely be a problem though.

1 Like

You can?
image

Using the webdev module could work with a post event, that would fix timing i guess…

2 Likes

I misspoke I don’t use system.util.execute, I use the subprocess command, then you can get the std out of there with a little finagling.

But honestly I imagine the easiest way to do this is storing the image as a blob in a database and having a varchar column with the result of the OCR that the python script writes to directly.

2 Likes

This is all speculation intil the OP can tell us what the application is.
image

7 Likes

Sorry, its a busy work day and I’m distracting myself, or its a slow work day and I’m distracting myself, still haven’t figured out which yet

@R_P what is the main goal of your program?

1 Like

Hi All,
Thanks for opinions.
I m explaining my goal here.
I am importing new png image for every new assembly in Perspective.
There are different sections in assembly which we want to mark it as complete with some color. As assembly image is always different so i cant locate fix position of sections. I am planning to read section name as text on png image and its position on image so i can place some animated object on that location automatically

I would strongly, strongly recommend setting up barcodes to scan for guaranteed perfect data entry. Even if you get this OCR method to work, it’ll never have perfect accuracy.

4 Likes