問題描述
如何將 .obj 文件拆分為其他兩個文件(python、open3d)? (How to split a .obj file into two other files (python, open3d)?)
我必須將一個 .obj 文件拆分為另外兩個文件。我從將網格轉換為點雲開始,並設法用“集群”為點著色。方法(每個要創建的新文件一種顏色)。我不知道如何將文件(具有兩個不同的集群)拆分為兩個文件。這是我的代碼:
mesho3d = open3d.io.read_triangle_mesh("Model.obj",True, True)
pcd = mesho3d.sample_points_poisson_disk(number_of_points=10000, init_factor=5)
with open3d.utility.VerbosityContextManager(
open3d.utility.VerbosityLevel.Debug) as cm:
labels = np.array(
pcd.cluster_dbscan(eps=0.02, min_points=10, print_progress=True))
max_label = labels.max()
print(f"point cloud has {max_label + 1} clusters")
colors = plt.get_cmap("BrBG")(labels / (max_label if max_label > 0 else 1))
colors[labels < 0] = 0
pcd.colors = open3d.utility.Vector3dVector(colors[:, :3])
提前謝謝!
參考解法
方法 1:
Is the separation using clusters an important thing for your purpose ? I'm not familiar with Open3D but I wonder:
- are you looking to a way to isolate connex parts of a Mesh (parts that are liked together) ?
- or you are just looking for a way to arbitrarily split a Mesh object using Open3D ?
</ul>
I would have posted only a comment if I had enough privilege.
(by Gabalex、jimy byerley)