SUN dataset

This tutorial reads and visualizes an RGBDImage of the SUN dataset [Song2015].

 5# examples/Python/Basic/rgbd_sun.py
 6
 7import open3d as o3d
 8import matplotlib.pyplot as plt
 9
10if __name__ == "__main__":
11    print("Read SUN dataset")
12    color_raw = o3d.io.read_image(
13        "../../TestData/RGBD/other_formats/SUN_color.jpg")
14    depth_raw = o3d.io.read_image(
15        "../../TestData/RGBD/other_formats/SUN_depth.png")
16    rgbd_image = o3d.geometry.RGBDImage.create_from_sun_format(
17        color_raw, depth_raw)
18    print(rgbd_image)
19    plt.subplot(1, 2, 1)
20    plt.title('SUN grayscale image')
21    plt.imshow(rgbd_image.color)
22    plt.subplot(1, 2, 2)
23    plt.title('SUN depth image')
24    plt.imshow(rgbd_image.depth)
25    plt.show()
26    pcd = o3d.geometry.PointCloud.create_from_rgbd_image(
27        rgbd_image,
28        o3d.camera.PinholeCameraIntrinsic(
29            o3d.camera.PinholeCameraIntrinsicParameters.PrimeSenseDefault))
30    # Flip it, otherwise the pointcloud will be upside down
31    pcd.transform([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]])
32    o3d.visualization.draw_geometries([pcd])

This tutorial is almost the same as the tutorial processing Redwood dataset. The only difference is that we use conversion function create_rgbd_image_from_sun_format to parse depth images in the SUN dataset.

Similarly, the RGBDImage can be rendered as numpy arrays:

../../../_images/sun_rgbd.png

Or a point cloud:

../../../_images/sun_pcd.png