Update app.py
Browse files
app.py
CHANGED
@@ -580,7 +580,15 @@ def draw_mask(l, t, th, v, d, evt: gr.EventData):
|
|
580 |
dilation = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (15-(t*2+1), 15-(t*2+1)), (t, t))
|
581 |
mask = cv2.dilate(mask, dilation)
|
582 |
|
583 |
-
bd = cv2.convertScaleAbs(cv2.Laplacian(bg, cv2.CV_64F, 5))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
584 |
|
585 |
#indices = np.arange(0,256) # List of all colors
|
586 |
#divider = np.linspace(0,255,l+1)[1] # we get a divider
|
|
|
580 |
dilation = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (15-(t*2+1), 15-(t*2+1)), (t, t))
|
581 |
mask = cv2.dilate(mask, dilation)
|
582 |
|
583 |
+
#bd = cv2.convertScaleAbs(cv2.Laplacian(bg, cv2.CV_64F, 5))
|
584 |
+
|
585 |
+
n = int((bg.shape[0]*bg.shape[1]) / (256*256))
|
586 |
+
_bg = cv2.medianBlur(bg, 255)
|
587 |
+
|
588 |
+
for i in range(0, n):
|
589 |
+
_bg = cv2.medianBlur(_bg, 255)
|
590 |
+
|
591 |
+
bg = cv2.convertScaleAbs(bg.astype(np.int16)-_bg.astype(np.int16)).astype(np.uint8)
|
592 |
|
593 |
#indices = np.arange(0,256) # List of all colors
|
594 |
#divider = np.linspace(0,255,l+1)[1] # we get a divider
|