master ← jenshannoschwalm:demosaic_sharpen
opened 02:08PM - 01 Jun 25 UTC
This has been discussed many times here and on pixls.us so here we go. As we hav…e D&S giving good results i was somewhat reluctant to work on this and do a pr but as CS works so good on RT and after a lot of testing (and using this on my personal images for a while with 3 auto applied presets for my fixed-lens camera - one for high-iso with CS turned off and two presets for wide open and "normal") i am pretty confident it's worth it and would be a significant improvement.
(It took quite a while to spot a very bad bug in GPU code leading to system instability and crashes so unfortunately not for 5.2)
Please test in depth and let's decide if this is for master. It's a lot of processing - so not a superfast module.
_________________________________________________
Capture sharpening has been implemented to work inside the demosaic module so it's raw only.
Credits to: Ingo Weyrich (heckflosse67@gmx.de), he implemented the original algorithm for rawtherapee, this implementation is based on his work, especially the convolution kernels.
CPU and OpenCL code paths are both available.
Demosaic module gets more parameters so there is a version bump, one float has been reserved.
**The "mini manual"** (regularly updated to latest commit)
Capture sharpening (CS) tries to recover details lost due to in-camera blurring, which can be caused by diffraction, the anti-aliasing filter or other sources of gaussian-type blur. Prerequisites are
- good white balance parameters (same requirement as for highlights reconstruction or demosaic)
- no chromatic aberration, you might want to add the "raw chromatic aberration" module
- low noise as noise will be amplified by CS
**Controls**
1. **capture sharpen**
switches CS on if above zero and defines the strength of overall effect.
CS works in an iterative process, this defines the number of iterations, mostly a setting of 10 will be enough.
As downscaling after demosaicing reduces the visibility of CS we reduce iterations in such cases for performance.
2. **radius**
defines the basic convolution gaussian sigma.
This should not be set by "creative means" but to the blurring radius of the optical system and sensor, too large values will lead to artifacts like halos.
Calculating a correct radius is provided internally. This will be done either if you
a) click on the button besides the slider
b) activate capture sharpen the first time after resetting to demosaic defaults or developing old edits.
3. **contrast threshold**
As sensor noise will be amplified by CS we take some care about this by a per pixel variance analysis and use a logistic function with this threshold to avoid CS in noisy areas. The default is good for low iso images.
Note the visualizing button at the right.
4. **corner boost**
Increase the convolution radius in image corners outside the sharp centre.
5. **sharp centre**
Define the "sharp" centre part of the image
Note the visualizing button at the right.