Update app.py
Browse files
app.py
CHANGED
@@ -61,9 +61,10 @@ def blend_images(base, overlay, mask):
|
|
61 |
mask = mask.astype(np.uint8) * 255
|
62 |
|
63 |
# Ensure mask is single-channel grayscale
|
64 |
-
|
|
|
65 |
mask = cv2.cvtColor(mask, cv2.COLOR_BGR2GRAY)
|
66 |
-
|
67 |
# Convert mask to uint8 if necessary
|
68 |
if mask.dtype != np.uint8:
|
69 |
mask = (mask * 255).astype(np.uint8)
|
|
|
61 |
mask = mask.astype(np.uint8) * 255
|
62 |
|
63 |
# Ensure mask is single-channel grayscale
|
64 |
+
# Ensure mask is single-channel grayscale
|
65 |
+
if len(mask.shape) == 3 and mask.shape[2] == 3:
|
66 |
mask = cv2.cvtColor(mask, cv2.COLOR_BGR2GRAY)
|
67 |
+
|
68 |
# Convert mask to uint8 if necessary
|
69 |
if mask.dtype != np.uint8:
|
70 |
mask = (mask * 255).astype(np.uint8)
|