vis/classify_live.py
def display_predict_on_frame(frame, skip_frames=0, predict_downscaled=True, display_downscaled=False,
                             h_c=True, s_c=True, v_c=True):
    """
    Display a video stream and classify each frame live.
    :param frame:
    :param skip_frames:
    :param predict_downscaled: predict on a downscaled version of the frame
    :param display_downscaled: display a downscaled version of the frame
    :param h_c: predict on hue channel
    :param s_c: predict on saturation channel
    :param v_c: predict on value channel
    :return: 
    """
    global PREV_LABEL
    label = PREV_LABEL
    prepped = geom.fill_img_for_fullscreen(frame)
    dst = prepped

    if skip_frames == 0 or (skip_frames > 0 and dsp.FRAME_COUNT % skip_frames == 0):
        downscaled = None
        if predict_downscaled:
            downscaled = geom.resize_img(frame, fx=0.4, fy=0.4)
            frame = downscaled
        ft_vec = get_live_ft_vec(frame, h_c=h_c, s_c=s_c, v_c=v_c)
        label = predict_label(CLF, ft_vec)
        if skip_frames > 0 and dsp.FRAME_COUNT % skip_frames == 0:
            PREV_LABEL = label
        if display_downscaled:
            prepped = geom.fill_img_for_fullscreen(downscaled)
            draw_label(prepped, label)

    draw_label(prepped, label)
    draw_menu(prepped)

    dsp.show_frame(dst, fullscreen=True)

    Display a video stream and classify each frame live.
    :param frame:
    :param skip_frames:
    :param predict_downscaled: predict on a downscaled version of the frame
    :param display_downscaled: display a downscaled version of the frame
    :param h_c: predict on hue channel
    :param s_c: predict on saturation channel
    :param v_c: predict on value channel
    :return: 
    
Display a video stream and classify each frame live.
Display a video stream and classify each frame live .
def display_predict_on_frame(frame, skip_frames=0, predict_downscaled=True, display_downscaled=False,
                             h_c=True, s_c=True, v_c=True):
    global PREV_LABEL
    label = PREV_LABEL
    prepped = geom.fill_img_for_fullscreen(frame)
    dst = prepped
    if skip_frames == 0 or (skip_frames > 0 and dsp.FRAME_COUNT % skip_frames == 0):
        downscaled = None
        if predict_downscaled:
            downscaled = geom.resize_img(frame, fx=0.4, fy=0.4)
            frame = downscaled
        ft_vec = get_live_ft_vec(frame, h_c=h_c, s_c=s_c, v_c=v_c)
        label = predict_label(CLF, ft_vec)
        if skip_frames > 0 and dsp.FRAME_COUNT % skip_frames == 0:
            PREV_LABEL = label
        if display_downscaled:
            prepped = geom.fill_img_for_fullscreen(downscaled)
            draw_label(prepped, label)
    draw_label(prepped, label)
    draw_menu(prepped)
    dsp.show_frame(dst, fullscreen=True)
def display_predict_on_frame ( frame , skip_frames = 0 , predict_downscaled = True , display_downscaled = False , h_c = True , s_c = True , v_c = True ) : global PREV_LABEL label = PREV_LABEL prepped = geom . fill_img_for_fullscreen ( frame ) dst = prepped if skip_frames == 0 or ( skip_frames > 0 and dsp . FRAME_COUNT % skip_frames == 0 ) : downscaled = None if predict_downscaled : downscaled = geom . resize_img ( frame , fx = 0.4 , fy = 0.4 ) frame = downscaled ft_vec = get_live_ft_vec ( frame , h_c = h_c , s_c = s_c , v_c = v_c ) label = predict_label ( CLF , ft_vec ) if skip_frames > 0 and dsp . FRAME_COUNT % skip_frames == 0 : PREV_LABEL = label if display_downscaled : prepped = geom . fill_img_for_fullscreen ( downscaled ) draw_label ( prepped , label ) draw_label ( prepped , label ) draw_menu ( prepped ) dsp . show_frame ( dst , fullscreen = True )
Display a video stream and classify each frame live.
Display a video stream and classify each frame live .
"""
    Display a video stream and classify each frame live.
    :param frame:
    :param skip_frames:
    :param predict_downscaled: predict on a downscaled version of the frame
    :param display_downscaled: display a downscaled version of the frame
    :param h_c: predict on hue channel
    :param s_c: predict on saturation channel
    :param v_c: predict on value channel
    :return: 
    """
None
frame
None
skip_frames
None
predict_downscaled
predict on a downscaled version of the frame
predict on a downscaled version of the frame
display_downscaled
display a downscaled version of the frame
display a downscaled version of the frame
h_c
predict on hue channel
predict on hue channel
s_c
predict on saturation channel
predict on saturation channel
v_c
predict on value channel
predict on value channel