Hello Wolfgang, I looked at your spreadsheet, but can't make much from it.
A couple of points that may or may not be important. My script had no A0 term, but did have an A5*R^5, but had coefficients named in the reverse order (a, b, c, d, e) as the R terms got larger. Also Dersch did not include an A0 (constant) term in his presentation at http://www.all-in-one.ee/~dersch/barrel/barrel.html (you could just say A0=0) IM -distort barrel was implemented by Anthony to emulate his formula and the coefficients in his order (a,b,c,d) as the R terms get smaller. Anthony's comment about some tool that uses a diagonal line was something I saw also, but can't seem to locate now. Here are some other references that I had found. ttp://www.fieldrobotics.org/~cgeyer/OMNIVIS05/final/Li.pdf http://www.imatest.com/docs/distortion.html Fred >Hello, > >it has been some time since this issue has been discussed over here. >This morning, I started with a proof of concept, comparably to that I >did with the perspective distortion (or rectification). This rest of >this e-mail is quite technical and probably only relevant to developers, >especially Fred Weinhaus and Anthony Thyssen: > >Just to recall the issue: The common barrel distortion of consumer >cameras at short focal lengths can be described as a modification of the >radius to the centre, which in turn follos a polynom of fourth order. >This is the way Harry Deutsch and Panorama tools (and all its >offsprings, like PTlens) describe barrel distortion, i.e.: > >r' = a_4 * r^4 + a_3 * r^3 + a_2 * r^2 + a_1 * r + a_0 > >Obviously, a_0, a_2, a_3 and a_4 must be close to zero and a_1 must be >close to 1. > >It would be easy to incorporate such a distortion in IM. This would >however not make much sense without having the correction parameters for >a certain make and models of consumer cameras at hand. (These are kept >secret by newer versions of PTlens.) > >I have just pointed out a general approach to the problem, using Excel's >solver and one of the images provided Fred Weinhaus' Website. The files >can be downloaded at www.unfallrekonstruktion.de/ImageMagick/pinbarrel.zip. > >The general approach is the same as in PTlens: We possess a photograph >of an object with some lines that we know to be straight. The user then >supplies several points on some of these lines, e.g. > >p11, ... , p15 on line 1 >p21, ... , p27 on line 2 >.... >pn1,....., pnm on line n > >and asks some software to calculate the distortion parameters from this. > >This results in a non-linear optimisation problem, involving the 5 >parameters for the polynominal coefficients and 1 slope parameter for >each line provided. > >The lines chosen for the calibration will eitehr be nearly horizontal >or nearly vertical (see http://www.epaperpress.com/ptlens and then chose >calibration > targets). This means that the slopes of the lines >will be either near zero or have rather high values. Turning the >picture by 45° will yield slopes near +1 or -1 and thus work around this >problem. > >Another problem is that residuals have to be scaled by the inverse of >the calculated radii, otherwise the optimisation routine would "chose" >the polynominal coefficient such that the calculated radii r' all turn >out very small, thereby producing a (virtually) small residual. > >I more or less solved these problems in the mentioned Excel sheet that I >invite others to have a look at. (If so, I am ready for further >explanations.) > >Possibly, this will, in the end, turn out as a suitable barrel >correction tool for IM. > >Greetings from Germany >Wolfgang > >@ Anthony: I know that I still owe you the rectification examples I >promised... _______________________________________________ Magick-users mailing list [email protected] http://studio.imagemagick.org/mailman/listinfo/magick-users
