def draw_debug_text(fr, text_type, rate, flow_fn, tot_frs_wrt, pair_a, pair_b,
                    btw_idx, fr_type, is_dup, tgt_frs, frs_wrt, sub, sub_idx,
                    subs_to_render, drp_every, dup_every, src_seen, frs_int,
                    frs_drp, frs_dup):
    if not fr_big_enough_to_draw_on(fr,
                                    settings['txt_w_fits'],
                                    settings['txt_h_fits']):
        return
    w = fr.shape[1]
    h = fr.shape[0]
    scale = min(min(float(w)/settings['txt_w_fits'], settings['txt_max_scale']),
                min(float(h)/settings['txt_h_fits'], settings['txt_max_scale']))

    if text_type in ['light', 'stroke']:
        color = settings['light_color']
    else:
        color = settings['dark_color']

    draw_strk = lambda x, y: \
        cv2.putText(fr,
                    x,
                    y,
                    settings['font_face'],
                    scale,
                    settings['dark_color'],
                    settings['strk_thick'],
                    settings['font_type'])
    draw_text = lambda x, y: \
        cv2.putText(fr,
                    x,
                    y,
                    settings['font_face'],
                    scale,
                    color,
                    settings['txt_thick'],
                    settings['font_type'])

    txt = "butterflow {} ({})\n"\
          "Res: {}x{}\n"\
          "Playback Rate: {:.2f} fps\n"
    txt = txt.format(__version__, sys.platform, w, h, rate)

    argspec = inspect.getargspec(flow_fn)
    defaults = list(argspec.defaults)
    args = argspec.args[-len(defaults):]
    flow_kwargs = collections.OrderedDict(zip(args, defaults))

    if flow_kwargs is not None:
        flow_format = ''
        i = 0
        for k, v in flow_kwargs.items():
            value_format = "{}"
            if isinstance(v, bool):
                value_format = "{:1}"
            flow_format += ("{}: " + value_format).format(k.capitalize()[:1], v)
            if i == len(flow_kwargs)-1:
                flow_format += '\n\n'
            else:
                flow_format += ', '
            i += 1
        txt += flow_format

    txt += "Frame: {}\n"\
           "Pair Index: {}, {}, {}\n"\
           "Type Src: {}, Int: {}, Dup: {}\n"\
           "Mem: {}\n"
    txt = txt.format(tot_frs_wrt,
                     pair_a,
                     pair_b,
                     btw_idx,
                     'Y' if fr_type == 'source' else 'N',
                     'Y' if fr_type == 'interpolated' else 'N',
                     'Y' if is_dup > 0 else 'N',
                     hex(id(fr)))

    for i, line in enumerate(txt.split('\n')):
        line_sz, _ = cv2.getTextSize(line,
                                     settings['font_face'],
                                     scale,
                                     settings['txt_thick'])
        _, line_h = line_sz
        origin = (int(settings['txt_l_pad']), int(settings['txt_t_pad'] +
                  (i * (line_h + settings['txt_ln_b_pad']))))
        if text_type == 'stroke':
            draw_strk(line, origin)
        draw_text(line, origin)

    txt = "Region {}/{}, F: [{}, {}], T: [{:.2f}, {:.2f}s]\n"\
          "Len F: {}, T: {:.2f}s\n"
    txt = txt.format(sub_idx,
                     subs_to_render,
                     sub.fa,
                     sub.fb,
                     sub.ta / 1000.0,
                     sub.tb / 1000.0,
                     (sub.fb - sub.fa) + 1,
                     (sub.tb - sub.ta) / 1000.0)

    def str_or_placeholder(str_fmt, str):
        if str is None:
            return settings['txt_placeh']
        return str_fmt.format(str)

    txt += "Target Spd: {} Dur: {} Fps: {}\n"
    txt = txt.format(str_or_placeholder('{:.2f}', sub.target_spd),
                     str_or_placeholder('{:.2f}s', sub.target_dur / 1000.0)
                     if sub.target_dur else settings['txt_placeh'],
                     str_or_placeholder('{:.2f}', sub.target_fps))
    txt += "Out Len F: {}, Dur: {:.2f}s\n"\
           "Drp every {:.1f}, Dup every {:.1f}\n"\
           "Src seen: {}, Int: {}, Drp: {}, Dup: {}\n"\
           "Write Ratio: {}/{} ({:.2f}%)\n"
    txt = txt.format(tgt_frs,
                     tgt_frs / float(rate),
                     drp_every,
                     dup_every,
                     src_seen,
                     frs_int,
                     frs_drp,
                     frs_dup,
                     frs_wrt,
                     tgt_frs,
                     frs_wrt * 100.0 / tgt_frs)

    for i, line in enumerate(txt.split('\n')):
        line_sz, _ = cv2.getTextSize(line,
                                     settings['font_face'],
                                     scale,
                                     settings['txt_thick'])
        line_w, line_h = line_sz
        origin = (int(w - settings['txt_r_pad'] - line_w),
                  int(settings['txt_t_pad'] +
                  (i * (line_h + settings['txt_ln_b_pad']))))
        if text_type == 'stroke':
            draw_strk(line, origin)
        draw_text(line, origin)
dataset/ETHPy150Open dthpham/butterflow/butterflow/draw.py/draw_debug_text/original