Open3D icon indicating copy to clipboard operation
Open3D copied to clipboard

How to save a octree to a file using open3d.io.write_octree?

Open abi2721 opened this issue 3 years ago • 2 comments

Checklist

My Question

I tried to save an octree in a file with open3d.io.write_octree.

import open3d as o3d import numpy as np from open3d.web_visualizer import draw from numpy import savetxt

if name == "main": N = 2000 armadillo_data = o3d.data.ArmadilloMesh() pcd = o3d.io.read_triangle_mesh( armadillo_data.path).sample_points_poisson_disk(N) # 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(np.random.uniform(0, 1, size=(N, 3))) print('Displaying input pointcloud ...') #draw([pcd])

octree = o3d.geometry.Octree(max_depth=4)
octree.convert_from_point_cloud(pcd, size_expand=0.01)
print('Displaying octree ..')
#draw([octree])

o3d.io.write_point_cloud("copy_of_fragment.pcd", pcd)

o3d.io.write_octree("octofile.oct", octree)

But this does not work, write_point_cloud works fine but write_octree does not.

Anyone used this function ? Is there something that I am missing here ?

abi2721 avatar Nov 16 '22 09:11 abi2721