DISTORTION demonstrates barrel and pincushion distortion
by Chuck DiMarzio Northeastern University 2011
!! This file may be copied, used, or modified for educational and !! research purposes provided that this header information is not !! removed or altered, and provided that the book is cited in !! publications, as DiMarzio, Charles A., Optics for Engineers, !! CRC Press, Boca Raton, FL, 2011. !! http://www.crcpress.com !! Other distribution is prohibited without permission.
Delta = c_4 x^3 rho cos(phi) Delta = factor * rho cos(phi) represents tilt factor is cubic in x
Set up a grid of lines
[x,y]=meshgrid((-1:0.2:1),(-1:0.002:1)); fig1=figure;plot(x,y,'k-',y,x,'k-');axis equal;axis off; r=x+1i*y; % Use complex numbers to represent x,y positions % Barrel distortion rb=r-0.1*r.*abs(r).^2; % Unaberrated position is r, aberration proportional % to r^3. -10% at r=1; xb=real(rb);yb=imag(rb); fig2=figure;plot(xb,yb,'k-',yb,xb,'k-');axis equal;axis off; % Pincushion distortion rp=r+0.1*r.*abs(r).^2; % Unaberrated position is r, aberration proportional % to r^3. 10% at r=1; xp=real(rp);yp=imag(rp); fig3=figure;plot(xp,yp,'k-',yp,xp,'k-');axis equal;axis off;
