codic commited on
Commit
5d4ded0
·
verified ·
1 Parent(s): db0c43e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -31,8 +31,16 @@ def process_depth_image(depth_image):
31
  return smoothed_depth_image
32
 
33
  def inpaint_background(original_image, mask):
34
- # Inpainting to fill the background
35
- inpainted_image = cv2.inpaint(original_image, mask.astype(np.uint8), inpaintRadius=3, flags=cv2.INPAINT_TELEA)
 
 
 
 
 
 
 
 
36
  return inpainted_image
37
 
38
  def process_image(image_path, depth_map_path=None):
 
31
  return smoothed_depth_image
32
 
33
  def inpaint_background(original_image, mask):
34
+ # Ensure the mask is binary and has the correct dimensions
35
+ if original_image.shape[:2] != mask.shape[:2]:
36
+ mask = cv2.resize(mask, (original_image.shape[1], original_image.shape[0]))
37
+
38
+ # Ensure mask is of type uint8
39
+ mask = mask.astype(np.uint8)
40
+
41
+ # Inpaint the background using the mask
42
+ inpainted_image = cv2.inpaint(original_image, mask, inpaintRadius=3, flags=cv2.INPAINT_TELEA)
43
+
44
  return inpainted_image
45
 
46
  def process_image(image_path, depth_map_path=None):