alexnasa commited on
Commit
62fee31
·
verified ·
1 Parent(s): 00fec3c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -19
app.py CHANGED
@@ -27,8 +27,6 @@ from src.misc.image_io import save_interpolated_video
27
  from src.model.model.anysplat import AnySplat
28
  from src.model.ply_export import export_ply
29
  from src.utils.image import process_image
30
- import trimesh
31
- import numpy as np
32
 
33
  os.environ["ANYSPLAT_PROCESSED"] = f"{os.getcwd()}/proprocess_results"
34
 
@@ -65,7 +63,6 @@ def get_reconstructed_scene(outdir, model, device):
65
  )
66
 
67
  plyfile = os.path.join(outdir, "gaussians.ply")
68
- glbfile = os.path.join(outdir, "gaussians.glb")
69
 
70
  export_ply(
71
  gaussians.means[0],
@@ -77,24 +74,9 @@ def get_reconstructed_scene(outdir, model, device):
77
  save_sh_dc_only=True,
78
  )
79
 
80
-
81
- # 1. Load PLY and preserve attributes
82
- mesh = trimesh.load(plyfile, process=False)
83
-
84
- # 2. Check or assign vertex colors
85
- if mesh.visual.vertex_colors is None or mesh.visual.vertex_colors.shape[1] < 4:
86
- # Example: assume mesh.metadata['vertex_color'] holds (N×3) array
87
- rgb = np.array(mesh.metadata['vertex_color'], dtype=np.uint8)
88
- alpha = np.full((rgb.shape[0], 1), 255, dtype=np.uint8)
89
- mesh.visual.vertex_colors = np.concatenate([rgb, alpha], axis=1)
90
-
91
- # 3. Export GLB
92
- mesh.export(glbfile, file_type='glb')
93
- print("Export complete: scene_colored.glb")
94
-
95
  # Clean up
96
  torch.cuda.empty_cache()
97
- return glbfile, video, depth_colored
98
 
99
 
100
  # 2) Handle uploaded video/images --> produce target_dir + images
 
27
  from src.model.model.anysplat import AnySplat
28
  from src.model.ply_export import export_ply
29
  from src.utils.image import process_image
 
 
30
 
31
  os.environ["ANYSPLAT_PROCESSED"] = f"{os.getcwd()}/proprocess_results"
32
 
 
63
  )
64
 
65
  plyfile = os.path.join(outdir, "gaussians.ply")
 
66
 
67
  export_ply(
68
  gaussians.means[0],
 
74
  save_sh_dc_only=True,
75
  )
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  # Clean up
78
  torch.cuda.empty_cache()
79
+ return plyfile, video, depth_colored
80
 
81
 
82
  # 2) Handle uploaded video/images --> produce target_dir + images