freealise commited on
Commit
4c4b7fe
1 Parent(s): 9b477f0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -313,21 +313,19 @@ def get_mesh(image, depth, blur_data, loadall):
313
  #i = i+1
314
  #verts, clrs
315
 
316
- pcd = o3d.geometry.PointCloud()
317
- pcd.points = o3d.utility.Vector3dVector(np.array([[0.0, 0.0, 0.0]]))
318
- pcd.colors = o3d.utility.Vector3dVector(np.array([[1.0, 1.0, 1.0]]))
319
  mesh.append(pcd)
320
  print(mesh[len(mesh)-1])
321
  mesh_n.append(str(fnum))
322
-
323
- #binary = DracoPy.encode(verts, colors=clrs.astype(np.uint8))
324
  print('mesh - ok')
325
 
326
  # Save as glb
327
- ply_file = tempfile.NamedTemporaryFile(suffix='.ply', delete=False)
328
- o3d.io.write_point_cloud(ply_file.name, pcd)
329
  print('file - ok')
330
- return "./TriangleWithoutIndices.gltf", ply_file.name, ",".join(mesh_n)
331
 
332
  def blur_image(image, depth, blur_data):
333
  blur_a = blur_data.split()
 
313
  #i = i+1
314
  #verts, clrs
315
 
316
+ pcd = o3d.geometry.TriangleMesh.create_tetrahedron()
317
+ pcd.compute_vertex_normals()
318
+ pcd.colors = o3d.utility.Vector3dVector(np.array([[1.0, 1.0, 1.0],[1.0, 1.0, 1.0],[1.0, 1.0, 1.0],[1.0, 1.0, 1.0]]))
319
  mesh.append(pcd)
320
  print(mesh[len(mesh)-1])
321
  mesh_n.append(str(fnum))
 
 
322
  print('mesh - ok')
323
 
324
  # Save as glb
325
+ glb_file = tempfile.NamedTemporaryFile(suffix='.glb', delete=False)
326
+ o3d.io.write_triangle_mesh(glb_file.name, pcd)
327
  print('file - ok')
328
+ return "./TriangleWithoutIndices.gltf", glb_file.name, ",".join(mesh_n)
329
 
330
  def blur_image(image, depth, blur_data):
331
  blur_a = blur_data.split()