http://doc.sikuli.org/finder.html <-- another way for looking inside of something
Ideally Sikuli works if you already have an image that your comparing against what's found on the screen. Below I dynamically create a region, then snap a picture, and finally compare the saved picture against what in the dynamically created region.
imagePath1 = capture() #snapshots the screen
image1 = exists(imagePath1) #Create a Match object
imagePath2 = capture() #snapshots the screen
image2 = Pattern(imagePath2) #Create a Matach Object
myRegion = Region(image1) #make new region from the match object
if myRegion.exists(image2): #look in the region
print "hello" #yeah it's in the region of the screen
else:
print "hi" #nope not there....
This one is more like what you want i beleive. You can take three different pictures and then a smaller picture of the one yout want. If you call getScore()
it will return precent match http://doc.sikuli.org/match.html#Match
imagePath1 = capture('Match obj take large picture') # snapshots the screen
matchObj1 = exists(imagePath1) #Make match object
imagePath2 = capture('Match obj take large picture') # snapshots the screen
matchObj2 = exists(imagePath2) #Make match object
imagePath3 = capture('Match obj take large picture') # snapshots the screen
matchObj3 = exists(imagePath3) #Make match object
imagePath4 = capture('Target, take small picture') # snapshots the screen
patternIwant = Pattern(imagePath4) #Make a pattern object search against
matchList = [matchObj1, matchObj2, matchObj3]
for m in matchList:
arg = m.exists(patternIwant)
if arg != None:
print 'image score ', arg.getScore()
else:
print 'no match'
if m.exists(patternIwant):
print "hello"
else:
print "hi"