Update app.py
Browse files
app.py
CHANGED
@@ -554,8 +554,10 @@ def apply_mask(d,b):
|
|
554 |
global edge
|
555 |
|
556 |
edge = []
|
557 |
-
mask = cv2.cvtColor(d["layers"][0], cv2.COLOR_RGBA2GRAY)
|
558 |
-
mask[mask<
|
|
|
|
|
559 |
|
560 |
mask, bgdModel, fgdModel = cv2.grabCut(cv2.cvtColor(d["background"], cv2.COLOR_RGBA2RGB), mask, None,None,None,15, cv2.GC_INIT_WITH_MASK)
|
561 |
mask = np.where((mask==2)|(mask==0),1,0).astype('uint8')
|
|
|
554 |
global edge
|
555 |
|
556 |
edge = []
|
557 |
+
mask = cv2.cvtColor(d["layers"][0], cv2.COLOR_RGBA2GRAY)
|
558 |
+
mask[mask<128] = 128
|
559 |
+
mask = mask - 128
|
560 |
+
print(mask[mask>0])
|
561 |
|
562 |
mask, bgdModel, fgdModel = cv2.grabCut(cv2.cvtColor(d["background"], cv2.COLOR_RGBA2RGB), mask, None,None,None,15, cv2.GC_INIT_WITH_MASK)
|
563 |
mask = np.where((mask==2)|(mask==0),1,0).astype('uint8')
|