Need to see differences from getScore()..can I save the temporary image from find() command?

Asked by Mike Muhlada

I'm new to Sikuli and fairly new to Python.

Running Sikulix IDE 1.1.0, Build: 2015-10-05_17:07 on a Mac (macOS Sierra, Version 10.12)

I'm enjoying this new, powerful tool, but I'm running into a problem. I can't tell why I am not getting a high similarity score. I would like to be able to do a DIFF of the 2 images to see the actual pixel differences, not just a percentage.

I looked through the FAQ and saw several Questions. I've tried to 'print' the temporary location using this code (probably wrong):

..................
F_Window = find(<Window image.png>)
fDisplay = F_Window.find(<subset of F_Window.png>
print fDisplay

score = fDisplay.getScore()
try: assert (score > .999)
...................
What is printed in the IDE log/Message area is: "M[1108,356 67x66]@S(S(0)[0,0 1920x1080]) S:0.85 C:1141,389 [35 msec]"

This doesn't tell me where to find that temporary file that it is comparing. I have a tool I can use to compare the images. I have the 'benchmark' image, but can't get to the find() image.

1) Can you show me how to find that temporary image?

2) Is there a way to visually display the differences after '.getScore()'?

NOTE: I also see there is a version 1.1.1 with daily builds. Should I upgrade to that? It would probably help my Mac screenshot issues (get blank snapshot screen very often on Mac).
 - I noticed in your Changelog for 1.1.1 you talked about a getImageFilename and getImagePath. Could those help in this case?

THANKS for you help!

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
masuo
Solved:
Last query:
Last reply:
Revision history for this message
Best masuo (masuo-ohara) said :
#1

If you want to confirm match object on the screen when SikuliX is running, you can use highlight().
[example1:]
r = find("image.png").highlight(2)

If you want to confirm match object when SikuliX is done, you can use capture().
[example2:]
import shutil
r = find("image.png")
tempfile = capture(Region(r))
savefile = "w:\\temp\\100.png" # w:\temp must be prepared
shutil.move(tempfile,savefile)

Revision history for this message
masuo (masuo-ohara) said :
#2
Revision history for this message
Mike Muhlada (mike-muhlada) said :
#3

Thank you.

This was the right approach. I was able to copy the image to my hard drive and can now perform an image diff to debug my program.

Thanks for the quick and accurate response!

Revision history for this message
Mike Muhlada (mike-muhlada) said :
#4

Thanks masuo, that solved my question.