def draw_camera(): try: ai_camera.ai_draw() ui.display() except Exception as e: app.layer = 1 raise e
def draw_camera(): try: ai_camera.ai_draw() for model in ai_camera.models: #print(model.__qualname__, ai_camera.model.__qualname__) if 'ai_sample' == ai_camera.model.__qualname__: ui.canvas.draw_string(60, 170, "AI Demo", scale=3) ui.canvas.draw_string(10, 210, "Press (<) or (>) to View", scale=2) pass elif 'FaceReco' == ai_camera.model.__qualname__: if ai_camera.model.bbox != None: bbox = ai_camera.model.bbox ui.canvas.draw_string(10, 210, "Find Face %d" % len(bbox), scale=2) else: ui.canvas.draw_string(10, 210, "Find Face Reco", scale=2) elif 'find_color' == ai_camera.model.__qualname__: ui.canvas.draw_string(10, 210, "Find Color For Red", (255, 0, 0), scale=2) elif 'HowMany' == ai_camera.model.__qualname__: if ai_camera.model.things != None: ui.canvas.draw_string(10, 210, "How many %d" % len(ai_camera.model.things), scale=2) ui.canvas.draw_string(10, 210, "How many?", scale=2) elif 'MaybeIs' == ai_camera.model.__qualname__: ui.canvas.draw_string(10, 210, "Maybe Is %s" % str(ai_camera.model.result), scale=2) ui.display() except Exception as e: app.layer = 1 gc.collect() raise e
def draw_camera(): try: ai_camera.ai_draw() for model in ai_camera.models: #print(model.__qualname__, ai_camera.model.__qualname__) if 'ai_sample' == ai_camera.model.__qualname__: ui.canvas.draw_string(340, 80, " AI\nDemo", scale=5) ui.canvas.draw_string(50, 260, "Press Left (<) or Right (>) to View", scale=2) pass elif 'FaceReco' == ai_camera.model.__qualname__: if ai_camera.model.bbox != None: bbox = ai_camera.model.bbox ui.canvas.draw_string(50, 260, "Find Face %d" % len(bbox), scale=5) for pos in range(len(bbox)): i = bbox[pos] # print(i.x(), i.y(), i.w(), i.h()) face_cut = ui.canvas.cut(i.x(), i.y(), i.w(), i.h()) face_cut_128 = face_cut.resize(80, 80) ui.canvas.draw_image(face_cut_128, 320 + int((pos % 2)*80), int((pos // 2)*80)) else: ui.canvas.draw_string(50, 260, "Find Face Reco", scale=5) elif 'find_color' == ai_camera.model.__qualname__: ui.canvas.draw_string(50, 260, "Find Color For Red (53, 31, 44, 82, 18, 78)", scale=2) ui.canvas.draw_string(50, 260, " Red", color=(255,0,0), scale=2) ui.canvas.draw_string(340, 30, "Red\nSum\n %d" % len(ai_camera.model.blobs), scale=5) elif 'HowMany' == ai_camera.model.__qualname__: if ai_camera.model.things != None: ui.canvas.draw_string(340, 30, "How\nMany\n %d" % len(ai_camera.model.things), scale=5) ui.canvas.draw_string(50, 260, "How many things are there?", scale=2) elif 'MaybeIs' == ai_camera.model.__qualname__: ui.canvas.draw_string(340, 50, "Maybe\n Is\n", scale=3) ui.canvas.draw_string(340, 150, "%s" % str(ai_camera.model.result), scale=2) ui.canvas.draw_string(50, 260, "What is likely to be?", scale=2) app.touch_draw() ui.display() except Exception as e: # ai_camera.next() # protect.restart() # temp patch app.layer -= 1 raise Exception("This is a Easter egg(Known Bug) This error requires a restart. It will soon be resolved. :)")