def run_feature(io_list=[('features/01', '01.pkl'), ('features/02', '02.pkl')],
                output_directory='features',
                batch=2):
    f = ImageFeature(image_feature_dir=output_directory,
                     extract_image_batch=batch)
    io_iter = iter(io_list)
    force_exit = False
    while force_exit == False:
        try:
            inputs, outputs = next(io_iter)
        except StopIteration:
            force_exit = True
            break
        print('input is:{}, output is:{}'.format(
            inputs, os.path.join(output_directory, outputs)))
        f.extract_image_feature(inputs, outputs)
    del f
Example #2
0
    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, 
        params.frustum_near, params.frustum_far, 
        dataset.cam.baseline)



    durations = []
    for i in range(len(dataset)):
        featurel = ImageFeature(dataset.left[i], params)
        featurer = ImageFeature(dataset.right[i], params)
        timestamp = dataset.timestamps[i]

        time_start = time.time()  

        t = Thread(target=featurer.extract)
        t.start()
        featurel.extract()
        t.join()
        
        frame = StereoFrame(i, g2o.Isometry3d(), featurel, featurer, cam, timestamp=timestamp)

        if not sptam.is_initialized():
            sptam.initialize(frame)
        else:
Example #3
0
    # "configs/caffe2/e2e_mask_rcnn_R_50_FPN_1x_caffe2.yaml"

    # update the config options with the config file
    cfg.merge_from_file(config_file)
    # manual override some options
    cfg.merge_from_list(["MODEL.DEVICE", args.device])
    coco_demo = COCODemo(
        cfg,
        min_image_size=800,
        confidence_threshold=0.7,
    )

    for i in range(n):
        iml = cv.imread(dataset.left[i], cv.IMREAD_UNCHANGED)
        imr = cv.imread(dataset.right[i], cv.IMREAD_UNCHANGED)
        featurel = ImageFeature(iml, params)
        featurer = ImageFeature(imr, params)
        timestamp = dataset.timestamps[i]

        time_start = time.time()

        t = Thread(target=featurer.extract)
        t.start()
        featurel.extract()
        t.join()


        print('{}. frame'.format(i))
        frame = StereoFrame(i, g2o.Isometry3d(), featurel, featurer, cam, timestamp=timestamp)

        if not sptam0.is_initialized():
Example #4
0
    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)

    durations = []

    if (args.mask != ''):
        f0 = open(args.mask + "-0.txt").readlines()
        f1 = open(args.mask + "-1.txt").readlines()

    for i in range(len(dataset))[:]:
        if (args.mask != ''):
            featurel = ImageFeature(
                dataset.left[i],
                params,
                filtering=[l.split(",") for l in f0[i].split("|")][:-1]
                if f0[i] != "\n" else None)
            featurer = ImageFeature(
                dataset.right[i],
                params,
                filtering=[l.split(",") for l in f1[i].split("|")][:-1]
                if f1[i] != "\n" else None)
        else:
            featurel = ImageFeature(dataset.left[i], params)
            featurer = ImageFeature(dataset.right[i], params)
        timestamp = dataset.timestamps[i]

        time_start = time.time()

        t = Thread(target=featurer.extract)
Example #5
0
    params = Params()
    ptam = RGBDPTAM(params)

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

    height, width = dataset.rgb.shape[:2]
    cam = Camera(dataset.cam.fx, dataset.cam.fy, dataset.cam.cx,
                 dataset.cam.cy, width, height, dataset.cam.scale,
                 params.virtual_baseline, params.depth_near, params.depth_far,
                 params.frustum_near, params.frustum_far)

    durations = []
    for i in range(len(dataset))[:]:
        feature = ImageFeature(dataset.rgb[i], params)
        depth = dataset.depth[i]
        if dataset.timestamps is None:
            timestamp = i / 20.
        else:
            timestamp = dataset.timestamps[i]

        time_start = time.time()
        feature.extract()

        frame = RGBDFrame(i,
                          g2o.Isometry3d(),
                          feature,
                          depth,
                          cam,
                          timestamp=timestamp)
Example #6
0
              'disp12MaxDiff': 1,
              'preFilterCap': 10,
              'uniquenessRatio': 15,
              'speckleWindowSize': 100,
              'speckleRange': 1,
              'mode': cv.STEREO_SGBM_MODE_SGBM_3WAY
              }

    if n:
        iml = cv.imread(dataset.left[0], cv.IMREAD_UNCHANGED)
        dseg = DynaSeg(iml, coco_demo, feature_params, disp_path, config, paraml, lk_params, mtx, dist, dilation)
        for i in range(n):
            iml = cv.imread(dataset.left[i], cv.IMREAD_UNCHANGED)
            imr = cv.imread(dataset.right[i], cv.IMREAD_UNCHANGED)
            # original
            featurel = ImageFeature(iml, params)
            featurer = ImageFeature(imr, params)
            timestamp = dataset.timestamps[i]

            time_start = time.time()

            t = Thread(target=featurer.extract)
            t.start()
            featurel.extract()
            t.join()


            print('{}. frame'.format(i))
            try:
                frame = StereoFrame(i, g2o.Isometry3d(), featurel, featurer, cam, timestamp=timestamp)