Visualizing 3D Data¶
import os
os.environ["WEBRTC_PORT"] = "8889"
os.environ["WEBRTC_IP"] = "127.0.0.1"
import pickle
from vis4d.vis.functional import show_points
import numpy as np
First, lets load the pointcloud data so we can visualize it.
pc_data = pickle.load(open("data/pc_data.pkl", "rb"))
xyz = pc_data["points3d"] - np.mean(pc_data["points3d"], 0)
colors = pc_data["colors3d"]
classes = pc_data["semantics3d"]
instances = pc_data["instances3d"]
# Lets remove the top part of the pointcloud to see it better
lower_mask = xyz[:, -1] < 1.4
xyz = xyz[lower_mask, :]
colors = colors[lower_mask, :]
classes = classes[lower_mask]
instances = instances[lower_mask]
print(f"Loaded pointcloud with {colors.shape[0]} points")
Loaded pointcloud with 535899 points
Now, lets visualize the pointcloud with color!
show_points(xyz, colors)
Lets look at some other predictions. Class and Instances
Classes¶
show_points(xyz, classes = classes)
Instances¶
show_points(xyz, instances = instances)
Finally, lets show all predictions in one window. This will copy the room three times and color it differently each time, based on ‘color’, ‘classes’ and ‘instances’
show_points(xyz, colors =colors, classes=classes, instances = instances)