Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The pull request integrates u2-net background removal. So you can remove the background before or after the depth is calculated. It allows you to save the background removed image, and a bk/white mask. default is set to off.
There's one line that might cause trouble on Windows
os.environ["U2NET_HOME"] = str(bg_model_dir)
this line tells rembg where to look for the model.
I haven't fully tested with 3dinpaint or stereo images. An alpha channel is added if using pre-depth calculate which might cause issues with them.
Removing the background before calculating depth for certain images can really improve the details.
depth with background removed
depth with normal background
orginal
background removed
mask (this has an alpha channel if you using light ui this will look white)
There's also u2-net clothing segmentation, but that seems a little out of scope for the moment.