darktable-org / darktable

darktable is an open source photography workflow application and raw developer
https://www.darktable.org
GNU General Public License v3.0
9.64k stars 1.13k forks source link

Enhanced parametric masks #16188

Open brucewilliamsphotography opened 8 months ago

brucewilliamsphotography commented 8 months ago

Hi devs, Here's a situation I run into a lot. I can't construct a complicated mask using parametric mode, because the area I wish to select contains too wide a range of luminosities, too wide a range of hues, and too wide a range of saturation values. But often, if I was to break the selection down into smaller chunks, I COULD make valid selections using smaller ranges of Jz, Cz and hz, (or L, A, B, C, h) in combination with a drawn element. So I had this idea... what if you could define a drawn+parametric mask, and then "dump" it to something like an alpha channel mask (to use potatoshop terminology) which could sit in the Mask Manager module alongside any drawn masks. Once this D+P mask had been added to the Mask Manager as an alpha mask, the parametric values would be cleared, allowing the user to define ANOTHER parametric mask using different parameter values. In the perfect scenario, you could do this multiple times, defining small portions of your image with the parametric mask sliders, turning them into alpha channel (bitmaps?) masks, until you had assembled all of the masks required to construct your one big complicated mask, which could then be achieved using the combining modes in Mask Manager. Am I making sense? Does this sound achievable? Would it be of any value to anyone else?

ralfbrown commented 8 months ago

Probably the most straightforward way to implement that would be to allow a raster mask as a "shape" on a drawn mask, i.e. in addition to being able to select "use same shapes as" one would be able to select "use same mask as". With that setup, you would normally want the earlier module that generates the raster mask to be a no-op, e.g. an instance of the exposure module set to 0 EV.

The way drawn masks work is that an individual mask is generated for each shape, and those are combined with the specified operators (AND/OR/sum/etc) to generate the full drawn mask. So a raster mask would simply be another individual mask that happens to have been created by another module instance rather than from a user-specified shape.

todd-prior commented 8 months ago

@brucewilliamsphotography I'd be curious to see the image and the regions that you speak of just to fully understand the task at hand... usually you can put these together with polarities etc and manage to mask things...

brucewilliamsphotography commented 8 months ago

Todd, I'm at work at the moment, but will try and dig out the image that inspired this request when I get home tonight. I'll chuck it online somewhere and post a link.

todd-prior commented 8 months ago

Prior,Todd reacted to your message:

From: Bruce Williams @.> Sent: Monday, January 29, 2024 12:28:33 AM To: darktable-org/darktable @.> Cc: Prior,Todd @.>; Comment @.> Subject: Re: [darktable-org/darktable] Enhanced parametric masks (Issue #16188)  

Caution: External email.

Todd, I'm at work at the moment, but will try and dig out the image that inspired this request when I get home tonight. I'll chuck it online somewhere and post a link. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

brucewilliamsphotography commented 8 months ago

This was the image I was trying (unsuccessfully) to mask.... http://www.audio2u.com/download/darktable/_DSC4580.ARW I wanted to isolate Teigan from everything else.

TurboGit commented 8 months ago

It really depends on what you want to do with Teigan, if only adding for light or some "light" edit a simple curve could do:

image

And with a curve to add some exposure:

Before: image

After: image

_DSC4580.ARW.xmp.txt

EDIT: Was just a quick test done in less than a minute.

brucewilliamsphotography commented 8 months ago

So you're just using a drawn mask only, Pascal?

TurboGit commented 8 months ago

Yes, two actually. One to get the whole person and one just to remove the empty part between the hat/arm/shoulder/head. Then a little use of the guided filter and that's all. In photography it is very rare to have a need of a very precise (at the pixel level) mask.

TurboGit commented 8 months ago

Let me digress a bit :)

That's why I do not see a need to IA based selection for photography. It may be needed to composing if you want to cut&paste objects from one image to another in GIMP or some similar software (no name :). But in photography we just need to have smooth selection to avoid seeing the change at the border, and controlling this smoothness part is what guided filter is for. And all my masks have been done in less than a minute since I'm using darktable, so I'm not sure to see what an IA based selection could bring here. I'm not even convinced that in your example the IA would properly select Teigan.

todd-prior commented 8 months ago

I'm not even convinced that in your example the IA would properly select Teigan.

I'll check when I go home how good ON1 is. I have that product. I have never stuck with it because I find the tools in DT more to my liking and I spent a lot of time learning them but recently I did run a set of images through it and AI masking is not bad actually is helpful... You can make a preset for say foliage and it will mask what it thinks is foliage and it generally does a good job and the power comes from the concept of dymanic masking ie now you paste your edit on a photo and it will adjust the mask to what foliage is there or what sky is there etc and so it accounts for changes from image to image.....

EDIT:

This was the mask without any tweak of the sliders on the tools..it missed a bit of the hat... you can easily refine the edges but I just offered it to show what a proposed AI product would do by saying select people..

image

This is the image opened in ON1 and then a BW filter applied to show the unedited mask....

DSC4580

DSC4580 1

brucewilliamsphotography commented 8 months ago

Pascal, I wasn't suggesting any kind of AI tool in my initial request. I was suggesting (crudely!) the desire for some way to build a mask up bit by bit. But I understand your point about drawn masks. They can be fairly quick to implement. I just sometimes find the control points on drawn masks VERY fiddly to grab with the mouse, which makes varying the feather around different parts of the masked region quite tiresome to implement. :)

todd-prior commented 8 months ago

@brucewilliamsphotography Try grabbing segments of the mask between nodes ..they are easy to grab and bold up nicely. I find dragging them a little in or out and having a decent feather can allow you to easily add a bit more or take away from a mask... the opacity contrast can really help too... if you keep in from the edge you can get it to bleed out nicely

brucewilliamsphotography commented 8 months ago

Todd, that's the bit I have trouble with, though! I find the feather nodes, as well as the mask nodes themselves, incredibly tricky to capture with the mouse. That was the case when I only had a 1080p monitor, and is no different now with my 4k monitor. Guess I just have to keep practicing! :)

todd-prior commented 8 months ago

Todd, that's the bit I have trouble with, though! I find the feather nodes, as well as the mask nodes themselves, incredibly tricky to capture with the mouse

I feel like I changed the color by picking the gridline color I liked the most and I may have found a way to make them thicker in css or other but maybe not ...I know it did do something a ways back...

Anyway if you hover should be pretty easy...

https://github.com/darktable-org/darktable/assets/44409419/d3e37c01-245f-4125-8c5e-efd91e1ef5f8

github-actions[bot] commented 6 months ago

This issue has been marked as stale due to inactivity for the last 60 days. It will be automatically closed in 300 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.