focus peaking in darktable

Hi,

I spent the last 2 days working to improve the in-focus detection in darktable.

Details and code here :

19 Likes

This looks extremely useful. Hopefully this does not have to wait till christmas '20 to be released :wink:.

what do the colours mean? blue is y gradient and yellow is x gradient? and is this darkroom mode only now or does it also work in lighttable?

@hanatos
Have a look into the PR, all questions are answered there:

what do the colours mean?


 The algorithm prefilters the noise, then computes the gradients in picture, and finally the gradients statistics (average and standard deviation) :
edges gradients above mean + 5 std are shown in yellow (very sharp),
edges gradients above mean + 4 std are shown in green (medium sharp),
edges gradients above mean + 3 std are shown in blue (little sharp).



and is this darkroom mode only now or does it also work in lighttable?

I just changed the image stats right now. The previous assumption was gradients followed a gaussian distribution, but several papers suggest they follow an hyper-laplacian one, so the predicator (= kinda standard deviation) is changed.

As it turns out, it reproduces better the wavelet-based focus detection of @hanatos, but adds a heatmap of contrast along edges, so you get a more accurate in-focus preview.

Looks like the focus peaking in viefinder of some cameras. I think it is very useful! Thanks. Do you plan to release it in dt3?

No, darktable 3.0 has been in feature freeze since october.

So, hoping to find it in dt 3.1
Thank you

As we have focus dectection in darktable now, the next step would be adding support for focus stacking :slight_smile:

6 Likes

As focus stacking is now merged into master, I’ve started to test it and I find it excellent, a very welcomed addition to help culling.
Don’t you think it would deserve an additional icon here ?

Cattura9

1 Like

Hmm what icon would make sense for this ? I’m not sure it’s a good idea to have it there, these are colour related scopes.

Focus staking is much more complicated than a simple DoF scope.

1 Like

There’s this Enfuse pro plugin that can do focus stacking (never tried that though)
https://www.multimedia4linux.de/index.php/143-darktable-tutorial-pano-pro-plugin
Anybody worked with that?

Tested on master. Impressive ! Thanks for that. :slight_smile:

1 Like

I’ve noticed that the result is sensitive to the dev pipe (for example filmic). More I give contrast to the image better is the detection.
Should not it be independent (based more or less on the raw image) ?

The feature uses whatever surface is sent to Cairo for drawing on UI, so it doesn’t care about the pipe. Using the raw image would not take into account the possible deblurring steps added in the pipe and would be a lot slower. The sharpness detection in made indirectly, using a contrast detection and assuming contrast means sharpness (which is not always the case). There is an extra step of regularization to reduce the sensitivity to local contrast (aka unrelated to actual sharpness, but to huge lightness transitions), but the algo can still be fooled by big luminance steps and noise.

2 Likes

Those are checks, over/under exposure, gamut, etc. Focus check would not be out of place IMO

1 Like

Actually it makes sense. That’s IMO a place for overlay info that tells you properties of parts of image (and currently it’s colour related scopes + your exposure assesment mode).

A one that brings “focus peaking” to mind? What do camera manufacturer’s use? The best match i found was a viewfinder kind of image with bisected edges and center target (bringing sort of sniper scope look to viewfinder-like icon)


Regarding icons, the only ones making sense to me in that place are exposure assesment and gamut check. raw overexposure not at all :wink: