Skip to content

In preprocess_image, using consistent cutoff value for bounding box and pre-multiplied alpha#186

Open
gongminmin wants to merge 1 commit intomicrosoft:mainfrom
gongminmin:AlphaCutoff
Open

In preprocess_image, using consistent cutoff value for bounding box and pre-multiplied alpha#186
gongminmin wants to merge 1 commit intomicrosoft:mainfrom
gongminmin:AlphaCutoff

Conversation

@gongminmin
Copy link

The alpha from rembg is not binary. A small foreground object make causing a transition region around the object due to resizing. Binarize the alpha channel with a cutoff value fixes the problem. Also, this cutoff is used in bounding box selection.

Here is an example. Before this change, a wide transition of alpha from 0 to 1 causing the system can't distinguish the foreground and background. The result is a quad shape.
image

After this change, it's much better in 3D shape.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant