sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #30997
Re: [Question #263444]: How to compare 2 regions
Question #263444 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/263444
Status: Open => Answered
RaiMan proposed the following answer:
@aidma
very good points :-)
--1 if str(tableRegion) == str(tableRegion1):
should work, but I just realized, that I should implement the equals() method with the main objects like Region, Location, Screen, Pattern, … in the meaning, that the attributes are compared (with Region e.g. x, y, w, h)
Then we might want a method like region1.similar(region2), that returns
the similarity score by comparing the region's visual content (if
different size: the intersection top-left-aligned).
… stuff for version 2 ;-)
--2 comparing the visual content
… is possible rather easy:
(supposing region2 is not larger than region1 in width nor in height):
f = Finder(capture(region1))
f.find(capture(region2))
if f.hasNext():
print "score=", f.next().getScore()
else:
print "not equal"
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.