Spaces:
Sleeping
Sleeping
Update rembg_and_center.py
Browse files- 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 |
-
|
48 |
-
|
49 |
-
|
|
|
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...')
|