Changeset 1115 for trunk/src/phys_XYZ.m


Ignore:
Timestamp:
Apr 6, 2022, 8:36:16 PM (2 years ago)
Author:
sommeria
Message:

geometry calib generalised to order_4 and proj_field debugged

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/phys_XYZ.m

    r1113 r1115  
    7474    Calib.Cx_Cy=[0 0];
    7575end
    76 if ~isfield(Calib,'kc')
    77     Calib.kc=0;
     76kc=[0 0];
     77if isfield(Calib,'kc')
     78    kc(1:numel(Calib.kc))=Calib.kc;
    7879end
     80% if ~isfield(Calib,'kc2')
     81%     Calib.kc2=0;
     82% end
    7983if isfield(Calib,'R')
    8084    R=(Calib.R)';
    81 %     R(3)=-R(3);
    82 %     R(6)=-R(6);
    83 %     R(9)=-R(9);
    8485    c=Z0virt;
    8586    cvirt=Z0virt;
     
    126127    Xd=(X-Calib.Cx_Cy(1))/Calib.fx_fy(1); % sensor coordinates
    127128    Yd=(Y-Calib.Cx_Cy(2))/Calib.fx_fy(2);
    128     dist_fact=1+Calib.kc*(Xd.*Xd+Yd.*Yd);% distortion factor, first approximation Xu,Yu=Xd,Yd
     129    dist_fact=1+kc(1)*(Xd.*Xd+Yd.*Yd);% distortion factor, first approximation Xu,Yu=Xd,Yd
    129130    test=0;
    130131    niter=0;
     
    133134        Xu=Xd./dist_fact;%undistorted sensor coordinates, second iteration
    134135        Yu=Yd./dist_fact;
    135         dist_fact=1+Calib.kc*(Xu.*Xu+Yu.*Yu);% distortion factor,next approximation
     136        R2=Xu.*Xu+Yu.*Yu;
     137        dist_fact=1+kc(1)*R2+kc(2)*R2.*R2;% distortion factor,next approximation
    136138        test=max(max(abs(dist_fact-dist_fact_old)))<0.00001; % reducing the relative error to 10^-5 forthe inversion of the quadraticcorrection
    137139        niter=niter+1;
Note: See TracChangeset for help on using the changeset viewer.