Rev | Line | |
---|
[37] | 1 | function p=imcorr(sys,par,dp) |
---|
| 2 | %IMCORR corrects image coordinates, which are contaminated by radial |
---|
| 3 | %and tangential distortion. |
---|
| 4 | % |
---|
| 5 | %Usage: |
---|
| 6 | % p=imcorr(name,par2,dp) |
---|
| 7 | % |
---|
| 8 | %where |
---|
| 9 | % name = string that is specific to the camera and the framegrabber. |
---|
| 10 | % This string must be defined in configc.m |
---|
| 11 | % par2 = camera intrinsic parameters for correcting the coordinates. |
---|
| 12 | % these parameters are computed by using invmodel.m. |
---|
| 13 | % dp = distorted image coordinates in pixels (n x 2 matrix) |
---|
| 14 | % p = corrected image coordinates |
---|
| 15 | |
---|
| 16 | % Version 3.0 10-17-00 |
---|
| 17 | % Janne Heikkila, University of Oulu, Finland |
---|
| 18 | |
---|
| 19 | NDX=sys(1); NDY=sys(2); Sx=sys(3); Sy=sys(4); |
---|
| 20 | Asp=par(1); Foc=par(2); |
---|
| 21 | Cpx=par(3); Cpy=par(4); |
---|
| 22 | Rad1=par(5); Rad2=par(6); |
---|
| 23 | Tan1=par(7); Tan2=par(8); |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | dx=(dp(:,1)-Cpx)*Sx/NDX/Asp; |
---|
| 27 | dy=(dp(:,2)-Cpy)*Sy/NDY; |
---|
| 28 | |
---|
| 29 | r2=dx.*dx+dy.*dy; |
---|
| 30 | delta=Rad1*r2+Rad2*r2.*r2; |
---|
| 31 | |
---|
| 32 | cx=dx.*(1+delta)+2*Tan1*dx.*dy+Tan2*(r2+2*dx.*dx); |
---|
| 33 | cy=dy.*(1+delta)+Tan1*(r2+2*dy.*dy)+2*Tan2*dx.*dy; |
---|
| 34 | |
---|
| 35 | p=NDX*Asp*cx/Sx+Cpx; |
---|
| 36 | p(:,2)=NDY*cy/Sy+Cpy; |
---|
Note: See
TracBrowser
for help on using the repository browser.