import camera import appuifw import math app=appuifw.app appuifw.app.title = u"Paperkeyboard" global a a = 0 dibujando = 1 # TODO EL TECLADO 004 s = [(150, 51, '1'), (136, 51, '2'), (119, 51, '3'), (104, 51, '4'), (89, 51, '5'), (71, 51, '6'), (55, 51, '7'), (40, 51, '8'), (25, 51, '9'), (10, 51, '0'), (150, 39, 'Q'), (136, 39, 'W'), (119, 39, 'E'), (104, 39, 'R'), (89, 39, 'T'), (71, 39, 'Y'), (55, 39, 'U'), (40, 39, 'I'), (25, 39, 'O'), (10, 39, 'P'), (150, 28, 'A'), (136, 28, 'S'), (119, 28, 'D'), (104, 28, 'F'), (89, 28, 'G'), (71, 28, 'H'), (55, 28, 'J'), (40, 28, 'K'), (25, 28, 'L'), (10, 28, 'N'), (150, 17, '?1'), (136, 17, 'Z'), (119, 17, 'X'), (104, 17, 'C'), (89, 17, 'V'), (71, 17, 'B'), (55, 17, 'N'), (40, 17, 'M'), (25, 17, '?2'), (10, 17, '?3'), (150, 7, '?4'), (136, 7, '?5'), (119, 7, '?6'), (104, 7, ' 7'), (89, 7, ' '), (71, 7, ' '), (55, 7, '?8'), (40, 7, '?9'), (25, 7, '?10'), (10, 7, '?11')] def rastrea(): for i in range(len(s)): global x, y, p x = s[i][0] y = s[i][1] p = s[i][2] comprueba() def comprueba(): im = camera.take_photo(mode='RGB12', size = (160,120)) global fond fond = 0 valor = im.getpixel((x, y)) r = valor[0][0] g = valor[0][1] b = valor[0][2] if r > 80: if g > 80: if b > 80: if (math.fabs(r-g) + math.fabs(g-b)) > 60: if (math.fabs(r-g) + math.fabs(g-b)) < 90: global fond fond = 1 print p if fond == 0: print "#" while dibujando: rastrea()