[magick-users] RE: Barrel / pincushion distortion

Fred Weinhaus fmw at alink.net
Sun Mar 2 19:16:24 PST 2008


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

Unfotunately, 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 otherwords, 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


P.S. Anthony, this is implemented as an inverse transformation and I 
should be able to generate the equations for the derivatives as well. 
I will communicate with you later on this.


More information about the Magick-users mailing list