fixing the image process
Browse files
app.py
CHANGED
|
@@ -51,7 +51,7 @@ def process_image(image_path, depth_map_path=None):
|
|
| 51 |
)
|
| 52 |
|
| 53 |
# Remove background using the API + rmbg combination
|
| 54 |
-
foreground =
|
| 55 |
|
| 56 |
# Check if user-provided depth map is available
|
| 57 |
if depth_map_path:
|
|
@@ -115,7 +115,7 @@ def process_image(image_path, depth_map_path=None):
|
|
| 115 |
gltf_path = create_3d_obj(np.array(foreground), blended_depth_image, None, image_path, depth=9)
|
| 116 |
img = Image.fromarray(blended_depth_image)
|
| 117 |
return [img, gltf_path, gltf_path]
|
| 118 |
-
|
| 119 |
def create_3d_obj(foreground, depth_image, background, image_path, depth=10):
|
| 120 |
depth_image_resized = np.array(
|
| 121 |
Image.fromarray(depth_image).resize(foreground.shape[:2][::-1], Image.LANCZOS)
|
|
|
|
| 51 |
)
|
| 52 |
|
| 53 |
# Remove background using the API + rmbg combination
|
| 54 |
+
foreground = remove_background(image_raw)
|
| 55 |
|
| 56 |
# Check if user-provided depth map is available
|
| 57 |
if depth_map_path:
|
|
|
|
| 115 |
gltf_path = create_3d_obj(np.array(foreground), blended_depth_image, None, image_path, depth=9)
|
| 116 |
img = Image.fromarray(blended_depth_image)
|
| 117 |
return [img, gltf_path, gltf_path]
|
| 118 |
+
|
| 119 |
def create_3d_obj(foreground, depth_image, background, image_path, depth=10):
|
| 120 |
depth_image_resized = np.array(
|
| 121 |
Image.fromarray(depth_image).resize(foreground.shape[:2][::-1], Image.LANCZOS)
|