einsafutdinov commited on
Commit
cecdd84
Β·
1 Parent(s): 265a0aa

add opacity threshold

Browse files
Files changed (1) hide show
  1. flash3d/util/vis3d.py +10 -1
flash3d/util/vis3d.py CHANGED
@@ -27,10 +27,19 @@ def export_ply(
27
  scales: Float[Tensor, "gaussian 3"],
28
  rotations: Float[Tensor, "gaussian 4"],
29
  harmonics: Float[Tensor, "gaussian 3 d_sh"],
30
- opacities: Float[Tensor, "gaussian"],
31
  path: Path,
32
  ):
33
  path = Path(path)
 
 
 
 
 
 
 
 
 
34
  # Shift the scene so that the median Gaussian is at the origin.
35
  means = means - means.median(dim=0).values
36
 
 
27
  scales: Float[Tensor, "gaussian 3"],
28
  rotations: Float[Tensor, "gaussian 4"],
29
  harmonics: Float[Tensor, "gaussian 3 d_sh"],
30
+ opacities: Float[Tensor, "gaussian 1"],
31
  path: Path,
32
  ):
33
  path = Path(path)
34
+
35
+ min_opacity = 0.50
36
+ valid = opacities[..., 0] > min_opacity
37
+ means = means[valid, ...]
38
+ scales = scales[valid, ...]
39
+ rotations = rotations[valid, ...]
40
+ harmonics = harmonics[valid, ...]
41
+ opacities = opacities[valid, ...]
42
+
43
  # Shift the scene so that the median Gaussian is at the origin.
44
  means = means - means.median(dim=0).values
45