freealise commited on
Commit
af6f5a1
1 Parent(s): fcf0471

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -14
app.py CHANGED
@@ -301,15 +301,16 @@ def get_mesh(image, depth, blur_data, loadall):
301
  # Each pixel is connected to its 4 neighbors
302
  # colors are the RGB values of the image
303
  uvs = uv.reshape(-1, 2)
304
- print(uvs)
305
- verts = pts3d.reshape(-1, 3)
 
306
  normals = nl.reshape(-1, 3)
307
  rgba = cv2.cvtColor(blur_img, cv2.COLOR_RGB2RGBA)
308
  colors = rgba.reshape(-1, 4)
309
  clrs = [[128,128,128,0]]
310
 
311
  #for i in range(0,1): #(0,4)
312
- clrs = np.concatenate((clrs, colors), axis=0)
313
  #i = i+1
314
 
315
  #cverts = []
@@ -321,9 +322,9 @@ 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=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
 
@@ -334,17 +335,17 @@ def get_mesh(image, depth, blur_data, loadall):
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))
@@ -633,6 +634,13 @@ async(p, d, n)=>{
633
  }
634
  BABYLON.Engine.LastCreatedScene.getAnimationRatio();
635
  //BABYLON.Engine.LastCreatedScene.activeCamera.inertia = 0.0;
 
 
 
 
 
 
 
636
  });
637
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
638
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata = {
 
301
  # Each pixel is connected to its 4 neighbors
302
  # colors are the RGB values of the image
303
  uvs = uv.reshape(-1, 2)
304
+ #print(uvs)
305
+ #verts = pts3d.reshape(-1, 3)
306
+ verts = [[0,0,0]]
307
  normals = nl.reshape(-1, 3)
308
  rgba = cv2.cvtColor(blur_img, cv2.COLOR_RGB2RGBA)
309
  colors = rgba.reshape(-1, 4)
310
  clrs = [[128,128,128,0]]
311
 
312
  #for i in range(0,1): #(0,4)
313
+ #clrs = np.concatenate((clrs, colors), axis=0)
314
  #i = i+1
315
 
316
  #cverts = []
 
322
  #if (clrs[j] == pcolors[i]).all():
323
  #cverts[i].append(verts[j])
324
  #j=j+1
325
+ mesh.append(trimesh.PointCloud(verts, colors=clrs))
326
+ print(mesh[len(mesh)-1])
327
+ mesh[len(mesh)-1].merge_vertices()
328
  #i=i+1
329
  mesh_n.append(str(fnum))
330
 
 
335
  #mesh.append(trimesh.Trimesh(vertices=verts, faces=triangles, vertex_normals=normals, visual=visuals, validate=True, process=False))
336
  #print('triangles - ok')
337
 
338
+ #ln = []
339
+ #cr = []
340
+ #k = 1
341
+ #while k < len(verts):
342
+ # ln.append(k)
343
+ # cr.append(clrs[k])
344
+ # k=k+1
345
 
346
  #print(len(ln))
347
  #print(len(cr))
348
+ #mesh.append(trimesh.path.path.Path3D(entities=[trimesh.path.entities.Line(ln)], vertices=verts, colors=[[0,0,255,255]]))
349
  #mesh.append(trimesh.PointCloud(verts, colors=clrs))
350
  #mesh[len(mesh)-1].merge_vertices()
351
  #mesh_n.append(str(fnum))
 
634
  }
635
  BABYLON.Engine.LastCreatedScene.getAnimationRatio();
636
  //BABYLON.Engine.LastCreatedScene.activeCamera.inertia = 0.0;
637
+ var dome = new BABYLON.PhotoDome("dome", p[n].image.url,
638
+ {
639
+ resolution: 16,
640
+ size: 512
641
+ }, BABYLON.Engine.LastCreatedScene);
642
+ BABYLON.Engine.LastCreatedScene.getMeshByName("dome_mesh").applyDisplacementMap(d.background.url, 0, 255, null, null, null, true, function(e){alert(e);});
643
+ try { BABYLON.Engine.LastCreatedScene.getMeshByName("dome_mesh")._children[0].dispose(); } catch(e){alert(e);}
644
  });
645
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
646
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata = {