Update app.py
Browse files
app.py
CHANGED
|
@@ -67,7 +67,7 @@ def process_image(image_path, depth_map_path=None):
|
|
| 67 |
# Improved edge detection for the main subject
|
| 68 |
edges = cv2.Canny(img_as_ubyte(mask), threshold1=40, threshold2=140)
|
| 69 |
edges_dilated = cv2.dilate(edges, np.ones((3, 3), np.uint8), iterations=3)
|
| 70 |
-
edges_eroded = cv2.erode(edges_dilated, np.ones((3, 3), np.uint8), iterations=
|
| 71 |
|
| 72 |
# Use the refined edge mask to clean up the depth map
|
| 73 |
depth_subject_only = np.where(edges_eroded == 0, depth_image * mask, 0)
|
|
|
|
| 67 |
# Improved edge detection for the main subject
|
| 68 |
edges = cv2.Canny(img_as_ubyte(mask), threshold1=40, threshold2=140)
|
| 69 |
edges_dilated = cv2.dilate(edges, np.ones((3, 3), np.uint8), iterations=3)
|
| 70 |
+
edges_eroded = cv2.erode(edges_dilated, np.ones((3, 3), np.uint8), iterations=4)
|
| 71 |
|
| 72 |
# Use the refined edge mask to clean up the depth map
|
| 73 |
depth_subject_only = np.where(edges_eroded == 0, depth_image * mask, 0)
|