Update app.py
Browse files
app.py
CHANGED
|
@@ -96,7 +96,7 @@ def process_image(image_path, depth_map_path=None):
|
|
| 96 |
|
| 97 |
def create_3d_obj(foreground, depth_image, background, image_path, depth=14):
|
| 98 |
# Enforce minimum depth and add debug statement
|
| 99 |
-
depth = max(depth, 2)
|
| 100 |
print(f"Using depth value: {depth}") # Debug statement to trace depth value
|
| 101 |
|
| 102 |
# Resize and normalize depth image
|
|
@@ -137,11 +137,12 @@ def create_3d_obj(foreground, depth_image, background, image_path, depth=14):
|
|
| 137 |
pcd, depth=depth, width=1, scale=2, linear_fit=True
|
| 138 |
)
|
| 139 |
except RuntimeError as e:
|
|
|
|
| 140 |
if depth > 2:
|
| 141 |
print(f"Retrying Poisson reconstruction with lower depth={depth-2}")
|
| 142 |
return create_3d_obj(foreground, depth_image, background, image_path, depth=depth-2)
|
| 143 |
else:
|
| 144 |
-
raise RuntimeError(f"Poisson reconstruction failed with minimum depth setting. Original error: {e}")
|
| 145 |
|
| 146 |
# Simplify and crop mesh
|
| 147 |
voxel_size = max(mesh_raw.get_max_bound() - mesh_raw.get_min_bound()) / 512
|
|
|
|
| 96 |
|
| 97 |
def create_3d_obj(foreground, depth_image, background, image_path, depth=14):
|
| 98 |
# Enforce minimum depth and add debug statement
|
| 99 |
+
depth = max(depth, 2) # Ensure depth is at least 2
|
| 100 |
print(f"Using depth value: {depth}") # Debug statement to trace depth value
|
| 101 |
|
| 102 |
# Resize and normalize depth image
|
|
|
|
| 137 |
pcd, depth=depth, width=1, scale=2, linear_fit=True
|
| 138 |
)
|
| 139 |
except RuntimeError as e:
|
| 140 |
+
# Check and retry if depth is above 2; otherwise, log error
|
| 141 |
if depth > 2:
|
| 142 |
print(f"Retrying Poisson reconstruction with lower depth={depth-2}")
|
| 143 |
return create_3d_obj(foreground, depth_image, background, image_path, depth=depth-2)
|
| 144 |
else:
|
| 145 |
+
raise RuntimeError(f"Poisson reconstruction failed with minimum depth setting of 2. Original error: {e}")
|
| 146 |
|
| 147 |
# Simplify and crop mesh
|
| 148 |
voxel_size = max(mesh_raw.get_max_bound() - mesh_raw.get_min_bound()) / 512
|