(mesh_coords: Tensor, filename: str)
| 18 | |
| 19 | |
| 20 | def post_process_mesh(mesh_coords: Tensor, filename: str): |
| 21 | mesh_coords = mesh_coords[~torch.isnan(mesh_coords[:, 0, 0])] # nvalid_face x 3 x 3 |
| 22 | vertices = mesh_coords.reshape(-1, 3) |
| 23 | vertices_index = np.arange(len(vertices)) # 0, 1, ..., 3 x face |
| 24 | triangles = vertices_index.reshape(-1, 3) |
| 25 | write_ply( |
| 26 | np.asarray(vertices.cpu()), |
| 27 | None, |
| 28 | np.asarray(triangles), |
| 29 | filename |
| 30 | ) |
| 31 | return vertices |
| 32 | |
| 33 | |
| 34 |