Denoise – blur and sharpening improvments

Denoise – sharpening improvments

For several months (September / october 2024), I’ve been challenging myself to improve noise processing overall, based on the basic principle that ‘the human brain still has unsuspected capabilities compared to artificial intelligence’, but maybe this challenge is too ambitious… We’ll see what your opinion is ? What is generally certain is that my solution is more complex to implement.

Observing the current operation leads me to the following observations:

  • ‘Capture sharpening’ is probably the best tool for sharpening images, but it suffers from two major flaws:
    a) if the image is too noisy, the default system doesn’t work;
    b) it can’t be used on non-raw images.

The noise reduction system, whether in Detail tabs or in Selective Editing, is subject to the principles of RT’s four pipelines, and therefore what we see on screen (zoom) doesn’t match the final rendering well (this is an understatement and affects all processes).
Noise reduction inevitably leads to a reduction in sharpness. Regardless of the tool, with or without masks, certain details are “weakened”…

I proceeded in several stages :

  1. to overcome ‘a)’, I set up in ‘Capture sharpening’ (Raw tab) a ‘Presharpening denoise’ which applies gradually by successive iterations a light ‘3x3 soft’ to a fairly strong ‘5x5 strong’ median denoising filter before Capture Sharpening. This helps clarify the contrast mask and allows Contrast Threshold to work, and thus Capture Sharpening to work properly. This also helps to reduce noise in the output image. Be careful not to use values ​​that are too high so as not to degrade the image.

  2. ‘Show contrast mask’ is directly accessible from the main menu.

  3. For level ‘b)’, I implemented in Selective Editing ‘Capture Deconvolution’, which is an adaptation of Capture Sharpening in Raw tab (almost the same), to Selective Editing and allows you to use this algorithm alone or after denoising. Capture Sharpening’s capabilities allow for finer sharpening control by allowing you to soften the sharpness in the corners, thus enhancing the main subject’s focus. Unfortunately the system is still dependent on the 4 pipelines and the zoom problem. Consequently, the results in the TIF/JPG outputs correspond to those of ‘fit to screen’.

  4. To solve part of the problem I added in ‘Capture sharpening’ (Raw tab) a ‘Postsharpening denoise luminance’ which allows you in raw mode (with wavelets), to do an initial luminance denoising after Capture Sharpening taking into account the mask information. ‘Presharpening denoise’ must be greater than zero. Be careful not to use values ​​that are too high, you can fine-tune the noise reduction later. Obviously this system which is in Raw mode is not sensitive to the effect of the 4 pipelines.

  5. The ‘Selective editing denoise’ module has been extensively revised; it allows you to differentiate Denoise action based on image details and your wishes to process the background. The resulting action is the combination of the Denoise of the image and that of the mask created by ‘Contrast threshold’. On very noisy images you can reduce the mask noise. You can also differentiate the action with the curve ‘Equalizer denoise mask’. The ratio flat-structure areas allows you to correct the action between the two. But unfortunately the system is still dependent on the 4 pipelines and the zoom problem.

In summary for Denoise and Sharpening:

  • Capture Sharpening (Raw tab) allows you to improve its performance with noisy images in many cases and to perform noise preprocessing.
  • Denoise (Selective Editing) is more efficient, particularly thanks to the ‘contrast threshold’.
  • Sharpening (Selective Editing) has added a module similar to ‘Capture Sharpening’ (Raw tab), allowing you to process non-raw images and also to enhance sharpness after a possible denoise.

Blur the background and isolate the foreground

In Selective Editing, except ‘Global’ mode, you can now detach the foreground to highlight it and soften the background.

This is a similar approach to the one used in this example to differentiate the denoising action between uniform areas and areas with texture or detail - Recovery Based On Luminance Mask
Denoise in Selective Editing

You can use the following tools to blur the image:

  • Gaussian blur – Noise – Grain.

  • Median.

  • Guided Filter….

And of course all tools ‘Denoise’ (wavelets, etc.).

Probably, given my poor English and my limited knowledge of C++ code, the code, labels and tooltips are questionable, but I am open to any modifications.

Executables - captur-noise
Bin

Jacques

7 Likes

Salut Jacques,

