Exemplo n.º 1
0
def change_stream_method(option=''):
    # DEBUG: why do I need the global Camera?
    global Camera
    # when not specify option, use the request
    if option is '':
        new_stream_method = request.args.get('stream_method', 'PiCamera')
        option = new_stream_method

    if option == 'OpenCV':
        print('Change the stream method to OpenCV')
        # only change the stream method if the current one is not right
        if Camera.stream_method == 'PiCamera':
            Camera.stop_stream()
            from camera_pi_cv import Camera
            Camera.stream_method = 'OpenCV'
            Camera.start_stream()
            time.sleep(0.1)
    
    elif option == 'PiCamera':
        print('Change the stream method to Picamera')
        # only change the stream method if the current one is not right
        if Camera.stream_method == 'OpenCV':
            Camera.stop_stream()
            from camera_pi import Camera
            Camera.stream_method = 'PiCamera'
            Camera.start_stream()
            time.sleep(0.1)
Exemplo n.º 2
0
def index():
    """Video streaming home page."""
    Camera.start_stream()
    initialise_serial_connection()
    return render_template('index.html')