codic commited on
Commit
283d4ee
·
verified ·
1 Parent(s): 482dcaa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -65,9 +65,9 @@ def process_image(image_path, depth_map_path=None):
65
  mask = np.all(np.array(foreground) != [0, 0, 0], axis=-1)
66
 
67
  # Improved edge detection for the main subject
68
- edges = cv2.Canny(img_as_ubyte(mask), threshold1=50, threshold2=150)
69
- edges_dilated = cv2.dilate(edges, np.ones((3, 3), np.uint8), iterations=2)
70
- edges_eroded = cv2.erode(edges_dilated, np.ones((3, 3), np.uint8), iterations=1)
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)
 
65
  mask = np.all(np.array(foreground) != [0, 0, 0], axis=-1)
66
 
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=2)
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)