Skip to content

Cannot change color when visualizing octree #5966

@harryseely

Description

@harryseely

Checklist

Describe the issue

I am trying to visualize an octree based on height of each leaf node. I can toggle the colour map of a regular point cloud in the open3d viewer by pressing the 4 key.

Steps to reproduce the bug

`
#Save as csv
new_file = r"C:\Users\hseely\Downloads\temp_points.ply"

# Pass xyz to Open3D.o3d.geometry.PointCloud and visualize
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(xyz)
o3d.io.write_point_cloud(new_file, pcd)

# Load saved point cloud and visualize it
pcd = o3d.io.read_point_cloud(new_file)

#Set height as colours
z = xyz[:,2]
#Scale height between 0 amd 1
z = (z - np.min(z)) / (np.max(z) - np.min(z))

z = np.reshape(z, (z.shape[0], 1))
col_arr = np.concatenate((z, z, z), axis =1)

#Try plotting octree
# fit to unit cube
pcd.scale(1 / np.max(pcd.get_max_bound() - pcd.get_min_bound()), center=pcd.get_center())
pcd.colors = o3d.utility.Vector3dVector(col_arr)
o3d.visualization.draw_geometries([pcd])

print('octree division')
octree = o3d.geometry.Octree(max_depth=5)
octree.convert_from_point_cloud(pcd, size_expand=0.01)
o3d.visualization.draw_geometries([octree])`

Error message

No error provided

Expected behavior

Would expect the octree to be coloured based on height just like the point cloud.

Open3D, Python and System information

- Operating system: Windows 10 64-bit
- Python version: Python 3.8 
- Open3D version: 0.16.0
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: pip

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugNot a build issue, this is likely a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions