Update app.py
Browse files
app.py
CHANGED
@@ -194,13 +194,12 @@ def remove_bg(fl, count, mh, ms, md, lm):
|
|
194 |
fr[m>0] = (239,239,239)
|
195 |
m = cv2.inRange(fr, np.array([0,0,0]), np.array([15,15,15]))
|
196 |
fr[m>0] = (16,16,16)
|
|
|
|
|
197 |
|
198 |
fr_fg[fr_fg>0] = 3 #probable fg
|
199 |
mask, bgdModel, fgdModel = cv2.grabCut(fr, fr_fg, None,None,None,31, cv2.GC_INIT_WITH_MASK)
|
200 |
mask = np.where((mask==2)|(mask==0),0,1).astype('uint8')
|
201 |
-
|
202 |
-
fr[fr_shadow>0] = (fr[fr_shadow>0] / 17).astype(np.uint8)
|
203 |
-
#fr[fr_fg==0] = (255,255,255)
|
204 |
fr[mask==0] = (255,255,255)
|
205 |
|
206 |
cv2.imwrite(fl, fr)
|
|
|
194 |
fr[m>0] = (239,239,239)
|
195 |
m = cv2.inRange(fr, np.array([0,0,0]), np.array([15,15,15]))
|
196 |
fr[m>0] = (16,16,16)
|
197 |
+
fr[fr_shadow>0] = (fr[fr_shadow>0] / 17).astype(np.uint8)
|
198 |
+
#fr[fr_fg==0] = (255,255,255)
|
199 |
|
200 |
fr_fg[fr_fg>0] = 3 #probable fg
|
201 |
mask, bgdModel, fgdModel = cv2.grabCut(fr, fr_fg, None,None,None,31, cv2.GC_INIT_WITH_MASK)
|
202 |
mask = np.where((mask==2)|(mask==0),0,1).astype('uint8')
|
|
|
|
|
|
|
203 |
fr[mask==0] = (255,255,255)
|
204 |
|
205 |
cv2.imwrite(fl, fr)
|