예제 #1
0
def single_image():
    detection = bool(request.args.get('detection', False))
    frame = Camera().get_frame()
    if detection:
        frame = Camera().prediction(frame)
    return json.dumps(
        dict(img=Camera().img_to_base64(frame), width=WIDTH, height=HEIGHT))
예제 #2
0
def single_image():
    detection = bool(request.args.get('detection', False))
    tracking = bool(request.args.get('tracking', False))
    frame = Camera().get_frame()
    if detection:
        frame = predictor.prediction(frame, conf_th=0.3, conf_class=[])
    elif tracking:
        frame = predictor.object_track(frame, conf_th=0.5, conf_class=[1])
    return json.dumps(
        dict(img=predictor.img_to_base64(frame), width=WIDTH, height=HEIGHT))
예제 #3
0
def video_feed():
    """Video streaming route. Put this in the src attribute of an img tag."""
    return Response(gen(Camera()),
                    mimetype='multipart/x-mixed-replace; boundary=frame')