Find an image gives error

Asked by Ed Chmiel

I am a newbie, and did not find an answer in forums. Using Windows 10 & 1.1.4 IDE, I double click my app icon, and another double click to launch it into the app where it displays some images.

- I took a screenshot of the app icon, added doubleClick()
- I took another screenshot of the area to double click to launch into the image display, added doubleClick() there too.

So far so good, launches as expected. Next,

- took a screenshot of the app and saved into the folder.
- next: match = "C:\SikuliX\pw1.sikuli\1558389881477.png"
- returnMatch = find(match)

The screen capture png is roughly 2500 x 1400, and my screen is ultraHD (3480x2160). I read in one of the posts to have the screen capture smaller than the screen.

On the Run, it launches the app, but gives an error.
The error output is:
[log] DOUBLE CLICK on L[113,546]@S(0) (578 msec)

[log] DOUBLE CLICK on L[1276,616]@S(0) (575 msec)
[debug] Region: find: waiting 0 secs for C:/SikuliX/pw1.sikulim8389881477.png to appear in R[0,0 2560x1440]@S(0)
[debug] Region: find: C:/SikuliX/pw1.sikulim8389881477.png did not appear [0 msec]
[debug] Region: handleFindFailed: C:\SikuliX\pw1.sikulim8389881477.png
[error] script [ pw1 ] stopped with error at line --unknown--
[error] Error caused by: Traceback (most recent call last): File "C:\SikuliX\pw1.sikuli\pw1.py", line 5, in <module> returnMatch = find(match) Line 2407, in file Region.java
at org.sikuli.script.Region.find(Region.java:2407)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
org.sikuli.script.FindFailed: FindFailed: C

:/SikuliX/pw1.sikulim8389881477.png not loaded Line 2407, in file Region.java

Am I doing something wrong? I read the info on matching, and this seems like it should since the images are exactly the same except for resolution.

Question information

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

-- 1. when using the IDE for your scripting, then you should use the capture button to create your images, which are then saved with the script in a .sikuli folder (if you save the script ;-)

--2. windows file name strings in SikuliX IDE have to be written either

"c:\\folder\\subfolder\\image.png"
(hence the backslashes have to be doubled)

or as
r"c:\folder\subfolder\image.png"
(meaning it is a raw string - each character taken as is)

or as
"c:/folder/subfolder/image.png"
(works because inside we use Java)

Revision history for this message
Ed Chmiel (edthec-csd) said :
#2

Thank you for the reply.

I replaced the file name as suggested, and also tried launching the program such that the app window is the approximate size of the match png. The error shows below as no match.

Am I mis-understanding the ability of the program to compare screens?

Also, why is one image INT_RGB (2560x1440) and the other 3BYTE_BGR (2554x1394)? Could this be the problem?

Thanks in advance.

[log] DOUBLE CLICK on L[113,546]@S(0) (573 msec)

[log] DOUBLE CLICK on L[1276,616]@S(0) (571 msec)
[debug] Image: reused: 1558389881477.png (file:/C:/SikuliX/pw1.sikuli/1558389881477.png)
[debug] Region: find: waiting 0 secs for 1558389881477.png to appear in R[0,0 2560x1440]@S(0)

[debug] Finder2: makeMat: INT_RGB (2560x1440)
[debug] Finder2: makeMat: 3BYTE_BGR (2554x1394)

[debug] Finder2: doFind: start (stdDev: 295.1653 mean: 274.987375)

[debug] Finder2: doFind: in original: %3.8143 (?70) 282 msec
[debug] Finder2: doFind: end 282 msec
[debug] Region: find: 1558389881477.png did not appear [463 msec]
[debug] Region: handleFindFailed: C:\sikulix\pw1.sikuli\1558389881477.png
[error] script [ pw1 ] stopped with error at line --unknown--
[error] Error caused by: Traceback (most recent call last): File "C:\SikuliX\pw1.sikuli\pw1.py", line 7, in <module> returnMatch = find(match) Line 2407, in file Region.java
at org.sikuli.script.Region.find(Region.java:2407)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
org.sikuli.script.FindFailed: FindFailed: 1558389881477.png: (2554x1394) in R[0,0 2560x1440]@S(0) Line 2407, in file R

egion.java

Revision history for this message
Ed Chmiel (edthec-csd) said :
#3

Forgot to mention screen captured with IDE capture button.

Is there anyway to attach screen shots and/or files to these questions?

Revision history for this message
Ed Chmiel (edthec-csd) said :
#4

OK, has nothing to do with any of the suggestion, but rather the fact that one must wait for the image.
By adding a wait(<my image to wait for>) solved it and the area was found.

Hope this helps other newbies...

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

--- Is there anyway to attach screen shots and/or files to these questions?
sorry, no, not possible.

you have to store the shots somewhere in the net and post a link here.