codic commited on
Commit
a3741ce
·
verified ·
1 Parent(s): a9871ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -191,9 +191,12 @@ def create_3d_obj(foreground, depth_image, background, image_path, depth=10):
191
  pcd.estimate_normals(search_param=o3d.geometry.KDTreeSearchParamHybrid(radius=0.1, max_nn=30))
192
  pcd.orient_normals_towards_camera_location(camera_location=np.array([0, 0, 0]))
193
 
194
- # Save the point cloud to a GLB file
 
 
 
195
  output_path = os.path.join(Path(image_path).parent, "3D_Model.glb")
196
- o3d.io.write_triangle_mesh(output_path, pcd)
197
 
198
  return output_path
199
 
 
191
  pcd.estimate_normals(search_param=o3d.geometry.KDTreeSearchParamHybrid(radius=0.1, max_nn=30))
192
  pcd.orient_normals_towards_camera_location(camera_location=np.array([0, 0, 0]))
193
 
194
+ # Convert the point cloud to a triangle mesh
195
+ mesh, densities = o3d.geometry.TriangleMesh.create_from_point_cloud_poisson(pcd, depth=9)
196
+
197
+ # Save the triangle mesh to a GLB file
198
  output_path = os.path.join(Path(image_path).parent, "3D_Model.glb")
199
+ o3d.io.write_triangle_mesh(output_path, mesh)
200
 
201
  return output_path
202