import numpy as np
import open3d.ml.torch as ml3d
# Correct
data = [
{
'name': 'test',
'points': np.array([
[0, 0, 0],
[0.1, 0, 0], [0.1, 0.1, 0],
[0.2, 0, 0], [0.2, 0.1, 0], [0.2, 0.2, 0]
]),
'classes': np.array([
1,
0, 0,
2, 2, 2
], dtype=np.int64)
}
]
lut = ml3d.vis.LabelLUT()
lut.add_label('zero', 0, [1, 0, 0])
lut.add_label('one', 1, [0, 1, 0])
lut.add_label('two', 2, [0, 0, 1])
vis = ml3d.vis.Visualizer()
vis.set_lut("classes", lut)
vis.visualize(data)
# Wrong
data = [
{
'name': 'test',
'points': np.array([
[0, 0, 0],
[0.1, 0, 0], [0.1, 0.1, 0],
[0.2, 0, 0], [0.2, 0.1, 0], [0.2, 0.2, 0]
]),
'classes': np.array([
1,
0, 0,
2, 2, 2
], dtype=np.uint8)
}
]
lut = ml3d.vis.LabelLUT()
lut.add_label('zero', 0, [1, 0, 0])
lut.add_label('one', 1, [0, 1, 0])
lut.add_label('two', 2, [0, 0, 1])
vis = ml3d.vis.Visualizer()
vis.set_lut("classes", lut)
vis.visualize(data)
- Operating system: Windows 11 (WSL Ubuntu 24.01)
- Python version: Python 3.12.3
- Open3D version: 0.19.0
- System type: x86_64
- Is this remote workstation?: no
- How did you install Open3D?: pip (with venv)
Checklist
mainbranch).Describe the issue
When I try to plot a custom point cloud data with an additional attribute (
classesattribute) withnp.uint8dtype, all my labels wrongly turn to zero. When using with the dtypenp.int64, the plot works fine.Steps to reproduce the bug
Error message
Using
np.uint8, the plot is:Where all points are wrongly in the classe zero (
red)Expected behavior
Its expected the plot with
np.uint8to be the same of the plot withnp.int64. The result of thenp.int64is given bellow:Open3D, Python and System information
Additional information
No response