Healing vs Cloning Replacement

I don’t know if anybody else is seeing this … when I clone a replacement area there is a lightness shift occurring. When I heal a replacement the tone is just fine.
image
Working with current git on Arch

That’s by design. Healing matches tones, cloning doesn’t.

1 Like

I understand that ‘healing’ is (and should be) a far more complex approach … but, simple replacement ‘cloning’ was always considered as absolute replacement and to my knowledge it was previously that way in dt.

I don’t use it a ton but that is what I recall too at least I think so…

Here is a shot with two shapes just circles with zero feather… sampling from the same spot…

Heal is the top one…

Now with a 3% feather…

Maybe it a perception thing but I would not think in the shadow the clone would seem that light??

But I say perceptual because if you do it in the same in an area lit the same… it doesn’t seem to have the same outcome…

image

then with zero feather

image

Heal is on the left in these last two… so to be similar it seems you need some feathering radius…

1 Like

I think the problem is that clone should copy the area, but it does not do that exactly.
If you sample the top of the source area:

If you sample the top of the target:

Whereas if I take the demo image from the documentation, the colour is copied exactly:
https://docs.darktable.org/usermanual/4.2/en/module-reference/processing-modules/retouch/#clone-and-heal

2 Likes

Your demonstrated example in the OP is how I expect cloning (edited to say cloning) to work. I default to healing because of its more natural result in most cases. I rarely use clone as usually this is too obvious due to tonal variations between the source to destination. Of course each circumstance must be judged individually.

EDIT: previously I wrote how I expect healing to work, but that was a typo. Cloning gives harsh transitions were healing gives softer transitions.

It really looks strange. Note that also the part of the sensor spot which is cloned is hardly noticeable in the clone.

Just to make sure… did you set any blending, masking, wavelet decompose settings? Maybe there is another influence.

I think the OP shows cloning, not healing, and it demonstrates a lightness shift, which I confirmed in my response to be a real lightness shift, not just one caused by some optical illusion due to perhaps the target area having somewhat different surroundings (a relative brightness difference).

I think the answer to the question posted by @firefrorefiddle would be important. @davidvj, can you please post an image and a sidecar that demonstrate the problem?

I have attached a simple image with minimal processing. Purposely I have boosted the contrast so as to find areas of snow that would be useful for this test.
Test 1 … dark to light and Test 2 … light to dark
The problem is apparent.
20230306_0044.RAF (56.4 MB)
20230306_0044.RAF.xmp (16.2 KB)

I have disabled your contrast enhancements, and that revealed that there is nothing wrong with the clone tool. Your local contrast enhancements are not pixel-wise operations: they increase the contrast of an area compared to its surroundings. See here:

So, when (#1 and #2) you cloned a bright area to a dark part of the image, and increased local contrast, the bright area became even brighter (the local contrast between the surrounding area and the brighter clone increased).
The same is true when you cloned a darker area to the bright foreground: since it was darker than its surroundings, local contrast enhancement darkened it further.

An oversimplified explanation of local contrast: Suppose you place a spot with brightness 50% on a black (0%) background, and also put it on a white (100%) background. Increasing the local contrast by 10% will increase its brightness to 55% (so the difference will increase by 10%, from 50 to 55) on the black background, and to 45% (so the difference from white will grow by 10%, from 50% to 55%).

4 Likes

Thank you for pointing this out … now I notice that moving the retouch module after the contrast applications does appear to correct the situation.
Possibly retouch should normally be located late in the pipeline??

You can move it wherever you want. Normally, when we clone something, we want it to blend in, so we clone it into an area what looks similar to its original surroundings. Here, in this case, you were not doing that.
Please use heal for a more intelligent operation. clone really is a simple and dumb copying of pixel values.

Yep, that was a typo on my part. I meant to write cloning.