rembg
rembg copied to clipboard
How to set alpha matting from python code?
Hello,
The alpha matting parameter is great but I need them to be used from python code to integrate with my existing app.
Thanks!
You can call the remove function in your script with the parameters according to the one in the rembg/bg.py file. Example: output = remove(input,False,240,10,20,None,False,False)
`def remove(
data: Union[bytes, PILImage, np.ndarray],
alpha_matting: bool = False,
alpha_matting_foreground_threshold: int = 240,
alpha_matting_background_threshold: int = 10,
alpha_matting_erode_size: int = 10,
session: Optional[BaseSession] = None,
only_mask: bool = False,
post_process_mask: bool = False,
)`