Yuliang commited on
Commit
35fb6aa
1 Parent(s): 03de2d0

Update lib/dataset/mesh_util.py

Browse files
Files changed (1) hide show
  1. 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
- ms = pymeshlab.MeshSet()
143
- ms.load_new_mesh(obj_path)
144
- ms.laplacian_smooth()
145
- ms.remeshing_isotropic_explicit_remeshing(
146
- targetlen=pymeshlab.Percentage(perc), adaptive=True)
147
- ms.save_current_mesh(obj_path.replace("recon", "remesh"))
148
- polished_mesh = trimesh.load_mesh(obj_path.replace("recon", "remesh"))
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