From 01f176949321f45e9f3b3917adf3322493f42254 Mon Sep 17 00:00:00 2001 From: Daniel Gatis Date: Fri, 9 Oct 2020 15:36:25 -0300 Subject: [PATCH] add alpha matting --- setup.py | 2 +- src/rembg/bg.py | 6 +++--- src/rembg/cmd/cli.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index ef7ff25..a0a5034 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ with open("requirements.txt") as f: setup( name="rembg", - version="1.0.12", + version="1.0.13", description="Remove image background", long_description=long_description, long_description_content_type="text/markdown", diff --git a/src/rembg/bg.py b/src/rembg/bg.py index 2a6633b..f364eeb 100644 --- a/src/rembg/bg.py +++ b/src/rembg/bg.py @@ -70,9 +70,9 @@ def remove( data, model_name="u2net", alpha_matting=False, - alpha_matting_foreground_threshold=235, - alpha_matting_background_threshold=15, - alpha_matting_erode_structure_size=15, + alpha_matting_foreground_threshold=240, + alpha_matting_background_threshold=10, + alpha_matting_erode_structure_size=10, ): model = model_u2net diff --git a/src/rembg/cmd/cli.py b/src/rembg/cmd/cli.py index f076c6b..ce0229a 100644 --- a/src/rembg/cmd/cli.py +++ b/src/rembg/cmd/cli.py @@ -32,7 +32,7 @@ def main(): ap.add_argument( "-af", "--alpha-matting-foreground-threshold", - default=235, + default=240, type=int, help="The trimap foreground threshold.", ) @@ -40,7 +40,7 @@ def main(): ap.add_argument( "-ab", "--alpha-matting-background-threshold", - default=15, + default=10, type=int, help="The trimap background threshold.", ) @@ -48,7 +48,7 @@ def main(): ap.add_argument( "-ae", "--alpha-matting-erode-size", - default=15, + default=10, type=int, help="Size of element used for the erosion.", )