Hi all,

The big problem with lens calibration has always been instability of the radius correction polynomial under optimization.  I believe I have licked that -- by getting rid of the polynomial.

Instead,  the latest cut of lensFunc uses a 7-point spline curve to represent the relationship of the real to the ideal radius.  It is parameterized in such a way that it is guaranteed to be monotonic no matter what parameter values the optimizer chooses to assign, so unlike the polynomial it can't "go wild".  Also unlike the polynomial, adding more parameters improves the level of detail without increasing the chances of blowing up. 

With this change, for the very first time, I can see a consistent relationship between the quality of the fit and the appropriateness of the ideal model function.  Here are first results, for a set of 199 straight lines from a Nikon 10.5 fisheye; optimizing 7 radius spline points and nothing else, varying only the assumed ideal function...

model  fn    start error    end error   iterations    stop reason
rectilinear    3299           2709       1000         iteration limit
eq.angle      2159           306          436         parameter delta
eq.area       1989          3 e-15        176         error gradient
stereogr.     2455           ---              --          (model error)

Notice that all these statistics reflect the relative  appropriateness of the chosen model.   But final error is far the most sensitive criterion.

With polynomial radius corrections (2, 3 or 4 terms) I have never seen anything I could make sense of.  I believe that is because the polynomial can take on so many forms that it can mask the inappropriateness of the model function.  And create wildly different results under small changes in the data.  Also the smallest final errors for this data set with polynomial radius correction have never been less than about 0.02. 

So I think this new radius function is a winner, and I'm quite pumped about it!

To go with it, the current line finder can extract hundreds of good line segments from a "liney" image in just a little more time than it takes to run the Canny edge detector (roughly 7 sec for a typical DSLR snap).  So we are very close to being able to start some serious research using hundreds of photos.

Of course the world will want to see polynomial coefficients for these lenses.  It should be routine to fit a polynomial to the spline curve (just by sampling its values, I mean, nothing analytic).  Does anyone know of readymade code for that?

Regards, Tom