codic commited on
Commit
94f6265
·
verified ·
1 Parent(s): 2b5abfc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -31,11 +31,13 @@ def inpaint_background(image, mask):
31
  # Ensure the mask is binary (0 and 255)
32
  mask_binary = (mask * 255).astype(np.uint8)
33
 
34
- # Inpaint the image using the mask
35
- inpainted_image = cv2.inpaint(image.astype(np.uint8), mask_binary, inpaintRadius=3, flags=cv2.INPAINT_TELEA)
36
 
37
- return inpainted_image
 
38
 
 
39
  # Normalization function
40
  def normalize_depth_image(depth_image):
41
  # Ensure depth_image is of type float32
 
31
  # Ensure the mask is binary (0 and 255)
32
  mask_binary = (mask * 255).astype(np.uint8)
33
 
34
+ # Resize the mask to match the image dimensions
35
+ mask_binary_resized = cv2.resize(mask_binary, (image.shape[1], image.shape[0]), interpolation=cv2.INTER_NEAREST)
36
 
37
+ # Inpaint the image using the resized mask
38
+ inpainted_image = cv2.inpaint(image.astype(np.uint8), mask_binary_resized, inpaintRadius=3, flags=cv2.INPAINT_TELEA)
39
 
40
+ return inpainted_image
41
  # Normalization function
42
  def normalize_depth_image(depth_image):
43
  # Ensure depth_image is of type float32