pookiefoof commited on
Commit
951bb28
1 Parent(s): 080fb1b

merge close vertices

Browse files
Files changed (3) hide show
  1. 3D_Stage/refine.py +1 -0
  2. 3D_Stage/webui.py +2 -1
  3. app.py +2 -1
3D_Stage/refine.py CHANGED
@@ -107,6 +107,7 @@ def refine(save_path, front_image, back_image, left_image, right_image):
107
  ms = pymeshlab.MeshSet()
108
  mesh_path = f"{save_path}/model-00.obj"
109
  ms.load_new_mesh(mesh_path)
 
110
  ms.apply_coord_laplacian_smoothing(stepsmoothnum=10)
111
  tl = open(mesh_path, "r").readlines()
112
  tex_uv = []
 
107
  ms = pymeshlab.MeshSet()
108
  mesh_path = f"{save_path}/model-00.obj"
109
  ms.load_new_mesh(mesh_path)
110
+ ms.meshing_merge_close_vertices()
111
  ms.apply_coord_laplacian_smoothing(stepsmoothnum=10)
112
  tl = open(mesh_path, "r").readlines()
113
  tex_uv = []
3D_Stage/webui.py CHANGED
@@ -32,13 +32,14 @@ for file in all_files:
32
  hf_hub_download(repo_id, file, local_dir="../")
33
 
34
  def traverse(path, back_proj):
35
- mesh = trimesh.load(f"{path}/model-00.obj")
36
  mesh.apply_transform(trimesh.transformations.rotation_matrix(np.radians(90.0), [-1, 0, 0]))
37
  mesh.apply_transform(trimesh.transformations.rotation_matrix(np.radians(180.0), [0, 1, 0]))
38
 
39
  cmesh = pymeshlab.Mesh(mesh.vertices, mesh.faces)
40
  ms = pymeshlab.MeshSet()
41
  ms.add_mesh(cmesh)
 
42
  ms.apply_coord_laplacian_smoothing(stepsmoothnum=4)
43
  mesh.vertices = ms.current_mesh().vertex_matrix()
44
 
 
32
  hf_hub_download(repo_id, file, local_dir="../")
33
 
34
  def traverse(path, back_proj):
35
+ mesh = trimesh.load(f"{path}/model-00.obj", process=False, maintain_order=True)
36
  mesh.apply_transform(trimesh.transformations.rotation_matrix(np.radians(90.0), [-1, 0, 0]))
37
  mesh.apply_transform(trimesh.transformations.rotation_matrix(np.radians(180.0), [0, 1, 0]))
38
 
39
  cmesh = pymeshlab.Mesh(mesh.vertices, mesh.faces)
40
  ms = pymeshlab.MeshSet()
41
  ms.add_mesh(cmesh)
42
+ ms.meshing_merge_close_vertices()
43
  ms.apply_coord_laplacian_smoothing(stepsmoothnum=4)
44
  mesh.vertices = ms.current_mesh().vertex_matrix()
45
 
app.py CHANGED
@@ -279,13 +279,14 @@ class Inference2D_API:
279
 
280
 
281
  def traverse(path, back_proj, smooth_iter):
282
- mesh = trimesh.load(f"{path}/model-00.obj")
283
  mesh.apply_transform(trimesh.transformations.rotation_matrix(np.radians(90.0), [-1, 0, 0]))
284
  mesh.apply_transform(trimesh.transformations.rotation_matrix(np.radians(180.0), [0, 1, 0]))
285
 
286
  cmesh = pymeshlab.Mesh(mesh.vertices, mesh.faces)
287
  ms = pymeshlab.MeshSet()
288
  ms.add_mesh(cmesh)
 
289
  ms.apply_coord_laplacian_smoothing(stepsmoothnum=smooth_iter)
290
  mesh.vertices = ms.current_mesh().vertex_matrix()
291
 
 
279
 
280
 
281
  def traverse(path, back_proj, smooth_iter):
282
+ mesh = trimesh.load(f"{path}/model-00.obj", process=False, maintain_order=True)
283
  mesh.apply_transform(trimesh.transformations.rotation_matrix(np.radians(90.0), [-1, 0, 0]))
284
  mesh.apply_transform(trimesh.transformations.rotation_matrix(np.radians(180.0), [0, 1, 0]))
285
 
286
  cmesh = pymeshlab.Mesh(mesh.vertices, mesh.faces)
287
  ms = pymeshlab.MeshSet()
288
  ms.add_mesh(cmesh)
289
+ ms.meshing_merge_close_vertices()
290
  ms.apply_coord_laplacian_smoothing(stepsmoothnum=smooth_iter)
291
  mesh.vertices = ms.current_mesh().vertex_matrix()
292