Haze Removal: Darkroom Preview Window doesn't match rendered image
thanks a lot for implementing the haze removal function. Cooool stuff.
Just tested it on several images and stumbled over a strange behaviour of the preview window in darkroom. I added some screenshots for illustration.
CRW.png is a screen of the preview Window showing the RAW-File (fit to screen) with a simple haze removal (German: Dunstentfernung). Parameters are set to: strength:0.75 distance.0.582.
JPG.png is a screen of the same image, exported as JPG (95%).
The JPG image looks sharper and does not show dark halos e.g. in the trees close to the horizon or the light halos close to the big trees right of the center.
If you zoom in, things change a bit.
CRW_zoom1.png shows the zoomed in CRW
JPG_zoom.png shows the zoomed in JPG
Both are almost identical
And things change again if you switch back to the zoomed in CRW (CRW_zoom2.png). Now a slight blueish haze is visible covering the trees in the distance.
Is this a bug or is there any way to change the configuration of the preview window ?
#1 Updated by Heiko Bauke over 2 years ago
I would like to emphasize that what you see in the darktable UI is a preview, where a down-sampled image went along the pixel pipeline. The preview will always differ from an exported file (export at 100%) that has been rescaled to the size of the preview window. This is not an issue that is specific to the haze removal module.
There is, however, a technical detail in the implementation of the haze removal module that may render this module more sensitive to the zoom level than other modules. Before the haze can be removed, the amount of haze has to be estimated for each pixel. For this purpose the neighborhood of each pixel is investigated. The size of this neighborhood is fixed and does not scale with the zoom level. In oder to be insensitive to the zoom level this neighborhood should scale according to the zoom level. This, however, would cause a very small neighborhood (possibly just the current pixel itself) at shrink-to-fit zoom level, too small for a proper haze estimation. Furthermore, down sampling the image changes the pixel structure, which also affects the haze estimation.
At the moment I do not see a simple fix for the described behavior because it is rooted deeply in the way how darktable works.
#2 Updated by pass 712 over 2 years ago
thanks for your reply. This makes sense.
Perhaps a new function "HQ-preview" could be added to allow for a last check before exporting the image. As you mentioned, other modules would also benefit from this, especially sharpening could be judged better. Just an idea.