I tried the Sharpening filter in the raw tab on a test photo taken at 25600 iso, taken with my old (but still rockin’!) camera that was introduced back in 2010. Modern cameras will do much better I guess.

This is a screenshot @100% of the raw, opened in your AppImage. Can you see the noise? :grinning:

Next one. I tried several settings in the Sharpening filter in the raw tab. This is the best one I could produce.

For the third one I used the classical Noise Reduction filter, in the Details tab, with Quality = Standard. Surprise!

Same one with Quality = High.

For me, and based on this single photo, the original NR filter seems to be superior. But perhaps I should investigate further…

Regards, Paul.

@paulmatth

Paul

Thank you for testing :slight_smile:

I’m not saying this replaces existing processing, but that it can complement it, and I’m not saying it’s the magic bullet. But it solves some of the problems with Capture Sharpening, denoise, etc.

So one doesn’t preclude the other.

The purposes of this module are outlined in my presentation.

But I’m probably not very clear in my presentation. The additional problem is that, obviously, there is no documentation. In most cases the first part related to Capture Shaping should be understood as an improvement of pre-processing… and not as a complete process.

I’ll answer the question in advance: Could we put the entire “Noise Reduction” module in Raw mode? Probably yes, and it would solve many problems, particularly with the preview/output difference. But the work would be significant…(slow in preview), it would feel like duplicating the code and GUI… and, of course, it wouldn’t work for non-raw files.

And thank you again, Paul, for testing :wink:

Jacques

Ok, clear.

Noise Reduction has been in the Details tab for ages, to change its position might be confusing to some users, including me. But if the other location solves many problems, you might think about the change. On the other hand, it’s a lot of work as you said…

I must confess that I nearly never visit the Raw tab, the basic settings work well for me.

Btw, I’ve never noticed that there is a significant difference between the NRs preview and the saved results. Perhaps at 400% there might be visible differences - but I’m not a pixel peeper, I hate that! I did that years ago when new demosaic algos were introduced in RawTherapee. But for me, as a simple amateur photographer, it’s the photo that counts, the end result!

1 Like

@paulmatth

Salut Paul

For information there are now 4 locations where you can do “denoise”

  1. in Raw tab : incorporate in Capture Sharpening - only partial
  2. in Detail tab - Noise reduction - original algorithm from Emil Martinec, modified by Ingo and very much by me since 2013.
  3. in Selective Editing - the biggest part by myself - the most complete.
  4. in Advanced tab - Wavelet levels - the biggest part by myself - Denoise and Refine…

The major problem with 2, 3 and 4 is on the one hand the evaluation of the noise which is used to calculate the strength of the wavelet (when you move a slider or a curve) - Mad (Median absolute deviation) which depends on the position in the preview (unless the image is homogeneous), and on the other hand when we use a mask of type “contrast threshold”, it is that like “mad” it takes into account the preview… and not the global image…

This is a (very, very) old request from some users and there are 3 solutions:
a) completely redesign the RT pipeline and design, which is, at least for me, mission impossible.
b) working in Raw mode, difficult and slow, but as a complement as I propose, it is admissible
c) deal with it and admit the drawbacks…

Merci pour ta participation et tes remarques

Jacques

I didn’t have much success with it either , but like @paulmatth , I probably need to investigate further. I did notice though that using the Postsharpening luminance denoise can produce colour artifacts.

Before: without Postsharpening luminance denoise (Presharpening denoise = 10, Postsharpening luminance denoise =0)

After: with Postsharpening luminance denoise (Presharpening denoise = 10, Postsharpening luminance denoise =40)

With these spread over 4 tabs and some 30+ sliders, users could spend a lot of time trying to find the best tool for the job. In most of these modules, there are two broad categories of noise (luminance and chrominance), but maybe it would be possible to be more specific about the type of noise that the module or slider is best suited for e.g. lines, dots, patterns (if this is indeed the case) - rather like the Impulse Noise module in the Detail tab . For example the Capture Sharpening module can produce maze-like pattern noise depending on the demosaicing algorithm and the settings. If the denoise function associated with this module was the best option for mitigating artifacts such as these, then it would make a lot of sense from the user point of view to reflect this in the slider name.

