freealise commited on
Commit
3901e7b
·
verified ·
1 Parent(s): 4d58024

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -180,10 +180,10 @@ def remove_bg(fl, count):
180
  fr_fg = np.bitwise_or(fr_diff, fr_mask).astype(np.uint8)
181
  cv2.imwrite(fl_, fr_mask)
182
 
183
- #m = cv2.inRange(fr, np.array([240,240,240]), np.array([255,255,255]))
184
- #fr[m>0] = (239,239,239)
185
- #m = cv2.inRange(fr, np.array([0,0,0]), np.array([15,15,15]))
186
- #fr[m>0] = (16,16,16)
187
  fr[fr_shadow>0] = (fr[fr_shadow>0] / 17).astype(np.uint8)
188
  fr[fr_fg==0] = (255,255,255)
189
 
@@ -243,8 +243,11 @@ def loadf(f, r_bg):
243
 
244
  if r_bg == True:
245
  fl = remove_bg(fl, i)
 
 
 
 
246
 
247
- fnew.append(fl)
248
  return fnew, fnew
249
  else:
250
  return f, f
 
180
  fr_fg = np.bitwise_or(fr_diff, fr_mask).astype(np.uint8)
181
  cv2.imwrite(fl_, fr_mask)
182
 
183
+ m = cv2.inRange(fr, np.array([240,240,240]), np.array([255,255,255]))
184
+ fr[m>0] = (239,239,239)
185
+ m = cv2.inRange(fr, np.array([0,0,0]), np.array([15,15,15]))
186
+ fr[m>0] = (16,16,16)
187
  fr[fr_shadow>0] = (fr[fr_shadow>0] / 17).astype(np.uint8)
188
  fr[fr_fg==0] = (255,255,255)
189
 
 
243
 
244
  if r_bg == True:
245
  fl = remove_bg(fl, i)
246
+ if i % 2: # odd: is photo without the flash
247
+ fnew.append(fl)
248
+ else:
249
+ fnew.append(fl)
250
 
 
251
  return fnew, fnew
252
  else:
253
  return f, f