如何使用open3d.io.write_octree保存octree到文件?



我尝试在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)

但这不起作用,write_point_cloud工作正常,但write_octree不行。

有人用过这个函数吗?我是不是漏掉了什么?

我想创建一个像下面这样的文件。

octree.txt

感谢您的宝贵反馈。

我选择使用octomap库而不是open3d,它有许多内置的OcTree选项。

最新更新