Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I set the point color with different labels? #41

Open
LeanderWayne opened this issue May 30, 2020 · 1 comment
Open

How do I set the point color with different labels? #41

LeanderWayne opened this issue May 30, 2020 · 1 comment

Comments

@LeanderWayne
Copy link

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?

@tddaniel
Copy link

tddaniel commented Jun 3, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants