From 3ad49bfe203c415bf9398eaeb8f57d0283d879ad Mon Sep 17 00:00:00 2001 From: Ting-Jun Wang Date: Sun, 17 Dec 2023 18:57:09 +0800 Subject: [PATCH] feat: transform mesh to cloud points --- mesh_to_points.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 mesh_to_points.py diff --git a/mesh_to_points.py b/mesh_to_points.py new file mode 100644 index 0000000..a367aff --- /dev/null +++ b/mesh_to_points.py @@ -0,0 +1,20 @@ + +import open3d as o3d +import trimesh +import matplotlib.pyplot as plt +from PIL import Image +import numpy as np + +# 读取 OBJ 模型文件 +mesh = trimesh.load('output.obj') + +colors = mesh.visual.to_color().vertex_colors +points = mesh.vertices +print(colors.shape) +print(colors) +print(points.shape) + +np.save('colors.npy', colors) +np.save('points.npy', points) + +mesh.show()