Beep6581 / RawTherapee

A powerful cross-platform raw photo processing program
https://rawtherapee.com
GNU General Public License v3.0
2.67k stars 306 forks source link

Wavelet levels Denoise module modifies image upon turning it on #5970

Open TechXavAL opened 3 years ago

TechXavAL commented 3 years ago

This is a surprising effect, most probably due to a bug.

Linux Mint 20 RT5.8dev commit: b4f68adb6

If you turn on the Wavelet Levels tool and also turn on the Clarity module with default settings, then the Denoise and Refine module changes the contrast of the image by just turning it on. It happens with «Wavelet Levels» setting set on levels 5, 6 and 7, but although in level 7 there's a slight change in the histogram, I can't see any change in the preview. So the main problem is when you set either level 5 or level 6.

This is the image with Wavelet Levels set on level 5, but Denoise turned off. You can see in the history all the processing that has been done after applying an Neutral profile. The «W-Process» entries in the history happen when turning on the Clarity module (with default settings):

l5-nodenoise

Now the notable change by just turning on Denoise & Refine, with all sliders set to 0 (default values):

l5-denoise

(take a look specially at the highlights in the water and the boat, but it would be better if you opened both images in different browser tabs and switch between them).

If in doubt these are the differences in the new waveform:

Denoise turned off: waveform-nodenoise

Denoise turned on: waveform-denoise (again, if you can't see the differences, load in tabs and switch between them)

heckflosse commented 3 years ago

Well, most tools in RT have default settings which change the output when the tool is enabled. One exception is the vibrance tool.

TechXavAL commented 3 years ago

This module in this tool didn't do that. It's a denoise feature, and it had never changed the contrast of the image when turning it on and with all sliders set to 0. At least not from version 5.6 onwards, to my knowledge.

And up to now, with the tests I've done, it only happens when used with the Clarity module turned on. So no Clarity, no problem.

But if it has this new behavior and it's not a bug, then at least it should be known, and perhaps RawPedia must be updated to reflect the change.

heckflosse commented 3 years ago

I didn't say it's not a bug ;-) Maybe @Desmis can chime in.

Thanatomanic commented 3 years ago

For reference, the Sharp-mask and Clarity seems to have been introduced only recently: https://github.com/Beep6581/RawTherapee/pull/5660 judging by the tool label appearing in the default translation file.

Desmis commented 3 years ago

@TechXavAL It's too complex to solve, it will stay that way.

@Thanatomanic for your information, Clarity has been added to a wavelet branch at the end of 2015. This branch also contained

This branch has been extensively tested and has never been merged and has become impossible to compile (important differences with dev). It's at the request of users that I extracted "Clarity" in spring 2019

jacques

Thanatomanic commented 3 years ago

@Desmis Can you verify that the following steps are expected behavior?

Case 1

  1. Apply Neutral
  2. Enable Wavelet levels (zoom in at 1:1)
  3. Set Wavelet levels to 5 or 6 (for better demonstration in case 2)
  4. Enable Denoise and Refine
  5. Nothing changes

Case 2

  1. Apply Neutral
  2. Enable Wavelet levels (zoom in at 1:1)
  3. Set Wavelet levels to 5 or 6 (for better demonstration)
  4. Enable Sharp-mark and Clarity
  5. Observe changes
  6. Enable Denoise and Refine
  7. Observe changes (?!)

Like @TechXavAL remarked, it is counter-intuitive that in the first case the Denoise and Refine does nothing (if you hover over the Level sliders the values are 0), but in the second case it has a very clear effect. Apparently, the tools are linked somehow, but that is currently undocumented.

Desmis commented 3 years ago

@Thanatomanic I just push a commit 85bd64...

I hope if solve this behavior....it is complex because we use 2 different functions (ipwavelet and Ftblockdn...) and of course with the conception of wavelet level (it is different en Local adjustments - which is not to say that there are no problems with LA...there is currently a very large consumption of resources that Ingo is going to deal with...;), level decomposition of the first must be the same in the second. This problem is the consequence (this is not a reproach) to have requested that denoise works together with the 7th level.

In the same manner now denoise chroma works...(same problem as above, for the same reason) Warnings appear, I would then remove them

I am not at home...but always in Paris with my family :)

jacques

Warning suppressed ...

TechXavAL commented 3 years ago

I've just tried again with latest commit, and the odd behaviour is still there.

As it is now, the changes in the look of an image are dramatic enough that it almost renders this module useless to me, or I'm forced to start from this module straight away, and then try to get what I wish from the picture with other tools (even trying to undo what this module has done, much like I was used to do in Lightroom).

Without denoise&refine module: IMG_2621

With denoise&refine module applied: IMG_2621-1

You may have to quickly switch between both images to clearly see the changes.

Is there a possibility to fix it some way?

Desmis commented 3 years ago

I did a review of the "ipwavelet" code, especially the denoise part. When expander "denoise" is enabled and no denoise slider (luminance or chrominance) is different from zero, then never denoise functions are called

TechXavAL commented 3 years ago

I can't say what's happening, only what I see.

You can check with this Playraw image: https://discuss.pixls.us/t/playraw-foggy-woods/21297 (the raw image is there to download)

Here is my pp3 before wavelet denoise & refine module is enabled: IMG_2621.CR2_no_wavdenoise.pp3.zip

And this is my pp3, this time with wavelet denoise & refine module enabled, but with default values (that is, everything set to 0 or neutral position). The rest of the settings are exactly the same as in the previous pp3: IMG_2621.CR2_with_wavdenoise.pp3.zip

When you load this second pp3, there's a really noticeable change in contrast in the image, but I can't really describe it: it seems a bit like enhancing the high contrast edges, but with thick areas of influence, or a bit just a darkening of darker areas below a threshold point... Again, not sure what it is, but it breaks all the work done in the image (good or bad work...).

May it have something to do with the Guided Image Filter used in this module?

Desmis commented 3 years ago

The answer may seem trivial, but it is the consequence of what I was asked....

==> If "denoise" is enabled to use 7 levels of decomposition (I was even asked for 8...)

In your case, the difference is due when you "enable" denoise to change from 6 to 7 levels of decomposition

TechXavAL commented 3 years ago

Ok, so after your answer I've made some new (different) tests and I think I know now what is happening: there is indeed a change (pretty dramatic sometimes) upon turning on denoise&refine with default values (just by turning on the module) and it's caused by the module forcing the setting Wavelet levels to be set at 7, no matter your initial choice. Of course the denoise&refine module is not available if you set Wavelet levels to 8 or higher, so the problem arises with a setting of 5 or 6.

I will explain how I understand it happens:

If that can't be fixed (I may wish to use a setting of Wavelet levels=5, or 6, and the Denoise&Refine module at the same time), it will be a pity, because if you use the Denoise&Refine module, it renders the Wavelet levels option useless.

But at the very least, I know now what is happening and won't be caught by surprise. There will be things that this tool wouldn't be able to do, and I'll have to accept that.

Desmis commented 3 years ago

I'm not saying it's impossible to solve, but it's very difficult, because you're acting on 2 different processes simultaneously (wavelet levels and denoise in FTblockdn use also by "denoise main" and "Local adjustments".

I was asked, and it took a lot of work, to be able to use denoise with levels 7 (and 8)....But now you ask me something else that is not easily compatible. I think, at least for a while that it will stay like that

jacques