Comments (3)
Can't you already do a big part of that with the "Contrasts cut level" slider? Or at least most of it? The "Turn the depthmap into absolute black/white" checkbox also gives the possibility to have some clearer depth cut.
For your near cut idea, I guess that you mean that some value clearer than X should be pure white while the rest is put to scale from 0 to 255?
from depthmap2mask.
The Contrast Cut Level + Absolute B&W is similar, I agree, but it's not exactly the same as what I'm looking for as a user.
I see there is potential in having z-depth derived gradients in the mask itself - you demonstrated that very well in your examples. And this feature should be kept. And even expanded ! But it's different from what most compositing software users will be looking for.
Normally, much like when you draw a custom mask shape in mask mode in the WebUI, the mask you get is completely white in the areas you want to keep/change, and completely black for the opposite, and the the shades of grey are only used to feather and anti-alias the mask. This feathering on the edges is similar to the mask blur function of the WebUI by the way.
A precisely controlled black and white mask with feathered edges is what I'd like to do directly in the WebUI, instead of having to go to photoshop to adjust the levels to get the mask I need.
Imagine you have a person in front of a car, with a tree and hills in the background.
What I want to do is create a mask just for the car, which is in the middle of the scene. Right now it is only possible to have either just the person (the front ) or the person AND the car (the front + the middle) but not just the car (the middle but NOT the front).
My proposition is to do that with two parameters: the near cut
and the far cut
. This defines where the object I want in my mask begins and where it ends, according to its distance from the camera. That distance happens to be encoded as color, so we can use simple color adjustment processes to achieve the results we are looking for.
The far cut
is in fact potentially the same thing as your Constrast Cut Level. It works on the dark side of brightness curve. The near cut
would work in a similar fashion, but for the bright parts of the image, cutting them to black as well. And everything in between would be 100% white. With, eventually I hope, the possibility to feather the edges.
I believe you are using OpenCV for python since I got an error message mentioning it (something about a bad argument for cv2.cvtColor - I'll send bug report if I can manage to reproduce it). If that is the case, then I'm convinced that library must have the functions we need to adjust the depthmap colors to get what we need.
When the depthmap is generated, is the information stored in 8 bit per channel (like in standard jpg images) or are they in 16 or even 32 bit ? Is there some specification data about it ? I'm asking because this could make a big difference in the quality of the mask if we keep that more precise data format for our color adjustments.
from depthmap2mask.
I have a slightly different solution that also addresses the problem, see #26
I want better control of the mask, but entering a threshold value manually is very clunky. It's difficult to know what number is right. Is 100 too high? Is 150 too high? You have to use trial and error. To make it worse, you have to rerun the model every time, so it's not fast.
I think the better way to control the mask is to take advantage of the user mask. It can both be used to clip the mask area, and to automatically set the threshold value.
Ideally there'd be some way to mouse over the mask image and get the values directly, but even if you had that, entering the numbers manually is more work than just drawing a messy blob via the user mask pencil.
from depthmap2mask.
Related Issues (20)
- launch depends on flowdas-meta HOT 5
- Error loading script: No module named 'timm.models.beit' HOT 19
- FileNotFoundError: [Errno 2] No such file or directory: './externals/Next_ViT/classification/nextvit.py' HOT 7
- [Feature request] Call depthmap2mask as API in web ui Automatic1111
- Ignore user defined mask feature. HOT 1
- Hello, is here option, combine this with CLIP
- The midas depth is working but Img2IMg is relying so much on the orignal RGB
- Stuck here since 30 min.
- TypeError: 'int' object is not iterable
- Any chance to get this as a script and not extension? HOT 1
- Script doesn't show in the dropdown on google colab after installation
- After following the prompts to install, I restarted several times and changed several browsers, but still couldn't find and use them in the UI HOT 1
- KeyError: 'swin2b24_384' HOT 3
- Error loading script: depthmap_for_depth2img.py HOT 1
- All models except midas give a KeyError
- RuntimeError: Input type (float) and bias type (struct c10::Half) should be the same HOT 2
- TypeError: argument of type 'NoneType' is not iterable HOT 7
- the script does not appear in the list HOT 1
- The Depth aware img2img mask script does not work HOT 1
- AttributeError: 'Block' object has no attribute 'drop_path' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from depthmap2mask.