def main(): image = bayer("itau02.png") template = bayer("keyboard.png") correlation = correlate(image, template) c_max = max(correlation) c_min = min(correlation) signal = (correlation - c_min) * 255 / (c_max - c_min) toimage(signal).save("signal.png") winner = where(correlation == c_max, 255, 0) toimage(winner).save("winner.png") print searchmax(winner)
def __init__(self, memory, *descriptors, **rois): r'''Creates a new visual map out of a memory object, a collection of object descriptors, and an optional dictionary of Regions of Interest (ROI's). ''' self.memory = bayer(memory) self.descriptors = dict(descriptors) self.rois = rois
def __call__(self, inputs=None, context=None): sight = context.memory[self.index] description = sight.descriptors[self.label] if inputs != None: return description(inputs, context=sight) while True: sleep(self.delay) inputs = percept(bayer(self.source)) try: return description(inputs, context=sight) except failure: pass
def main(): image = bayer('keyboard_seen.png') template = bayer('2.png') print templatesearch(image, template)
def __call__(self, context): inputs = percept(bayer(self.image)) return what.__call__(self, inputs, context)