sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #25532
Re: [Question #247737]: Finding a certain number of objects in Region.findall()
Question #247737 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/247737
Status: Open => Answered
RaiMan proposed the following answer:
ROI = Region(352,348,405,197) #my region
reds = ROI.findAll(Pattern("Screen Shot 2014-04-26 at 2.03.26 PM.png").similar(0.55)) #The object I am looking for
sorted_reds = sorted(reds, key = lambda m: m.y)
redmidx = 0 #I want the average X position of the 3 best matches
# supposing it always gives at least 3 matches
for i in sorted_reds[:3]:
redmidx = redmidx + i.getCenter().x
print i # gives you the complete info about the match including score
redmidx = redmidx / 3
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.