I have implemented a script, pinbarrel, to apply or correct
pincushion and/or barrel distortion. This script was implemented
according the formula given by Dersch on his page at
http://www.all-in-one.ee/~dersch/barrel/barrel.html
Unfortunately, this had to be implemented using -fx. Therefore it is
rather slow.
I have made some improvements to the algorithm such that one can
apply the distortion/correction in either x or y direction or both
and can apply pincushion in one direction and barrel in the other
direction.
I changed the order of the coefficients to reverse the assignment of
a,b,c,d from Dersch, so that the most important coefficients are
first, ie. a then b then c, then d. In other words, the ones that are
not likely to be zero are first.
The script and examples can be found on my IM script page at
http://www.fmwconcepts.com/imagemagick/index.html
Fred
NOTE-IMPORTANT: If this distortion correction is going to be used
with the same camera and same size images and the coefficients remain
the same, then it is best to re-implement this as a displacement map
so that the calculations need not be recomputed each time.
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users