Dual Demosaicing Slider --- Which Side is Which

It does not use different sensitivity scales. These are not blend % values.

I made a quick hack to visualize the DD mask.

Here’s a screenshot of the DD mask with a threshold of 10

And this is a screenshot of the CS mask with a threshold of 10

At same threshold the masks are equal.

No. I know they are not blend modes, which merge the result of two different things. They are choosing which part of the picture uses (100% of) one method and which part of the picture uses (100% of) the other. The choice being decided on the level of contrast.

With the DD slider, when I use 0 I get all AMAZE. When I use 20 then much (not necessarily 80%) of the picture uses AMAZE and the rest uses VNG. When I use 100 I get all VNG. Is that not the case, or can I never get to all VNG? (I am pretty sure that when I set it to 100 I was getting all VNG.)

Similarly with CS when I use 0 everything is sharpened When I use 20 quite a bit is sharpened and some is not and when I use 200 next to nothing is sharpened

Now I accept that the scale might not be linear since I am sure the perception of contrast is not liner, but it is certainly a contrast based scale in both cases, with both going from no contrast to the highest level of contrast. As the contrast decreases the use of AMAZE decreases. As the contrast decreases the capture sharpening decreases. (Hmm, is it that the highest level of contrast at which we get to all VNG is a lower level of absolute contrast than the level at which we get no capture sharpening?)

Well OK my choice of the word “sensitivity” was not the best one, maybe granularity might have been better. I meant nothing more than how much contrast difference it took to register a 1 point move on each scale.

Wow! Thanks, I really do appreciate that and the effort you are taking.

The visibility of the DD mask example is interesting since all I can say is that it does not match my experience when using the generated TIFFs. I have 2 requests if I may impose on you further.

(a) Have look at what the two masks show when both are set to 99. If 100 on the DD scale is no Amaze and all VNG then the DD screen should be almost all black but there should still be quite a bit of white area on the CS mask.

(b) If you have a picture that will show the differences between the two methods well then generate a couple of TIFFs at different DD settings (say 15 and 30) and look at the areas where the different levels give different looking masks. It was only by looking at actual TIFFs that I found that I was not seeing what I was expecting to see when I set the same figure for both masks.

First, the mask involves a sigmoid, which while tending to zero, never will reach zero.
Second, 100 on the DD scale does not mean no Amaze. That’s what the mask preview is for. Have a look at it.

@RichardRegal

One thing, which might be confusing (though logical for me) is the fact, that DD gives a different input for CS than single Demosaic, so giving a different CS mask

Well the second follows from the first :-).

OK so 100 on DD means “almost no AMAZE” not “no Amaze”. I guess my next question then is about the CS slider where presumably 100 means “almost no sharpening but still a little bit” and 200 means “even less than almost no sharpening but still just the teensiest bit”. (I am sorry this sounds facetious and I don’t mean it to be). The logic being that if you have selected 100 on DD there might be some of the AMAZE areas that you would wish to exclude from sharpening, which you could not do if the sliders had the same maximum.

Is there somewhere I could download the version with the DD mask? I would love to try it and if possible show to myself that I was wrong. (I am not being facetious here either, if I can remove a step from my workflow it would be nice.) If you also have an ideal test raw that would better show the differences in the demosaicing that would be helpful otherwise I can just use one of my own.

Indeed, it is hard to think of it operating any other way. DD needs an initial demosaic to work out where the contrasty areas are. It therefore has to start with (say) AMAZE. Unless you do some form of iterative generation whereby having done the first pass it selects a value for where to use VNG redoes its working to generate a new set of contrast levels, etc then you have to do that.

CS on the other hand needs to work on the actual demosaiced image.

When I generated my TIFFs for comparison I used Amaze only demosaicing and turned on capture sharpening to look at the mask to get the values to use for the DD slider. I then switched to AMAZE+VNG with my chosen value and turned off capture sharpening to make sure that that did not hide/exagerate any differences.

About the transition (the sigmoid):

I will work on this tomorrow as showing the DD mask would be really useful. Technically it’s easy. Just need to make the right gui for it…

3 Likes

“I will work on this tomorrow as showing the DD mask would be really useful”

Just remember who asked for this first :rofl: :rofl: :rofl: :rofl:

1 Like

He might have been waiting to see whether any one else wanted it too :slight_smile:
Now if someone can explain to my why Photoshop (and Affinity for that matter) want find any any differences when I use difference or subtraction blend modes on an image that I have demosiced once with AMAZE and once with VNG I would be happy. The difference is visible to the eye but not, it seems to the program.

Exactly :wink:

I have been trying to use that to understand the difference in practical terms between a slider that goes from 0–100 and a slider that goes from 0–200 and failed miserably.

However, another point occurs to me with the DD mask. I have been assuming that the slider decides which pixels use the result of the AMAZE algorithm and which pixels use the result of the VNG algorithm. Although each pixel in each algorithm uses the values of its neighbours, the final value that the program uses is either 100% result of the AMAZE algorithm or 100% the result of the VNG algorithm even if all its neighbours happen to use the other algorithm. This is partly as a result of your comment that the values are not % blend values, but I would probably have thought that anyway. That being the case I would expect the DD mask to be just black and white with no shades of grey.

