Spaces:
Running on Zero
Running on Zero
Download utils/glb_utils.py from TencentARC/GeometryCrafter: direct link, hf CLI and curl.
- Browser
- Download file 452 Bytes
-
https://huggingface.co/spaces/TencentARC/GeometryCrafter/resolve/9be975e4a0a93546eaef8dedf2ab602b9bb2e00a/utils/glb_utils.py
- Command line
-
hf download hf://spaces/TencentARC/GeometryCrafter@9be975e4a0a93546eaef8dedf2ab602b9bb2e00a/utils/glb_utils.py
-
curl -L -o glb_utils.py https://huggingface.co/spaces/TencentARC/GeometryCrafter/resolve/9be975e4a0a93546eaef8dedf2ab602b9bb2e00a/utils/glb_utils.py
452 Bytes
| import trimesh | |
| import numpy as np | |
| def pmap_to_glb(point_map, valid_mask, frame) -> trimesh.Scene: | |
| pts_3d = point_map[valid_mask] * np.array([-1, -1, 1]) | |
| pts_rgb = frame[valid_mask] | |
| # Initialize a 3D scene | |
| scene_3d = trimesh.Scene() | |
| # Add point cloud data to the scene | |
| point_cloud_data = trimesh.PointCloud( | |
| vertices=pts_3d, colors=pts_rgb | |
| ) | |
| scene_3d.add_geometry(point_cloud_data) | |
| return scene_3d | |