OCR multithreading using java

Asked by Ivan

sikuli 1.1.4, using in Java project.

Is it possible to use OCR feature for different region objects in different threads?

Scenario:
there are predefined sikuli region objects. I'm creating two threads (using runnable Thread) and trying to read text from them (region.text()).
As a result I get:
"Please call Init before attempting to set an image." when program is trying to get text.

There is another question that sounds similar:

Rule: only one SikuliX workflow on one machine at the same time.
No exceptions! (https://answers.launchpad.net/sikuli/+question/684947)

If the answer on my question is the same then what is the source of that limitation? Is that a tess4j or is it sikuli implementation? (in other is it possible to use tess4j to get text from images in different threads?)

Question information

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

--- Is it possible to use OCR feature for different region objects in different threads?

If you use threading with SikuliX, you have to coordinate the access to screen, mouse and keyboard, since this is the restriction: uncoordinated access to these resources from different threads (or even scripts) will most probably lead to a mess, especially when the threads act on different windows or even applications (visibility/focus).

Therefor the basic rule is: only one script at a time on the same machine.

Exceptions to the rule need special coordination efforts as mentioned above.

about the error message:
 It might be needed, to use an extra TextRecognizer instance (TextRecognizer.start()) in each thread.

Revision history for this message
ahmet sahin (ahmet69) said :
#2

Hi I have a "ui component". But this component can be viewed in 4 different ways. I want to capture it with multithreding and don't want to waste time on others after finding the current view. Is there a way?

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

no solution