@Wayne_Sutton

Thanks for this reply.

Regarding the possible artifacts produced by Postsharpening Denoise, I think it may stem from a choice I made to simplify the algorithm. I’m using the G (green) channel - indeed, like the RGB mode in Denoise Reduction - instead of either Y (xyz) or L in Lab.
As I mentioned, I’m working through this module at my own pace, for a whole host of reasons, but I’ll look into whether there’s a possible alternative since we’re in RAW mode.

But in summary, noise processing is one of the major problems in digital photography, even in 2025 with more powerful sensors. The problem is compounded by the design of the RT pipeline

@Wayne_Sutton

Can you share the raw file and the pp3, thanks in advance.
:grinning:

I can’t share this particular file but I think you already have a raw file (Léon) that exhibits the same problem. Here’s the corresponding .pp3
2020-12-12_PC120930.ORF.pp3 (15.0 KB)

1 Like

@Wayne_Sutton

Léon’s image, a fond memory from over four years ago, allowed me to approach raw denoising (postsharpening denoise) in a different way (always with wavelets, but different from “noise reduction” or “Selective Editing.”). It’s a bit slow, of course, but I think it’s much better at reducing artifacts.

Executables currently under development.
Branch captur-noise
captur-noise
Thank you

Jacques

1 Like

Don’t forget False Color Suppression in the Raw tab which is similar to a denoise

1 Like

thanks @jdc, the colour artifacts seem to be fixed in this version.

1 Like

I continue to want to improve “at my own pace” two complex processes, Sharpening and Denoise.

After the last change regarding “Postsharpening denoise” in Raw mode, which allows - among other things - to easily differentiate the action between structures and flat areas (for me this is the main objective, because otherwise there are other ways to reduce noise), here is another improvement that I have been trying to make for several years.

It is located in “Selective Editing Denoise” and to see if what I did is understandable, I only attach a view of the GUI and the label of the tooltip.

Executables
captur-noise

This concerns “Locks MadL noise evaluation”… and only for Wavelet Luminance denoise.

And here the tooltip:

Allows you to lock the noise evaluation used for Wavelet denoise.
Wavelet denoise uses MadL (Median absolute deviation luminance) to act on the noise based on a slider or a curve.
Rawtherapee’s pipeline design results in different MadL values ​​depending on the preview position and lead to differences with the output.
If you enable this checkbox, the value used for global processing will be that of the preview at that time. This will allow you to prioritize a specific area, background, or face for noise reduction, rather than an overall average value. Of course, you should only check the box once you’ve selected the area.

You can see MadL values ​​per decomposition level and per direction (Horizontal, Vertical, Diagonal), if you compile and in console mode (with verbose=true), only in TIF/JPG output. Try with and without…
Example
level=0 dir=0 madL=165.526199
level=0 dir=1 madL=163.412811
level=0 dir=2 madL=99.615677
level=1 dir=0 madL=101.724983
level=1 dir=1 madL=96.211189
level=1 dir=2 madL=64.757935
level=2 dir=0 madL=77.182892
level=2 dir=1 madL=66.842247
level=2 dir=2 madL=28.550217
level=3 dir=0 madL=136.454468
level=3 dir=1 madL=129.566742
level=3 dir=2 madL=15.447464
level=4 dir=0 madL=495.309937
level=4 dir=1 madL=521.331177
level=4 dir=2 madL=16.711529
level=5 dir=0 madL=4247.053223
level=5 dir=1 madL=2668.656738
level=5 dir=2 madL=56.820599
level=6 dir=0 madL=34713.917969
level=6 dir=1 madL=15394.941406
level=6 dir=2 madL=1478.544556

For your general comments, but also for the Label (what to call this thing) and the Tooltip

Thank you

Jacques

Bonjour Jacques, petit problème !

When I check (activate) the entry “Locks MadL noise evaluation” and I change the Denoise Mode to Agressive, the image (shown at 100%) turns black. Back to Off and the image is shown as it should. Again to Conservative - black again! Only Non-local means and Off work as expected.

Unchecking the MadL evaluation does not lead to black images when changing the Denoise modes.

@paulmatth

Salut Paul

