Spaces:
Running
Running
Martin Tomov
commited on
Commit
β’
5e1955d
1
Parent(s):
033d608
dilated_image_mask_pil = Image.fromarray(mask) test
Browse files- gsl_utils.py +9 -9
gsl_utils.py
CHANGED
@@ -85,16 +85,16 @@ def gsl_process_image(image):
|
|
85 |
annotated_frame_with_mask = draw_mask(final_mask, image)
|
86 |
|
87 |
mask = final_mask.numpy()
|
88 |
-
mask
|
89 |
-
mask
|
90 |
-
dilated_image_mask_pil
|
91 |
|
92 |
-
result
|
93 |
|
94 |
-
diff
|
95 |
-
threshold
|
96 |
-
diff2
|
97 |
-
img3
|
98 |
-
diff3
|
99 |
|
100 |
return diff3
|
|
|
85 |
annotated_frame_with_mask = draw_mask(final_mask, image)
|
86 |
|
87 |
mask = final_mask.numpy()
|
88 |
+
mask = mask.astype(np.uint8) * 255
|
89 |
+
mask = dilate_mask(mask)
|
90 |
+
dilated_image_mask_pil = Image.fromarray(mask) # test
|
91 |
|
92 |
+
result = simple_lama(image, dilated_image_mask_pil)
|
93 |
|
94 |
+
diff = ImageChops.difference(result, Image.fromarray(image))
|
95 |
+
threshold = 7
|
96 |
+
diff2 = diff.convert('L').point(lambda p: 255 if p > threshold else 0).convert('1')
|
97 |
+
img3 = Image.new('RGB', Image.fromarray(image).size, (255, 236, 10))
|
98 |
+
diff3 = Image.composite(Image.fromarray(image), img3, diff2)
|
99 |
|
100 |
return diff3
|