Update app.py
Browse files
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 |
-
#
|
| 35 |
-
|
| 36 |
|
| 37 |
-
|
|
|
|
| 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
|