def run_visualization(
    cap: cv2.VideoCapture,
    out: cv2.VideoWriter,
    detection_pipeline: pipeline.DetectionPipeline,
) -> List[Dict[ID, detect.ObjectDetection]]:
    ret, frame = True, None
    frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
    i = 1
    pbar = tqdm(total=frame_count)
    objects = dict()
    while cap.grab():
        pbar.update(1)
        ret, frame = cap.retrieve(frame)
        # run detections on passed in frames
        detections = detection_pipeline(frame)

        for det in detections:
            objects[det.id] = det.obj_class

        visualization.draw_all_detections(img=frame,
                                          detections=detections,
                                          color=[255, 0, 0],
                                          font_face=cv2.FONT_HERSHEY_PLAIN,
                                          font_scale=5.0,
                                          thickness=3)

        #print('objects = ' + str(objects))
        out.write(frame)

    return objects.values()
def construct_scene_graph(
    cap: cv2.VideoCapture,
    detection_pipeline: pipeline.DetectionPipeline,
    scene_reconstructor: reconstruction.SceneReconstructor,
):
    '''
    return:void
    parameters: cap, detection_pipeline, scene_reconstructor
    definition: method calls scene_reconstructor functions
    '''
    frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
    frame = None
    i = 1
    pbar = tqdm(total=frame_count)
    while cap.grab():
        pbar.update(1)
        frame = cap.retrieve(frame)
        detections = detection_pipeline(frame)
        scene_reconstructor.add_frame(detections)
    return scene_reconstructor.finalize()