← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #251785]: compare two screenshots without know the path

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
--- I need to compare two images.
not really clear what that should mean.

… because what you are trying to do is comparing the 2 rectangles
(matches), where the image was found on the screen.

 image1==image2
will always be False, since these are 2 different objects (which might have the same content).
This is by design (Python)

But even if you would compare the Match contents: these will always be
different too, because they (I suppose region1 and region2 are distinct
areas on the screen) have different coordinates on the screen.

So a question might be:
If image is found in region1, is it then found in region2 also?

if region1.exists(image): # wait 3 seconds
    if region2.exists(image, 0): # no wait
        print "both exists"
    else:
        print "exists in 1 but not in 2"
else:
    print "does not exist in 1"

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