SUN datasetΒΆ

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

# src/Python/Tutorial/Basic/

#conda install pillow matplotlib
from py3d import *
import matplotlib.pyplot as plt

if __name__ == "__main__":
        print("Read SUN dataset")
        color_raw = read_image("../../TestData/RGBD/other_formats/SUN_color.jpg")
        depth_raw = read_image("../../TestData/RGBD/other_formats/SUN_depth.png")
        rgbd_image = create_rgbd_image_from_sun_format(color_raw, depth_raw);
        plt.subplot(1, 2, 1)
        plt.title('SUN grayscale image')
        plt.subplot(1, 2, 2)
        plt.title('SUN depth image')
        pcd = create_point_cloud_from_rgbd_image(rgbd_image,
        # Flip it, otherwise the pointcloud will be upside down
        pcd.transform([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]])

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:


Or a point cloud: