Extraltodeus / depthmap2mask

Create masks out of depthmaps in img2img
355 stars 35 forks source link

Feature Request: 2 checkboxes to control the depth mask with your user mask #26

Open phills11 opened 1 year ago

phills11 commented 1 year ago

Thanks for the script!. Depth detection using an NN is very handy for Img2Img editing, and I wouldn't know how to set it up without this handy script.

However, I would request 2 check boxes to allow better control of the masking area:

  1. A checkbox to combine the depth mask with your user mask via an AND operation. If checked, the In-Painter will only change the areas of the picture in which you've hand drawn a mask AND the depth mask is on.

This allows you to messily draw an area and have the area be refined by the depth mask. Also, sometimes the depth mask will identify 2 objects as both being in the foreground, so this will let you easily specify only 1 of them which should be changed.

  1. A second checkbox to have the depth mask threshold automatically be set at [x%] of the average value of the area you've painted with your user mask. The hard part of using the threshold slider is you don't know what values to put in, and it takes a lot of trial and error to set.

If you check this checkbox, you don't have to guess at the threshold number for objects in the picture anymore. The first time you run it, just draw what you want to change, and the slider bar will be automatically set it for you after the run. Then uncheck the checkbox, or manually adjust the threshhold.

[x] can't be 100% or half the area would not be covered. I wish the [x] could be just hardwired in at say 75%, but I think that'll be too rigid. So I would suggest letting the user set it via a slider, e.g. starting at [x]=75%.

I think these checkboxes are also a solution to the problem identified by @AugmentedRealityCat in https://github.com/Extraltodeus/depthmap2mask/issues/3.

I think these should be both relatively easy to implement. I might try to mod a quick-and-dirty version of this myself, if I can figure out the code.