pptk
pptk copied to clipboard
How do I set the point color with different labels?
Hi, I have point cloud data with ground truth labels, but how do I set the point with different colors like the partition result shown in 'Visualizing the Semantic3D dataset' tutorial?
Maybe something like this? Make data array, each point has (x,y,z,label) with the labels randomly chosen from 0-3
import pptk
import numpy as np
x = np.random.randn(4000,4)
labels = [0,1,2,3]
for i, _ in enumerate(x):
x[i,-1] = np.random.choice(labels)
Make the viewer passing in the (x,y,z) values as the first argument and just the labels as the second. I just changed the point size and initial r to better defaults for this data.
v = pptk.viewer(x[:,:-1],x[:,-1])
v.set(point_size=0.1)
v.set(r=20)
you could also make an RGBA array with one color for each point with the colors corresponding to the labels.