コード例 #1
0
rgb_ext = {'primesense': 'png', 'kinect': 'png', 'canon': 'jpg'}
obj_colors_path = os.path.join('data', 'obj_rgb.txt')
vis_rgb_path_mask = os.path.join(output_dir, '{:02d}_{}_{}_{:04d}_rgb.png')
vis_depth_path_mask = os.path.join(output_dir,
                                   '{:02d}_{}_{}_{:04d}_depth_diff.png')

misc.ensure_dir(output_dir)
obj_colors = inout.load_colors(obj_colors_path)

plt.ioff()  # Turn interactive plotting off

for scene_id in scene_ids:

    # Load info about the test images (including camera parameters etc.)
    scene_info_path = scene_info_path_mask.format(device, scene_id)
    scene_info = inout.load_info(scene_info_path)

    scene_gt_path = scene_gt_path_mask.format(device, scene_id)
    scene_gt = inout.load_gt(scene_gt_path)

    # Load models of objects present in the scene
    scene_obj_ids = set()
    for gt in scene_gt[0]:
        scene_obj_ids.add(gt['obj_id'])
    models = {}
    for scene_obj_id in scene_obj_ids:
        model_path = model_path_mask.format(scene_obj_id)
        models[scene_obj_id] = inout.load_ply(model_path)

    for im_id, im_info in scene_info.items():
        if im_id % im_step != 0:
コード例 #2
0
                                   '{:02d}_{}_{}_{:04d}_depth_diff.png')

misc.ensure_dir(output_dir)
obj_colors = inout.load_colors(obj_colors_path)

plt.ioff()  # Turn interactive plotting off

for obj_id in obj_ids:

    # Load object model
    model_path = model_path_mask.format(obj_id)
    model = inout.load_ply(model_path)

    # Load info about the templates (including camera parameters etc.)
    obj_info_path = obj_info_path_mask.format(device, obj_id)
    obj_info = inout.load_info(obj_info_path)

    obj_gt_path = obj_gt_path_mask.format(device, obj_id)
    obj_gt = inout.load_gt(obj_gt_path)

    for im_id in obj_info.keys():
        if im_id % im_step != 0:
            continue
        print('obj: ' + str(obj_id) + ', device: ' + device + ', im_id: ' +
              str(im_id))

        im_info = obj_info[im_id]
        im_gt = obj_gt[im_id]

        # Get intrinsic camera parameters and object pose
        K = im_info['cam_K']
コード例 #3
0
depth_path_mask = os.path.join(data_path, 'test_{}', '{:02d}', 'depth', '{:04d}.png')
rgb_ext = {'primesense': 'png', 'kinect': 'png', 'canon': 'jpg'}
obj_colors_path = os.path.join('data', 'obj_rgb.txt')
vis_rgb_path_mask = os.path.join(output_dir, '{:02d}_{}_{}_{:04d}_rgb.png')
vis_depth_path_mask = os.path.join(output_dir, '{:02d}_{}_{}_{:04d}_depth_diff.png')

misc.ensure_dir(output_dir)
obj_colors = inout.load_colors(obj_colors_path)

plt.ioff() # Turn interactive plotting off

for scene_id in scene_ids:

    # Load info about the test images (including camera parameters etc.)
    scene_info_path = scene_info_path_mask.format(device, scene_id)
    scene_info = inout.load_info(scene_info_path)

    scene_gt_path = scene_gt_path_mask.format(device, scene_id)
    scene_gt = inout.load_gt(scene_gt_path)

    # Load models of objects present in the scene
    scene_obj_ids = set()
    for gt in scene_gt[0]:
        scene_obj_ids.add(gt['obj_id'])
    models = {}
    for scene_obj_id in scene_obj_ids:
        model_path = model_path_mask.format(scene_obj_id)
        models[scene_obj_id] = inout.load_ply(model_path)

    for im_id, im_info in scene_info.items():
        if im_id % im_step != 0: