Update app.py
Browse files
app.py
CHANGED
|
@@ -62,7 +62,8 @@ def process_image(image_path, depth_map_path=None):
|
|
| 62 |
raise Exception("Error reconstructing 3D model")
|
| 63 |
|
| 64 |
def inpaint_background(image, original_image):
|
| 65 |
-
|
|
|
|
| 66 |
inpainted_image = cv2.inpaint(original_image, mask, inpaintRadius=3, flags=cv2.INPAINT_TELEA)
|
| 67 |
return inpainted_image
|
| 68 |
|
|
|
|
| 62 |
raise Exception("Error reconstructing 3D model")
|
| 63 |
|
| 64 |
def inpaint_background(image, original_image):
|
| 65 |
+
# Create the mask and convert to uint8 format for OpenCV compatibility
|
| 66 |
+
mask = np.array(image.convert("L").point(lambda x: 255 if x == 0 else 0, mode="1")).astype(np.uint8)
|
| 67 |
inpainted_image = cv2.inpaint(original_image, mask, inpaintRadius=3, flags=cv2.INPAINT_TELEA)
|
| 68 |
return inpainted_image
|
| 69 |
|