Lensfun distortion hard math

Hi all, I am interested in knowing what the inverse for the lensfun distortion models is. That is, the equation that describes r_u as a function of r_d. The models are listed here:

https://lensfun.github.io/manual/v0.3.2/group__Lens.html#gaa505e04666a189274ba66316697e308e

I would also like to know the definition for “corrected radius”. I would assume it is a function of the physical radius on sensor and the focal length. If you do not want to spoon feed me, please recommend a book or something…

I am not trained in programming or optics, but I have several vintage unsupported lens I would like to calibrate myself. Hugin didn’t give me very consistent or logical results as it seems to correct one line but not all. I am currently working on a python script to optimize all 3 models based on straight lines given and it will return the best model. This is in theory of course, and I expect to troubleshoot several problems before it is ready. It will be designed to use simple edge masks that are prepared by the user and anyone with basic photoshop knowledge can use it.

For example, this is the test edge I am using now:


The user will provide multiple and I will probably add some sort of weighting function later on to prioritize lines that are longer and clearer.

I wonder why you don’t create Lensfun calibration data, see https://pixls.us/articles/create-lens-calibration-data-for-lensfun/

I mentioned that Hugin didn’t give me consistent results. At any rate, I think it would be interesting to see how the other lensfun models perform.

How did you let it calculate the numbers with hugin?

I followed the video at https://vimeo.com/51999287

Minor update, I have achieved a more acceptable result using the (free!) Adobe Lens Profile Creator. I would still be interested in developing the script further if someone has the distortion models. I was reading through Close-Range Camera Calibration by Duane C. Brown and I don’t quite get it yet.

@bronger Could you help?

You won’t get anything easy from inverting the functions… unless you’re unphased by roots of cubic, quartic and quintic functions.

Ah, I think it can be inverted numerically