MCPcopy
hub / github.com/OpenMotionLab/MotionGPT / plys2npy

Function plys2npy

scripts/plys2npy.py:32–52  ·  view source on GitHub ↗
(ply_dir, out_dir)

Source from the content-addressed store, hash-verified

30 plys2npy(params.ply_dir, params.out_dir)
31
32def plys2npy(ply_dir, out_dir):
33 ply_dir = Path(ply_dir)
34 paths = []
35 file_list = natsort.natsorted(os.listdir(ply_dir))
36 for item in file_list:
37 if item.endswith(".ply") and not item.endswith("_gt.ply"):
38 paths.append(os.path.join(ply_dir, item))
39
40
41 meshs = np.zeros((len(paths), 6890, 3))
42 for i, path in enumerate(paths):
43 mesh = trimesh.load_mesh(path, process=False)
44 vs = mesh.vertices
45 assert vs.shape == (6890, 3)
46 meshs[i] = vs
47
48 basename = os.path.basename(ply_dir)
49 if basename.startswith("SMPLFit_"):
50 basename = basename[len("SMPLFit_"):]
51 file_name = os.path.join(out_dir, basename+ "_mesh.npy")
52 np.save(file_name, meshs)
53
54
55if __name__ == "__main__":

Callers 2

fit.pyFile · 0.90
mainFunction · 0.85

Calls 1

saveMethod · 0.80

Tested by

no test coverage detected