freealise commited on
Commit
3d3690a
·
verified ·
1 Parent(s): 15af9cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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)