pptk icon indicating copy to clipboard operation
pptk copied to clipboard

How do I set the point color with different labels?

Open LeanderWayne opened this issue 5 years ago • 1 comments

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?

LeanderWayne avatar May 30 '20 12:05 LeanderWayne

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.

tddaniel avatar Jun 03 '20 23:06 tddaniel