Obviously the same does not apply to CS and the CS mask because one would wish to very the amount of the capture sharpening and not just have it on or off.

It’s so easy. Being able to use 200 instead of 100 just means you are able to set a larger threshold.

Wrong assumption. The contrast threshold is just a value to calculate the mask to blend between a and b. a and b maybe Amaze and VNG4 or sharpened and unsharpened. This a not a binary mask, as you can see from the sigmoid reference I made. On top of this, the mask is gaussian blurred with a sigma of 2.0 before it is applied, to get smoother transitions. And all I mentioned is equal for DD and CS

The values the visualization of the mask shows (the shades of gray) are % blend values. The contrast threshold is not

The blended result may be subtle. Try enhancing the contrast of or normalizing the layer. Another reason might be that the differences are rounded off or clipped when saving. In that case, the images would be the same or less different.

Oh, I see…it’s like that is it…matey :rofl: :rofl: :rofl: :rofl: :rofl:



Same shot - AMaZE and VNG4, difference blend mode - exaggerated with a huge levels adjustment so it’s easily visible (note no clip mask)…

AMaZE is a lot less kind to areas of noise, low contrast and low frequency detail.
VNG 4 tends to be much kinder to the above areas but produces way more zipper and maze demoz artifacts.

So the two variants are hugely different, and it’s why I tend to favour RCD+VNG4 for demosaicing virtually all my 12,16 and 20Mp D3, D4 and 1DXMk2 high speed action wildlife - because they are normally shot in manual with auto ISO - see videos on my YT channel.

I only tend to use AMaZE on its own when the shot is tack sharp and in focus corner to corner - ie 100% high frequency detail.

Also note that CS doesn’t always play well with AMaZE.

1 Like

I shall try that. I do check in with your you tube channel, I considered myself fairly knowledgeable before but have learnt a lot.

[Later] Lovely jubbly. Just what was called for. Now I can look t things a bit better.

2 Likes

No probs Richard, glad it helped :+1: :+1:

1 Like

Yes but looking at
“Let’s assume the contrast threshold adjuster is set to 20. This value will be divided by 100 => 0.2
result = blendfactor * sharpened + (1 - blendfactor) * unsharpened
where blendfactor is derived from the sigmoid curve, I can see that if the slider is set at 20 on a 100 point scale then the blendfactor is 0·50. However I cannot see why that means having the slider set at 20 on a 200 point scale the blendfactor is also 0·50 surely instead of being 20÷100 we would have 20÷200 or 0·10 which gives a blendfactor of 0·0003. To me that implies a greater granularity (or sensitivity or finer control) when using a 200 point slider, not a wider range. If not, and we just divide by 100, what happens when the CS slider is set to 125 and we get 125÷100 or 1·25. That either just truncates to 1·0 or else is off the curve and gives no result at all. See below for my comments on your suggestion of extending the DD slider to 200.

[This paragraph might go better in the previous section, I am not sure] I then have a problem with the further calculation of generating the mask. I can see how the slider might just set a blend value for the entire picture, but not for how it is used to generate a greyscale mask.

As I understand things for any set slider value, pixels with a big difference from their neighbours will tend towards white (in the mask) while pixels with a small difference from their neighbours will tend towards black (in the mask), with the slider controlling how dark or light the pixel is. I don’t know what units the difference is measured in but let’s say that a difference of 1 is a very small difference (will always be black) and 100 is a very large difference (will be always be white). With the slider set at 10 a difference of 15 will be a dark grey and a difference of 85 will be a light grey. If I take the slider up to 70 a difference of 15 will become a mid grey and a difference of 85 will be a very very light grey. I guess what I am asking is whether the slider controls the shape of the sigmoid curve (possibly by moving the bottom of it up) or whether it is some modification of the blendvalue some other way.

I can see how the blending works for CS, but I am struggling a bit to see how it applies to DD. You have previously said that although 0 means all AMAZE and no VNG, 100 does not mean no AMAZE and all VNG. You said there will always be some AMAZE even though it might just be a small amount. In that context I could understand the CS slider going for a wider range since one might want to exclude from sharpening some parts of whatever areas are still demosaiced using AMAZE. In that context it would make sense for the CS slider to go from 0 to a higher figure than the DD slider does, but only if the increase figure gives a greater range. If all the higher figure does is give finer control then we are back to the question of scaling down.

I am sorry if I am not expressing myself well, I suppose if I understood better I could express myself better, but then If I understood better I wouldn’t have the question in the first place.

A sigmoid function converges to zero for small values and to 1 for large values, but will never really reach zero or 1. Let me make a different example: Will 1 / x ever reach zero? No, but it converges to it for increasing x.

Edit: for a contrast threshold value of zero there is a special case which just uses the left demosaicer (Amaze, RCD, DCB) for DD or just uses CS for the whole image to reduce processing time.