wouldn’t it be great if you could judge sharpness of your images in lighttable mode? this mode is limited to small and medium sized thumbnails of your images, so we can deliver the required speed to browse a lot of them.
to tell whether or not you got the focus right during the shoot, we would like to look at the full resolution. the most you get out of lighttable mode will look like this:
which one is sharper?
if you’re not using the embedded jpg thumbnail or if you have worked on the history stack, these thumbnails are actually processed through our image pipeline. so depending on what you did with the image, processing the full-resolution can take seconds if not minutes. we really don’t want to do that for all visible images.
full-res embedded thumbnails
an average raw file stores quite a lot of thumbnails. often there is even a full resolution jpg to be found. couldn’t we make use of that?
now displaying this thumbnail is quite useless (there is a secret backdoor in dt to do it, but i’m not going to talk about it), as the resolution is usually smaller than what you’d get from the raw, highlights will look different, there are differences in color management and basecurves. it’s just different and if nothing else it confuses my perception of colors when looking at the developed raw after that.
so even if we don’t want to look at the thumbnail, we can extract focus information from it.
how it works
i tried simple edge-detection filters, such as the ones used for in-camera focus detection in the excellent magic lantern firmware. since different lenses have different sharpness and high-iso might make these numbers noisy, dt uses a slightly different approach.
we do a two-scale decimated cdf 2,2 wavelet transform and use a threshold on the detail coefficients. the second scale is only computed if the first scale (the sharper one) doesn’t yield any results. visually, these are displayed as red clusters (first scale, very sharp) and blue clusters (second scale, not quite as sharp).
to account for any cropping and lens or keystone correction potentially applied to the image, we transform the clusteres detected on the embedded jpg thumbnail through the image pipeline, as we do with drawn masks. that means you’ll get sharpness clusters on the correct spot without processing the image.
how to use it
switch on the new gui setting plugins/lighttable/display_focus
or indicate focus regions in the gui preferences dialog.
if you now select a picture in lighttable mode and press `z' to switch to full res preview, you should get something like
![red](red.jpg) ![blue](blue.jpg)double checking in darkroom mode and zooming to 200% shows that the one with the red boxes is indeed sharper:
where to get it
this code is currently in a branch `full-res-preview' and about to be merged into master, for release in the upcoming 1.4 release.
It's like Capture One with the focus mask.
- make it possible to filter images (e.g. to quickly get rid of unacceptably bad shots)
- tune the algorithms; they are confused by many shots I tried them on (please send email for images if you need them).
Thanks for the effort you put into DT, it's coming along really nicely!
Is there a chance that the algorithm takes into account where the in-focus area "should have been" - based on EXIF data? If the camera marks in the RAW file which AF sensor (PD) or sensor area (CD) the focussing was based on, this area could be analyzed with priority, and maked differently (i.e. a yellow box).
exiftool DSC01081.ARW | grep AF
Focus Mode : AF-C
AF Area Mode : Spot
Local AF Area Point : Center <----
Priority Setup Shutter Release : AF
AF Illuminator : Auto
AF With Shutter : On
i'm not really interested in jpg files, if anyone was to add support for it in src/common/imageio.c:65 (dt_imageio_large_thumbnail) it should just work.
But seriously, it would of course require a community effort, same as it is with basecurves, color matrices, noise profiles, ...
any idea ?
merry christmas !