Spaces:
Runtime error
Runtime error
gokaygokay
commited on
Commit
•
91f7a1c
1
Parent(s):
e2a629e
Update app.py
Browse files
app.py
CHANGED
@@ -177,7 +177,12 @@ def laplacian_blend(img1: np.ndarray, img2: np.ndarray, mask: np.ndarray, depth:
|
|
177 |
imgs = []
|
178 |
for d in range(0, depth-1):
|
179 |
gaussian_img = _low_pass_filter(blanded_img.copy(), sigma)
|
180 |
-
gaussian_img = cv2.resize(gaussian_img, blended[d].shape[
|
|
|
|
|
|
|
|
|
|
|
181 |
reconstructed_img = cv2.add(blended[d], gaussian_img)
|
182 |
|
183 |
imgs.append(reconstructed_img)
|
|
|
177 |
imgs = []
|
178 |
for d in range(0, depth-1):
|
179 |
gaussian_img = _low_pass_filter(blanded_img.copy(), sigma)
|
180 |
+
gaussian_img = cv2.resize(gaussian_img, (blended[d].shape[1], blended[d].shape[0])) # Ensure sizes match
|
181 |
+
|
182 |
+
# Ensure the number of channels match
|
183 |
+
if len(gaussian_img.shape) == 2:
|
184 |
+
gaussian_img = np.stack([gaussian_img] * 3, axis=-1)
|
185 |
+
|
186 |
reconstructed_img = cv2.add(blended[d], gaussian_img)
|
187 |
|
188 |
imgs.append(reconstructed_img)
|