itsyogesh commited on
Commit
7e6cd1e
·
verified ·
1 Parent(s): 93228fa

Fix smooth edges

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -226,12 +226,12 @@ def smooth_edges(mask):
226
 
227
  # Resize the image to a smaller size, then back to the original size
228
  small_size = (pil_mask.width // 2, pil_mask.height // 2)
229
- pil_mask_small = pil_mask.resize(small_size, Image.ANTIALIAS)
230
- pil_mask_smooth = pil_mask_small.resize(pil_mask.size, Image.ANTIALIAS)
231
 
232
  # Convert back to a numpy array
233
  smoothed_mask = np.array(pil_mask_smooth)
234
- final_mask = cv2.bilateralFilter(mask, d=9, sigmaColor=75, sigmaSpace=75)
235
 
236
  return final_mask
237
 
 
226
 
227
  # Resize the image to a smaller size, then back to the original size
228
  small_size = (pil_mask.width // 2, pil_mask.height // 2)
229
+ pil_mask_small = pil_mask.resize(small_size, Image.Resampling.LANCZOS)
230
+ pil_mask_smooth = pil_mask_small.resize(pil_mask.size, Image.Resampling.LANCZOS)
231
 
232
  # Convert back to a numpy array
233
  smoothed_mask = np.array(pil_mask_smooth)
234
+ final_mask = cv2.bilateralFilter(smoothed_mask, d=9, sigmaColor=75, sigmaSpace=75)
235
 
236
  return final_mask
237