Skip to content

About RGBD visualization using open3d #82

@crazyggg1

Description

@crazyggg1

Hello! First, thank you for your great work on Fast3R. I'm trying to export camera poses and depth maps for downstream applications, but I'm encountering misalignment issues when visualizing results in Open3D and during view projection.
I'm exporting data using this code:

for view_idx, (view, camera_pose, focal, ptc) in enumerate(zip(output_dict['views'], camera_poses, focals, output_dict['preds'])):
    img_name = f"{view_idx:05d}.png"
    img = view["img"][0]
    true_shape = view["true_shape"][0]
    height, width = true_shape
    cx = width / 2.0
    cy = height / 2.0
    intrinsic = np.array([
        [focal, 0,  cx],
        [0,  focal, cy],
        [0,  0,  1]
    ])
    depthmap = ptc['depth']
    # depthmap = ptc['pts3d_in_other_view'][:, :, :, -1][0].cpu().numpy()
    bgr_img = cv2.cvtColor(rgb(img), cv2.COLOR_RGB2BGR)
    cv2.imwrite(os.path.join(imgs_save_dir, img_name), bgr_img * 255)
    cv2.imwrite(os.path.join(depths_save_dir, img_name), depthmap * 255)
    np.savez(
        os.path.join(camera_poses_save_dir, img_name.replace("png", "npz")),
        intrinsics=intrinsic,
        cam2world=camera_pose,
    )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions