Spaces:
Runtime error
Runtime error
Update lib/dataset/mesh_util.py
Browse files- lib/dataset/mesh_util.py +8 -10
lib/dataset/mesh_util.py
CHANGED
@@ -138,16 +138,14 @@ def mesh_edge_loss(meshes, target_length: float = 0.0):
|
|
138 |
|
139 |
|
140 |
def remesh(obj_path, perc, device):
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
verts_pr = torch.tensor(polished_mesh.vertices).float().unsqueeze(0).to(device)
|
150 |
-
faces_pr = torch.tensor(polished_mesh.faces).long().unsqueeze(0).to(device)
|
151 |
|
152 |
return verts_pr, faces_pr
|
153 |
|
|
|
138 |
|
139 |
|
140 |
def remesh(obj_path, perc, device):
|
141 |
+
mesh = trimesh.load(obj_path)
|
142 |
+
mesh = mesh.simplify_quadratic_decimation(face_count)
|
143 |
+
mesh = trimesh.smoothing.filter_humphrey(
|
144 |
+
mesh, alpha=0.1, beta=0.5, iterations=10, laplacian_operator=None
|
145 |
+
)
|
146 |
+
mesh.export(obj_path.replace("recon", "remesh"))
|
147 |
+
verts_pr = torch.tensor(mesh.vertices).float().unsqueeze(0).to(device)
|
148 |
+
faces_pr = torch.tensor(mesh.faces).long().unsqueeze(0).to(device)
|
|
|
|
|
149 |
|
150 |
return verts_pr, faces_pr
|
151 |
|