Distortion when using the Perspective tool

I have an image, taken with a wide-angle lens, that contains a very high light pole.
I was not far from the pole so I had to point the camera upwards: the result is an image with very strong perspective deformation (vertical lines were converging).

This time I tried to correct it with the Perspective tool in RawTherapee and the light pole became vertical, but it was not straight any more: it was clearly curved.

At first I blamed the lensfun correction parameters (it has already happened to me) and I calibrated the lens distortion by myself, but I still got the bent pole.

After some thought I just tried saving the uncorrected image from RawTherapee and correcting the perspective with Panorama Tools: the resulting pole is not bented.

Here are the images of the pole:

The RawTherapee one:

The Panorama Tools one:

It looks like RT adds some distortion to straight lines when correcting vertical perspective.

The camera is a Panasonic GX7 and the lens is the Panasonic 14mm f/2.5 II.
It is a lens with a very large distortion that is corrected in software, as often happens with micro 4/3 lenses.

RT corrects this distortion “under the hood” before showing the image. Then the perspective correction needed to make the pole vertical is very strong (24.6) so the image is cropped heavily. Could it be that RT is applying the lensfun correction to the cropped image instead of the original one? Cropping moves the center of the image rectangle away from the center of the original frame, so applying the lensfun correction to that rectangle could cause such a distortion.

You can download the original raw file from here:

http://www.fsoft.it/temp/P1240630.RW2

Thanks in advance.

Fulvio Senore

Here’s a screenshot using neutral profile. Clearly all poles are bended

Now with lensfun distortion correction. Left pole is bended in the other direction

I disagree: without and with distortion correction the left pole is bended (though in different directions). Perspective correction in RT is not able (and not designed) to correct this.

In the screenshot without lensfun correction the pole is very bended. This is expected since the lens has a large distortion.
The screenshot with lensfun correction is slightly bended because the correction is not optimal. I have calibrated the lens by myself and I get a better result: the pole is only very slightly bended.
If you are interested you can download the corrected lensfun file from here:

http://www.fsoft.it/temp/mil-panasonic.xml

Anyway, the problem is another. I enable the lensfun correction and I get an almost straight pole, but not vertical.
Then I click the Transform tab and I use the Perspective tool, moving the vertical slider until the pole is vertical.
At this point the pole is again bended an in my screenshot.
If I do not correct the vertical perspective, I save the file and I correct the perspective with another program I get a vertical pole that is not bended, as in the other screenshot. This is the expected behaviour for a perspective correction tool, I think.

Would you mind to create an issue on github Issues · Beep6581/RawTherapee · GitHub ?

I have created the issue.