Пример #1
0
def main():
    parsInput()

    global args
    imgsIn = video_load(args.input)
    args.imgShape = imgsIn[0].shape
    video_init(
        args
    )  # Video module is initialized after first use since video_load is needed to get shape
    print("INFO : Loading video done")

    seg = Segment(args)
    listObj = seg.getObj(imgsIn[0])
    print("INFO : Digit and operator segmentation done")

    eq = Equation(listObj, args)

    listPos = seg.getArrow(imgsIn)
    print("INFO : Arrow segmentation done")

    imgsOut = []
    for i, im in enumerate(imgsIn):
        eqTemp = eq.newRobPos(listPos[i])
        imgTmp = draw_traj_on_pic(im, listPos[0:i + 1])
        imgTmp = write_text_on_pic(imgTmp,
                                   text="Frame {:02d} : {}".format(i, eqTemp),
                                   text_size=150,
                                   text_pos=(10, 10),
                                   text_color='red',
                                   background_color='white',
                                   background_dim=[(0, 0), (200, 30)])
        imgsOut.append(imgTmp)
    print("INFO : Image overlay done")

    video_export(args.output, imgsOut, False)
    print("INFO : Video export done")
    print("INFO : DONE")