Update app.py
Browse files
app.py
CHANGED
|
@@ -147,7 +147,7 @@ def linscale(linear):
|
|
| 147 |
|
| 148 |
def remove_bg(fl, count):
|
| 149 |
global fl_
|
| 150 |
-
fr = cv2.imread(fl)
|
| 151 |
|
| 152 |
b = 1
|
| 153 |
element = cv2.getStructuringElement(cv2.MORPH_RECT, (2 * b + 1, 2 * b + 1), (b, b))
|
|
@@ -175,7 +175,7 @@ def remove_bg(fl, count):
|
|
| 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 - fr_mask
|
| 179 |
|
| 180 |
m = cv2.inRange(fr, np.array([240,240,240]), np.array([255,255,255]))
|
| 181 |
fr[m>0] = (239,239,239)
|
|
|
|
| 147 |
|
| 148 |
def remove_bg(fl, count):
|
| 149 |
global fl_
|
| 150 |
+
fr = cv2.imread(fl).astype(np.uint8)
|
| 151 |
|
| 152 |
b = 1
|
| 153 |
element = cv2.getStructuringElement(cv2.MORPH_RECT, (2 * b + 1, 2 * b + 1), (b, b))
|
|
|
|
| 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 - fr_mask).astype(np.uint8)
|
| 179 |
|
| 180 |
m = cv2.inRange(fr, np.array([240,240,240]), np.array([255,255,255]))
|
| 181 |
fr[m>0] = (239,239,239)
|