Spaces:
Build error

codic commited on
Commit
724e724
·
verified ·
1 Parent(s): c135852

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -112,6 +112,8 @@ def create_3d_obj(foreground, depth_image, background, image_path, depth=10, min
112
 
113
  # Create point cloud
114
  pcd = o3d.geometry.PointCloud.create_from_rgbd_image(rgbd_image, camera_intrinsic)
 
 
115
  if len(pcd.points) < 100:
116
  raise RuntimeError("Insufficient points in the point cloud for normals estimation.")
117
 
@@ -144,9 +146,8 @@ def create_3d_obj(foreground, depth_image, background, image_path, depth=10, min
144
  return gltf_path
145
 
146
  except RuntimeError as e:
147
- print(f"Error: {str(e)}. Retrying with a shallower depth.")
148
- # Recursive call with reduced depth if point cloud is insufficient
149
- return create_3d_obj(foreground, depth_image, background, image_path, depth=depth - 1, min_depth=min_depth)
150
 
151
  # Gradio Interface
152
  title = "Depth Estimation & 3D Reconstruction Demo"
 
112
 
113
  # Create point cloud
114
  pcd = o3d.geometry.PointCloud.create_from_rgbd_image(rgbd_image, camera_intrinsic)
115
+
116
+ # Check point density before proceeding
117
  if len(pcd.points) < 100:
118
  raise RuntimeError("Insufficient points in the point cloud for normals estimation.")
119
 
 
146
  return gltf_path
147
 
148
  except RuntimeError as e:
149
+ print(f"Error: {str(e)}.")
150
+ return None
 
151
 
152
  # Gradio Interface
153
  title = "Depth Estimation & 3D Reconstruction Demo"