Update app.py
Browse files
app.py
CHANGED
|
@@ -174,12 +174,13 @@ def remove_bg(fl, i):
|
|
| 174 |
fr_diff = cv2.dilate(cv2.erode(fr_diff, element), element)
|
| 175 |
|
| 176 |
if i % 2: # odd: is photo without the flash
|
| 177 |
-
fr = cv2.imread(fl_)
|
| 178 |
fr = fr_diff - fr
|
| 179 |
cv2.imwrite(fl_, fr)
|
| 180 |
else: # even: with the flash
|
| 181 |
fl_ = fl.split(".")[0] + "_.png"
|
| 182 |
-
|
|
|
|
| 183 |
|
| 184 |
return fl_
|
| 185 |
|
|
|
|
| 174 |
fr_diff = cv2.dilate(cv2.erode(fr_diff, element), element)
|
| 175 |
|
| 176 |
if i % 2: # odd: is photo without the flash
|
| 177 |
+
fr = cv2.imread(fl_).astype(np.uint8)
|
| 178 |
fr = fr_diff - fr
|
| 179 |
cv2.imwrite(fl_, fr)
|
| 180 |
else: # even: with the flash
|
| 181 |
fl_ = fl.split(".")[0] + "_.png"
|
| 182 |
+
print(fl_)
|
| 183 |
+
cv2.imwrite(fl_, fr_diff.astype(np.uint8))
|
| 184 |
|
| 185 |
return fl_
|
| 186 |
|