RT Profiled Lens Correction vs. Distortion Correction

RT Profiled Lens Correction and Distortion Correction:

Could I get some guidance and clarification about the use of these two tools and their interaction please?

From what I can see, if an appropriate lens profile exists, both of these tools correct barrel/pin cushion correction with the consequence that if you use the automatic button in the Distortion Correction tool and you have a lens profile selected, you get twice the correction that you want. That is, the correction selected by the automatic button is independent of whether a lens profile is selected or not.

This strikes me as inappropriate behaviour. It seems as though the automatic correction is being applied prior to the profiled correction whereas the opposite order would be more appropriate. Or am I completely misunderstanding the operation of these two tools?

Isn’t the automatic distortion correction based on the embedded JPEG?

Peter is right.

http://rawpedia.rawtherapee.com/Lens/Geometry#Geometric_Distortion

I think it’s not intended to use both at the same time. The Geometric Distortion might be a compensation if no lens profile is available.

1 Like

Yes, I realize that the automatic correction is based on the jpeg. They are alternative ways to correct the distortion. But it seems that if you use both – which can be easy to do if you have various lens, some with profiles and some without, and various primes which some seem not to require any correction – then you end up over correcting. But if the comparison with the jpeg was made after the lens profile was applied, then you wouldn’t get the over correcting (assuming I’m right about the order that these modules are applied.)

There is a similar situation with respect to tone curves: whether you use the tone cure under color management settings or the auto matched tone curve under the exposure tab. But there the camera tone curve is applied first and the auto matched tone curve only gives a small correct to that (rather than do the whole job as it would if the camera tone curve wasn’t present.)

So the auto matched tone curve button seems to do it right, but I don’t think the auto distortion correction does.

As @apostel338 wrote, they are not supposed to be used at the same time. If a lens profile with distortion correction exists, that is the preferred way to completely fix distortion. No further adjustments should be needed (and it may be detrimental to attempt additional “corrections”). That’s probably why the automatic distortion correction button doesn’t account for the profiled correction. No one expected a valid use-case for it. I don’t use the automatic distortion correction, but if I did, I would only press the button if there wasn’t any other correction applied. What is your workflow like which makes sense to use both? I can see how it could be useful in the batch editor, but the automatic correction button is disabled there.

The distortion tool also gets applied before the profiled lens correction, so it wouldn’t make sense to account for the profiled correction unless the processing pipeline changes.

1 Like

Spot on.

Very useful for older, less common (e.g. ‘vintage’) lenses, I find (at least until I get around to making profiles for them). Other usecases may be ‘distortion for the sake of art’ or ‘I’ve got to get these photos published by tomorrow, but Lensfun has broken!’ :wink:

Better ‘have and not need’ than ‘need and not have’ I think. You don’t need to use what you don’t need to use (but, quite often, others WILL need to use what you don’t need to use :wink:).

Thank you for your detailed and authoritative response. It is consistent with what I have come to surmise. However, that is not how I initially interpreted the function of that tool. I assumed, quite reasonably I think, that the tool refined the distortion correction that may or may not have been applied already by the profiled lens correction. And that is the behaviour that would result if the automatic tool followed rather than proceeded the profiled correction. (In much the same way that the automated tone cure and the camera matched tone curve interact).

In my case I interpreted the changes that I was seeing when I applied the automatic correction as corrections that the profiled correction had failed to correct. Since my most common subject is landscapes without a lot of straight lines, there was little to disabuse me of this incorrect interpretation in the over corrected result .

I would be surprised if I were the only user that has had this misunderstanding. I accept that it is probably not high on the priority list to prevent users from shooting themselves in the foot but it does seem there are at least two seemingly straightforward ways that this could be corrected.

Firstly, if the order of these two tools in the tool chain could be reversed. I accept however there is unlikely to be much enthusiasm for tool chain changes and I cannot judge whether such a change might have other side effects.

The other suggestion would be – at the GUI level – to integrate the Distortion Correction into the Profiled Lens Correction (a change of titles would be required) and then have the automatic correction available as a “radio button” selection.

I think however the option to manually enter a distortion amount should probably be maintained (and this argues against a change in order of the tool chain). While I doubt that I would ever use that and I can’t think of a use case in general, perhaps it is like the rotation correction, that is, some photos look better with a small uncorrected tilt with respect to the true horizontal (often true for distant shorelines for example.)

If you think these comments have any merit, I can write it up as a github issue. As for me, now that I properly understand it, I will have no further issue going forward.

Just to be clear: I am not arguing for the elimination of anything; both tools have their uses. My issue is the interaction – or rather the lack of interaction – between these tools.

From what I read (IF I read correctly!) the point is they’re not really directly interoperative. Not actually mutually exclusive, but due to pipeline and other contexts it’s unlikely you’ll need to use both at the same time.

Again, if I understand correctly. :slight_smile:

Let’s consider the case where a lens profile is available. (If no profile is available then the point is moot because only the automatic distortion correction is operative.)

But if a profile is available then there are essentially two ways of removing the distortion. They both, to the extent that the lens profile correctly models the camera correction, “fix” the distortion. If you trigger both, then you are doubling the correction and you are now distorted in the other direction. I don’t think you’d ever want to deliberately do that but I have done that many times out of ignorance. But if the order of the tools in the pipeline were reversed, the automatic distortion correction would have only minimal, if any, effect to the extent that the lens profile was appropriate.

Changing the pipeline order is rarely done because care must be taken to ensure old edits still produce the same results. You also have to think about what happens if someone decides to re-edit. Do you “upgrade” to the new bahavior and risk confusing the user with the sudden change in behavior? Do you maintain the old behavior and somehow provide a way to opt-in to the new behavior? I think it should be enough to add a tool tip and possibly disable the button when profiled distortion is activated.

The automatic correction and profiled correction are designed to achieve similar yet distinct objectives. From a user’s perspective, they correct distortion. However, the profiled correction is designed to directly correct distortion while the automatic correction is designed to match the embedded preview. They have different ideas of what is correct. Even if the automatic correction accounts for the profile, it will “fight” the profiled correction by warping the image to what it considers to be correct. That’s why there isn’t a normal situation where it’s reasonable to use both on the same image. There’s another reason. Imagine it makes sense to use both. Why would this be? The automatic correction refines the profiled one and has a low probability of making the correction worse. If the automatic correction is that good, wouldn’t it be sufficient by itself?

The reality is that the automatic correction is so-so. It can only offer a high quality correction if the correction in the embedded image is good, there are enough features in the image to analyze the correction, and the distortion follows the simplistic model used by the distortion tool. If any of these are not true, chances are you will get worse results compared to profiled correction.

3 Likes

Thank you. I will leave it at that.