示例#1
0
def main(args):
    # if args.dataset == 'kitti':
    dataset = KITTIOdometry(args.path)
    # elif args.dataset == 'vkitti':
    #     dataset = VKITTIOdometry(args.vkitti_path)
    # else:
    #     return ValueError()
    params = ParamsKITTI()
    cam = Camera(
        dataset.cam.fx, dataset.cam.fy, dataset.cam.cx, dataset.cam.cy, 
        dataset.cam.width, dataset.cam.height, 
        params.frustum_near, params.frustum_far, 
        dataset.cam.baseline)

    tracker = Tracker(params, cam)

    viewer = MapViewer(tracker, params)
    if args.view_map:
        viewer.load_points()
        return

    timer = RunningAverageTimer()
    
    durations = []

    try:
        for i in range(len(dataset)):
            j = i + 800

            # Data loading takes 0.036s
            left = dataset.left[j]
            right = dataset.right[j]

            print('track')
            
            tracker.update(i, left, right, timestamp=dataset.timestamps[j])
            
            print('update')
            # Viewer update takes 0.002s
            viewer.update(refresh=False)

            print(f'Frame {j}')

            # input("Press any key to continue...")
            # import time
            # time.sleep(2)
    except:
        pass
    finally:
        viewer.stop()
        viewer.save_points()
示例#2
0
    from params import ParamsKITTI, ParamsEuroc
    from dataset import KITTIOdometry, EuRoCDataset
    

    parser = argparse.ArgumentParser()
    parser.add_argument('--no-viz', action='store_true', help='do not visualize')
    parser.add_argument('--dataset', type=str, help='dataset (KITTI/EuRoC)', 
        default='KITTI')
    parser.add_argument('--path', type=str, help='dataset path', 
        default='path/to/your/KITTI_odometry/sequences/00')
    parser.add_argument('--output', type=str, help='storing output values')
    args = parser.parse_args()

    if args.dataset.lower() == 'kitti':
        params = ParamsKITTI()
        dataset = KITTIOdometry(args.path)
    elif args.dataset.lower() == 'euroc':
        params = ParamsEuroc()
        dataset = EuRoCDataset(args.path)

    sptam = SPTAM(params)

    visualize = not args.no_viz
    if visualize:
        from viewer import MapViewer
        viewer = MapViewer(sptam, params)


    cam = Camera(
        dataset.cam.fx, dataset.cam.fy, dataset.cam.cx, dataset.cam.cy, 
        dataset.cam.width, dataset.cam.height,