How to get a white background in the final result?

#8
by phonicly - opened

Is there any parameter to achieve a white background?

Hi, suppose you follow the instructions here to obtain the mask: https://huggingface.co/ZhengPeng7/BiRefNet#use-the-loaded-birefnet-for-inference.
Then, you can use mask * original_image + (1 - mask) * new_background, where new_background = np.ones_like(original_image, dtype=np.uint8) * 255 in your case (white background).
You can also refer to an old issue about this on my GitHub repo: https://github.com/ZhengPeng7/BiRefNet/issues/21.
Feel free to tell me if you have further questions.

Thank you - appreciate your help.

Ur welcome!

ZhengPeng7 changed discussion status to closed

Sign up or log in to comment