Copying text from a label or a text embedded in image

Asked by Ruwan Pushpakumara

Hi,

I have a question on copying text from a label or copying a text which is embedded in an image. Is there are way to achieve this objective?

Thanks,
rpk

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

either simulate a select&copy (if possible) which sends it to the clipboard and use Env.getClipboard() or us
Region.text() try to OCR-read the text having the region as small as possible surrounding the text to read.

Revision history for this message
Ruwan Pushpakumara (belikeharry) said :
#2

RaiMan, Copy option is not available in this situation. How reliable it is to use Region.text() to copy text on an image ?

Revision history for this message
Ninja Mustang (ninjamustang) said :
#3

I tried to use Region.text() too to grab text from Flash GUI but it didn't seem to work well, especially the "-" but it gave me "?" instead. The area was about 20 characters.

Revision history for this message
RaiMan (raimund-hocke) said :
#4

When using RC3 currently, then you might check version 1.0.1.

But if it does not work reliable enough, then there is no chance with current Sikuli OCR implementation.

If you only have a few reproducible false positives, then you might correct the read text afterwards based on these "rules"

If it is vital for your workflow and speed is not an issue, then you might try to use the Tesseract command and let it act on a somehow optimised image (use ImageMagick e.g.). This can be managed using the run feature in a Sikuli script or use subprocess/Popen on the script level.

Can you help with this problem?

Provide an answer of your own, or ask Ruwan Pushpakumara for more information if necessary.

To post a message you must log in.