← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #195190]: Preload Sikuli vision engine, VDictProxy, etc in Java

 

Question #195190 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/195190

Filipe Alonso posted a new comment:
Tks RaiMan.

By the way, if you want to try it yourself with the following code:
(change notepad.exe to other App in your Mac)

          System.out.println("preloading");

          new Finder((new Screen()).capture(0,0,1,1), new Screen());
          new App("").window();
          TextRecognizer.getInstance();
		
          System.out.println("starting");
		
          int i = 0;
          System.out.println((++i)+" Screen");
          Screen s = new Screen();

          System.out.println((++i)+" App: notepad.exe");
          App app = App.open("notepad.exe");

          System.out.println((++i)+" Sleep");
          Thread.sleep(500);

          System.out.println((++i)+" Type: Hello");
          s.type("Hello");

          System.out.println((++i)+" Find and highlight: Hello");
          app.window().find("Hello").highlight(2);

          System.out.println((++i)+" Highlight window");
          app.window().highlight(2);

          System.out.println((++i)+" Close");
          app.close();

This gives you the following output:

          preloading
          [info] Sikuli vision engine loaded.
          [info] Windows utilities loaded.
          [info] VDictProxy loaded.
          [info] Text Recognizer inited.
          starting
          1 Screen
          2 App: notepad.exe
          [log] App.open notepad.exe(552)
          3 Sleep
          4 Type: Hello
          [log] TYPE "Hello"
          5 Find and highlight: Hello
          [log] highlight Match[797,594 23x12 score=1,00 target=center] for 2.0 secs
          6 Highlight window
          [log] highlight Region[624,559 766x593]@Screen(0)[0,0 1920x1200] E:Y, T:3,0 E:Y, T:3,0 for 2.0 secs
          7 Close

# CASE SCENARIO 1
If you use preload it all runs smoothly and fast after "starting", although in preloading, after
          [info] Windows utilities loaded.
it takes about 2/3 seconds to print
          [info] VDictProxy loaded.

 # CASE SCENARIO 2
If you comment the preloading lines at the begining, this is the output:

          1 Screen
          [info] Windows utilities loaded.
          2 App: notepad.exe
          [log] App.open notepad.exe(5256)
          3 Sleep
          4 Type: Hello
          [log] TYPE "Hello"
          5 Find and highlight: Hello
          [info] Sikuli vision engine loaded.
          [info] VDictProxy loaded.
          [info] Text Recognizer inited.
          [log] highlight Match[797,594 23x12 score=1,00 target=center] for 2.0 secs
          6 Highlight window
          [log] highlight Region[624,559 766x593]@Screen(0)[0,0 1920x1200] E:Y, T:3,0 E:Y, T:3,0 for 2.0 secs
          7 Close
          [log] App.close notepad.exe(5256)

After printing "5 Find and highlight: Hello" it stops for 2/3 seconds
before printing "[info] Sikuli vision engine loaded." and then again 1/2
seconds before printing "[info] VDictProxy loaded.". After that
everything runs faster.

# ADDITIONAL NOTICE
Another thing i noticed was that, after typing "Hello" into notepad, I ask it to highlight it but it actually highlights the "Help" menu option from notepad, instead of the Hello typed in the textarea and still gives it a score of 1.00.

I would comply with the match if it gave a score of 0.90 or so, but 1.00
on "Help" when looking for "Hello" seems a bit weak OCR performance. Any
thoughts on this?

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.