Lensfun and distortion depending on focus distance

I noticed that the Sigma 30mm f/1.4 DC DN lens has distortion that is varying with the distance of the subject (more likely, the distance the lens is focused at).
See for example https://www.sigmaphoto.com/article/notice-to-30mm-dc-dn-micro-fourthirds-users/ - distortion varies from 0% (minimum distance) to 2.8% (infinity).
Would it make sense to have support for distortion vs focus distance in lensfun? Or does that already exist?
(There is support for focus distance in combination with vignetting, so the API might not even need an update.)

Vignetting correction for the really dilligent people can be done. You have to create pictures at different focus distances. However the benefit is really small.

I’ve rewritten the lens calibration script from scratch and nearly fully documented the process. I’ve added support for vignetting with different distances last weekend. However I only created pictures for my 85mm prime lens.

As the lensfun people do not react, I think about submitting the article here on pixls.us.


I see lens profiles with different vignetting parameters per aperture and focus distance (not zoom, but how far the subject was).
But with distortion this does not (yet) seem possible. And given the parameters of the Sigma 30mm f/1.4 mirrorless lens, it seems a useful capability.

Does your camera store the focus distance in the exif data?

I second this request, although I have not gotten around to needing exacting distortion corrections and creating lens profiles yet, I see this need to have this ability in the future.

Nonetheless, I think it would be important to have user settable focus distance profiles for instances where there is no metadata. The differences in distortion can be extreme between different focus distances, but nonetheless, I think at most, only a few profiles would ever be needed. If there isn’t metadata, the precision of focus distance needed for distortion correction is low enough that the needed profile can can be eyeballed by the user. (Think one for infinity, one for portrait distance, and one for minimum focus distance would probably be all that is needed).

Having the distance user settable sounds like a change for the application (RawTherapee, Darktable, …) - and it could be demonstarted today because the vignetting is already distance sensitive.
About the lens profile - it is of course always better to have 2 measurements instead of one. But let’s say a lens only has data for minimum distance and infitity - what would be teh best way to interpolate as a default? Probably something to be tested in a beta on a variety of lenses.
I suppose I could do test shots on the SIgma 30mm 1.4 DC DN and a Sony RX100 mk1. I also suppose this feature is more worthwile for lenses that distort more than average (in other words, that have distortion designed-in to improve other parameters - as it can be well corrected in processing).

I guess you saw the lensun article?

I’ve just noticed that the profile used in Adobe Camera Raw has different distortion parameters for different distances.
However, I’ve edited a raw using efixtool to change the focal distance on an ARW, and no difference is seen when I enable correction.