← Back to team overview

sikuli-driver team mailing list archive

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: Needs information => Open

Leo Adberg gave more information on the question:
Ok, here is the section of my code that is causing trouble:

def by_y(match):
    return match.y
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=by_y)
redmidx = 0 #I want the average X position of the 3 best matches
for i in sorted_reds:
    redmidx = redmidx + i.getCenter().getX()
    print i.getX() #Just for debugging, and I can see that this will sometimes give more that 3 matches
redmidx = redmidx / 3

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