freealise commited on
Commit
fcf0471
1 Parent(s): 45c3f94

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -26
app.py CHANGED
@@ -9,7 +9,7 @@ import torch.nn.functional as F
9
  from torchvision import transforms
10
  from torchvision.transforms import Compose
11
  import trimesh
12
- from geometry import create_triangles
13
  import tempfile
14
  from functools import partial
15
  import spaces
@@ -321,41 +321,30 @@ def get_mesh(image, depth, blur_data, loadall):
321
  #if (clrs[j] == pcolors[i]).all():
322
  #cverts[i].append(verts[j])
323
  #j=j+1
324
- #mesh.append(trimesh.PointCloud(verts, colors=[255,0,255,255]))
325
  #print(mesh[len(mesh)-1])
326
  #mesh[len(mesh)-1].merge_vertices()
327
  #i=i+1
328
  mesh_n.append(str(fnum))
329
 
330
- triangles = create_triangles(rgba.shape[0], rgba.shape[1])
331
- rgba_pil = Image.fromarray(rgba.astype(np.uint8))
332
- material = trimesh.visual.texture.SimpleMaterial(image=rgba_pil) #, ambient=[0,0,0,0], diffuse=[0,0,0,0], specular=[0,0,0,0], glossiness=1.0)
333
- visuals = trimesh.visual.TextureVisuals(uv=uvs, image=rgba_pil, material=material)
334
- mesh.append(trimesh.Trimesh(vertices=verts, faces=triangles, vertex_normals=normals, visual=visuals, validate=True, process=False))
335
  #print('triangles - ok')
336
 
337
- #ln = []
338
- #cr = []
339
- #k = 1
340
- #kold = 0
341
- #c_old = [128,128,128,0]
342
- #j=0
343
- #while j < gdepth.shape[1]:
344
- #i=0
345
- #k=j+1
346
- #while i < gdepth.shape[0]:
347
- #if gdepth[i][j] < 255 and kold != 0 and k != j+1 and (c_old == image[fnum][0][i][j]).all():
348
- #ln.append(trimesh.path.entities.Line([kold, k]))
349
- #cr.append(image[fnum][0][i][j])
350
- #kold=k
351
- #c_old = image[fnum][0][i][j]
352
- #k=k+gdepth.shape[1]
353
- #i=i+1
354
- #j=j+1
355
 
356
  #print(len(ln))
357
  #print(len(cr))
358
- #mesh.append(trimesh.path.path.Path3D(entities=ln, vertices=verts, colors=cr))
359
  #mesh.append(trimesh.PointCloud(verts, colors=clrs))
360
  #mesh[len(mesh)-1].merge_vertices()
361
  #mesh_n.append(str(fnum))
 
9
  from torchvision import transforms
10
  from torchvision.transforms import Compose
11
  import trimesh
12
+ #from geometry import create_triangles
13
  import tempfile
14
  from functools import partial
15
  import spaces
 
321
  #if (clrs[j] == pcolors[i]).all():
322
  #cverts[i].append(verts[j])
323
  #j=j+1
324
+ #mesh.append(trimesh.PointCloud(verts, colors=clrs))
325
  #print(mesh[len(mesh)-1])
326
  #mesh[len(mesh)-1].merge_vertices()
327
  #i=i+1
328
  mesh_n.append(str(fnum))
329
 
330
+ #triangles = create_triangles(rgba.shape[0], rgba.shape[1])
331
+ #rgba_pil = Image.fromarray(rgba.astype(np.uint8))
332
+ #material = trimesh.visual.texture.SimpleMaterial(image=rgba_pil) #, ambient=[0,0,0,0], diffuse=[0,0,0,0], specular=[0,0,0,0], glossiness=1.0)
333
+ #visuals = trimesh.visual.TextureVisuals(uv=uvs, image=rgba_pil, material=material)
334
+ #mesh.append(trimesh.Trimesh(vertices=verts, faces=triangles, vertex_normals=normals, visual=visuals, validate=True, process=False))
335
  #print('triangles - ok')
336
 
337
+ ln = []
338
+ cr = []
339
+ k = 1
340
+ while k < len(verts):
341
+ ln.append(k)
342
+ cr.append(clrs[k])
343
+ k=k+1
 
 
 
 
 
 
 
 
 
 
 
344
 
345
  #print(len(ln))
346
  #print(len(cr))
347
+ mesh.append(trimesh.path.path.Path3D(entities=[trimesh.path.entities.Line(ln)], vertices=verts, colors=[[0,0,255,255]]))
348
  #mesh.append(trimesh.PointCloud(verts, colors=clrs))
349
  #mesh[len(mesh)-1].merge_vertices()
350
  #mesh_n.append(str(fnum))