Esempio n. 1
0
    if image is None:
        quit = True
        return
   
    if stamp_begin < 0.0:
        stamp_begin = time.time()

    pred = cf.predicate(image)
    stamp = time.time() - stamp_begin

    # FIXME: 使用 'CR:' 作为一条分析结果的前缀,解析起来更方便 :)
    print "CR:", stamp, pr(pred[0][1]), pred[0][2], pr(pred[1][1]), pred[1][2], pr(pred[2][1]), pred[2][2]
    sys.stdout.flush()


def pr(s):
    global curr_encoding
    return s.decode('UTF-8').encode(curr_encoding)


quit = False
vc.start(cb_image)

while not quit:
    time.sleep(0.5)

vc.stop()

# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4