def analyze(src, dst): detector = PlateDetector() while True: ts, id, img, bbox = src.get() if img is None: return try: code, bbox_code = detector.first(img) if code is not None: bbox_code = list(bbox_code) bbox_code[0] += bbox[0] bbox_code[1] += bbox[1] dst.put((id, ts, img, code, bbox_code)) except Exception as e: logging.debug('error analyzing frame') logging.error(e, exc_info=True)
os.makedirs(tmpdir) else: print 'directorio ya existe '+tmpdir c = cv2.VideoCapture(uri) cv2.namedWindow('e2',cv2.WINDOW_NORMAL) paused = False fc = 0 while True: fc = fc + 1 _, img = c.read() k = cv2.waitKey(20) if not _ or k==27: break; if k==ord('p'): paused = not paused if paused: time.sleep(1) continue code, bbox = finder.first(img) h, w = img.shape[:2] if code is not None: bx, by, bw, bh = bbox pa = img[by:by+bh, bx:bx+bw] img[h-bh:h,w-bw:w] = pa cv2.imwrite('{0}{1}{2}.{3}'.format(tmpdir, '/', fc,'jpg'), pa) print code cv2.imshow('e2',img) e = timer() logging.debug('tiempo de exe %s' % (e-s))