fix issue 116

This commit is contained in:
Daniel Gatis 2021-07-06 00:56:31 -03:00
parent 4e64eccb44
commit ae46588c7e
2 changed files with 12 additions and 9 deletions

View File

@ -11,7 +11,7 @@ with open("requirements.txt") as f:
setup(
name="rembg",
version="1.0.26",
version="1.0.27",
description="Remove image background",
long_description=long_description,
long_description_content_type="text/markdown",

View File

@ -92,14 +92,17 @@ def remove(
mask = detect.predict(model, np.array(img)).convert("L")
if alpha_matting:
cutout = alpha_matting_cutout(
img,
mask,
alpha_matting_foreground_threshold,
alpha_matting_background_threshold,
alpha_matting_erode_structure_size,
alpha_matting_base_size,
)
try:
cutout = alpha_matting_cutout(
img,
mask,
alpha_matting_foreground_threshold,
alpha_matting_background_threshold,
alpha_matting_erode_structure_size,
alpha_matting_base_size,
)
except:
cutout = naive_cutout(img, mask)
else:
cutout = naive_cutout(img, mask)