Strange… but if you say so, it’s true. :wink:

I can’t seem to do the same thing, with my test images

Can you send me your raw and PP3 files if possible? And if possible the place you chose in the image to evaluate the noise, as well as the precise sequence of actions.

This is something I’ve been trying to do since I started working on noise (over 16 years, at the time working under Dcraw and Perfectraw with Emil Martinec), so it’s very experimental…and there’s probably (it’s certain since you find a malfunction) a bug somewhere.

Thank you for testing, as always. :grinning:

just made 2 ‘small’ code changes that didn’t work well :wink:

Jacques

I’ve found other anomalies; the system only works under certain circumstances, sometimes where it can work very well.
I’ll investigate to find a viable solution in all cases; I’m not sure I’ll get there easily.

Tried today with another photo and didn’t see that “black-out” I wrote about…

@jdc
Hi Desmis. I’m guessing you saw some promising results while developing these improvements. Can you show us some examples?

2 Likes

@Lawrence37

Thank you for this request…I will try to satisfy it, even if the examples are not obvious - not to find - but to show that we can do “differently”.

As I’ve said many times, I’ve been a defender of social science, especially business as usual (habits). Making a change in order, principle, algorithm, or wording often leads to rejection… I hope that won’t be the case.

I’ve (intentionally) tackled complex topics, such as improving the excellent Capture Sharpening, porting this algorithm to non-raw mode, trying to solve the pipeline problem for Denoise (very very old and complex problem…), etc.

But I’ll try to find one or two examples…while trying to be educational.

For now, I’m trying to get “Locks MadL noise evaluation” working… I think I’ve (partially so far) added some value; all that remains is to improve it.

Thank you :grinning:

jacques

As requested by @Lawrence37 , I’ll use an example from an image (in Rawpedia) provided by, “An example using Andy Astbury’s harvest mouse image.” @Andy_Astbury . Thanks to him :grinning:

Rawpedia harvest mouse

I chose this image, which is planned for processing in another format in Rawpedia, because the addition of denoise in ‘Capture Sharpening’ simplifies and improves the processing. The link to the Raw file is in Rawpedia and also here (I hope it works).
Raw file

I chose to start with ‘neutral’ to avoid any possible interference.

Let’s start with Capture Sharpening.

  • Activate Show Contrast Mask
  • Examine the ‘Presharpening Denoise’ action. In this image, the action isn’t particularly obvious, but it will clarify the mask and also (slightly) reduce luminance and chrominance noise. Be careful not to go too far; it’s a compromise. On other, noisier images, ‘Presharpening Denoise’ (PD) will allow Capture Sharpening to work, because if there’s too much noise, the mask is uniformly white, so it doesn’t work. For these very noisy images, PD will generate the mask, and Contrast Threshold will then be operational.
  • Then, activate ‘Postsharpening Denoise’, which will take into account the mask generated just beforehand and apply Wavelet denoising to the three RGB channels (Chrominance and Luminance). You can see that the ‘uniform areas’ are denoised, leaving almost no texture.

Then Selective Editing - tool - Sharpening
However, this denoising, even if slight, weakens the impression of sharpness.
To restore some of the sharpness to the image, I used Capture Deconvolution - an adaptation of Capture Sharpening for non-raw images - in ‘Selective Editing’ mode in Global mode. By default, I left the system running automatically. Of course, you can change these settings.
You can see that I didn’t choose to soften the edges of the image, which ‘Corner radius boost’ allows with negative values. Be careful, because of the Rawtherapee pipeline (still it), the softening will only correspond to the output in ‘fit to screen’ mode.

I wanted to keep it as simple as possible, without going into (complex) technical details.

I’m attaching the pp3 file, but it contains almost only the settings I just mentioned. Of course, my settings are quite arbitrary…
_D4D1775.NEF.pp3 (16.8 KB)

Executables
captur-noise

Excuse my bad english.

Another thing, I think “Locks MadL noise evaluation” works much more correctly now. Try it in Basic and Standard (in this case, you will see 21 sliders with MadL settings for the 7 decomposition levels and 3 directions (horizontal, vertical, diagonal) , and the possibility to change the calculated values).

Jacques

1 Like