Save image match data to metadata file

Asked by Thomas Woods on 2019-12-12

Hello, we have been using Sikuli for almost a year now and it has made our automation for a Unity based game much better. One issue we do have is the game is a 2d style design which consist of majority UI. The problem is the game is constantly getting updated graphics wise. The location of a button and where its at and the size of it always stays the same for the most part but the graphics will be updated with a new design and such. This requires me to go back through and recapture most of the images which is in the 1,000's at this point. So I was wondering if had any recomendations on how to save the last successful match to a properties file named the same as the image. Then when I had this feature enabled if it fails to find a match then it would proceed to read the region info and make a new capture in the same location the last match was found and add it to the current folder its going through looking for the image. There will be some images that are supposed to not return a match, but I planned to include a argument with it that tells the function whether this is a image that needs to be recaptured when that feature is enabled.

Is there any suggestions on how to handle this? I wanted to make sure I wasnt over complicating it by taking the match it just found and saving that xyz etc to a file named the same but with dfferent extension. Then when capturing used the built in capture to capture the new image and save it.

FYI: All of our code is in Java. Thanks for any suggestions they are much appreciated

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

Currently I do not have any feature for you ready, besides the FindFailed callback, where you could implement your auto-recapture.

The match-history is an intersting idea, but you have to implement it yourself currently.

An option of course is to switch on Debug logging at level 3 (Debug.on(3)) and let the log be written to alogfile (setLogFile()).

Then for each successful find-op you will get something like this:
[debug] Region: find: waiting 0 secs for image.png to appear in R[0,0 1920x1200]@S(0)
[debug] Finder2: makeMat: INT_RGB (1920x1200)
[debug] Finder2: makeMat: 3BYTE_BGR (111x64)
[debug] Finder2: doFind: start (stdDev: 201,8497 mean: 655,846143)
[debug] Finder2: doFind: in original: %100,0000 (?70) 258 msec
[debug] Finder2: doFind: end 258 msec
[debug] Region: find: image.png appeared (M[319,757 111x64]@S(0) S:1,00 C:374,789 [369 msec])

The last line tells you what you need.

On rerun, you just have to look for those lines in case.

The example is done with the latest 2.0.1 SikuliX version.

BTW: the dev version 2.1.0 (nightly builds available) has an experimental recorder feature in an early stage.
If you have a chance to try it and feedback - very welcome.

Thomas Woods (twoods196) said : #2

Hey thanks for the response. I will look into utizilizing the logs as suggested. I did not know about the recorder which was something else we were going to work on to have also. I noticed the release notes say it's for the IDE. Is the core functionality available on a java API level? As we currently use the java API only. Thanks!

Can you help with this problem?

Provide an answer of your own, or ask Thomas Woods for more information if necessary.

To post a message you must log in.