zxhezexin commited on
Commit
c014b41
1 Parent(s): eb77bc3

Update rembg_and_center.py

Browse files
Files changed (1) hide show
  1. rembg_and_center.py +4 -3
rembg_and_center.py CHANGED
@@ -44,9 +44,10 @@ if __name__ == '__main__':
44
  # load image
45
  print(f'[INFO] loading image {file}...')
46
  image = cv2.imread(file, cv2.IMREAD_UNCHANGED)
47
- scale = opt.size / max(h, w)
48
- _h, _w = int(h_ * scale), int(w_ * scale)
49
- image = cv2.resize(image, (w_, h_), interpolation=cv2.INTER_AREA)
 
50
 
51
  # carve background
52
  print(f'[INFO] background removal...')
 
44
  # load image
45
  print(f'[INFO] loading image {file}...')
46
  image = cv2.imread(file, cv2.IMREAD_UNCHANGED)
47
+ _h, _w = image.shape[:2]
48
+ scale = opt.size / max(_h, _w)
49
+ _h, _w = int(_h * scale), int(_w * scale)
50
+ image = cv2.resize(image, (_w, _h), interpolation=cv2.INTER_AREA)
51
 
52
  # carve background
53
  print(f'[INFO] background removal...')