Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -297,8 +297,8 @@ def blur_image(image, depth, blur_data):
|
|
297 |
j = 0
|
298 |
while j < 256:
|
299 |
i = 255 - j
|
300 |
-
blur_lo = [i,i,i]
|
301 |
-
blur_hi = [i+1,i+1,i+1]
|
302 |
blur_mask = cv2.inRange(depth, blur_lo, blur_hi)
|
303 |
|
304 |
print(f'kernel size {int(blur_a[j])}')
|
@@ -341,7 +341,9 @@ def draw_mask(v, d, evt: gr.EventData):
|
|
341 |
w = int(vv[2])
|
342 |
h = int(vv[3])
|
343 |
|
|
|
344 |
rgb = cv2.cvtColor(d["background"], cv2.COLOR_RGBA2RGB)
|
|
|
345 |
mask = np.zeros(rgb.shape[:2], np.uint8)
|
346 |
bgdModel = np.zeros((1,65), np.float64)
|
347 |
fgdModel = np.zeros((1,65), np.float64)
|
|
|
297 |
j = 0
|
298 |
while j < 256:
|
299 |
i = 255 - j
|
300 |
+
blur_lo = np.array([i,i,i])
|
301 |
+
blur_hi = np.array([i+1,i+1,i+1])
|
302 |
blur_mask = cv2.inRange(depth, blur_lo, blur_hi)
|
303 |
|
304 |
print(f'kernel size {int(blur_a[j])}')
|
|
|
341 |
w = int(vv[2])
|
342 |
h = int(vv[3])
|
343 |
|
344 |
+
d_copy = d["background"].copy()
|
345 |
rgb = cv2.cvtColor(d["background"], cv2.COLOR_RGBA2RGB)
|
346 |
+
d["background"] = cv2.applyColorMap(cv2.cvtColor(d["background"], cv2.COLOR_RGBA2GRAY), cv2.COLORMAP_HSV)
|
347 |
mask = np.zeros(rgb.shape[:2], np.uint8)
|
348 |
bgdModel = np.zeros((1,65), np.float64)
|
349 |
fgdModel = np.zeros((1,65), np.float64)
|