Update app.py
Browse files
app.py
CHANGED
@@ -174,8 +174,8 @@ def remove_bg(fl, count):
|
|
174 |
fr_diff = cv2.dilate(cv2.erode(fr_diff, element), element)
|
175 |
|
176 |
if count % 2: # odd: is photo without the flash
|
177 |
-
fr_mask = cv2.cvtColor(cv2.imread(fl_).astype(np.uint8), cv2.COLOR_BGR2GRAY)
|
178 |
-
fr_mask = (fr_diff
|
179 |
cv2.imwrite(fl_, fr_mask)
|
180 |
|
181 |
m = cv2.inRange(fr, np.array([240,240,240]), np.array([255,255,255]))
|
|
|
174 |
fr_diff = cv2.dilate(cv2.erode(fr_diff, element), element)
|
175 |
|
176 |
if count % 2: # odd: is photo without the flash
|
177 |
+
fr_mask = np.bitwise_not(cv2.cvtColor(cv2.imread(fl_).astype(np.uint8), cv2.COLOR_BGR2GRAY))
|
178 |
+
fr_mask = np.bitwise_and(fr_diff, fr_mask).astype(np.uint8)
|
179 |
cv2.imwrite(fl_, fr_mask)
|
180 |
|
181 |
m = cv2.inRange(fr, np.array([240,240,240]), np.array([255,255,255]))
|