Ignore:
Timestamp:
Oct 14, 2010, 6:35:03 PM (14 years ago)
Author:
sommeria
Message:

geometric calibration procedures updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/imadoc2struct.m

    r109 r114  
    118118    cont=get(subt,1,'contents');
    119119    if ~isempty(cont)
    120         uid_pixcmx=find(subt,'/GeometryCalib/Pxcmx');
    121         uid_pixcmy=find(subt,'/GeometryCalib/Pxcmy');
    122         if ~isempty(uid_pixcmx) && ~isempty(uid_pixcmy)%NON UTILISE
    123            pixcmx=str2num(get(subt,children(subt,uid_pixcmx),'value'));
    124             if isempty(pixcmx),pixcmx=1;end; %default
    125             pixcmy=str2num(get(subt,children(subt,uid_pixcmy),'value'));
    126             if isempty(pixcmy),pixcmy=1;end; %default
    127             tsai.Pxcmx=pixcmx;
    128             tsai.Pxcmy=pixcmy;
    129         end
     120%         uid_pixcmx=find(subt,'/GeometryCalib/Pxcmx');
     121%         uid_pixcmy=find(subt,'/GeometryCalib/Pxcmy');
     122%         if ~isempty(uid_pixcmx) && ~isempty(uid_pixcmy)%NON UTILISE
     123%            pixcmx=str2num(get(subt,children(subt,uid_pixcmx),'value'));
     124%             if isempty(pixcmx),pixcmx=1;end; %default
     125%             pixcmy=str2num(get(subt,children(subt,uid_pixcmy),'value'));
     126%             if isempty(pixcmy),pixcmy=1;end; %default
     127%             tsai.Pxcmx=pixcmx;
     128%             tsai.Pxcmy=pixcmy;
     129%         end
    130130        %default values:
    131         tsai.f=1;
    132         tsai.dpx=1;
    133         tsai.dpy=1;
    134         tsai.sx=1;
    135         tsai.Cx=0;
    136         tsai.Cy=0;
    137         tsai.Tz=1;
    138         tsai.Tx=0;
    139         tsai.Ty=0;
    140         tsai.R=[1 0 0; 0 1 0; 0 0 0];
    141         tsai.kappa1=0;
     131        %tsai.dpx_dpy=1;
     132        %tsai.dpy=1;
     133        %tsai.sx=1;
     134%         tsai.Cx_Cy=[0 0];
     135       % tsai.Cy=0;
     136%         tsai.Tx_Ty_Tz=[0 0 1];
     137%         tsai.Tx=0;
     138%         tsai.Ty=0;
     139%         tsai.R=[1 0 0; 0 1 0; 0 0 0];
     140        uid_CalibrationType=find(subt,'/GeometryCalib/CalibrationType');
     141        if isequal(length(uid_CalibrationType),1)
     142            tsai.CalibrationType=get(subt,children(subt,uid_CalibrationType),'value');
     143        end
    142144        uid_CoordUnit=find(subt,'/GeometryCalib/CoordUnit');
    143         if ~isempty(uid_CoordUnit)
     145        if isequal(length(uid_CoordUnit),1)
    144146            tsai.CoordUnit=get(subt,children(subt,uid_CoordUnit),'value');
    145147        end
    146         uid_focal=find(subt,'/GeometryCalib/focal');
    147         uid_dpx_dpy=find(subt,'/GeometryCalib/dpx_dpy');
    148         uid_sx=find(subt,'/GeometryCalib/sx');
     148        uid_fx_fy=find(subt,'/GeometryCalib/fx_fy');
     149        focal=[];%default fro old convention (Reg Wilson)
     150        if isequal(length(uid_fx_fy),1)
     151            tsai.fx_fy=str2num(get(subt,children(subt,uid_fx_fy),'value'));
     152        else %old convention (Reg Wilson)
     153            uid_focal=find(subt,'/GeometryCalib/focal');
     154            uid_dpx_dpy=find(subt,'/GeometryCalib/dpx_dpy');
     155            uid_sx=find(subt,'/GeometryCalib/sx');
     156            if ~isempty(uid_focal) && ~isempty(uid_dpx_dpy) && ~isempty(uid_sx)
     157                dpx_dpy=str2num(get(subt,children(subt,uid_dpx_dpy),'value'));
     158                sx=str2num(get(subt,children(subt,uid_sx),'value'));
     159                focal=str2num(get(subt,children(subt,uid_focal),'value'));
     160                tsai.fx_fy(1)=sx*focal/dpx_dpy(1);
     161                tsai.fx_fy(2)=focal/dpx_dpy(2);
     162            end
     163        end
    149164        uid_Cx_Cy=find(subt,'/GeometryCalib/Cx_Cy');
    150         uid_kappa1=find(subt,'/GeometryCalib/kappa1');
     165        if ~isempty(uid_Cx_Cy)
     166            tsai.Cx_Cy=str2num(get(subt,children(subt,uid_Cx_Cy),'value'));
     167        end
     168        uid_kc=find(subt,'/GeometryCalib/kc');
     169        if ~isempty(uid_kc)
     170            tsai.kc=str2num(get(subt,children(subt,uid_kc),'value'));
     171        else %old convention (Reg Wilson)
     172            uid_kappa1=find(subt,'/GeometryCalib/kappa1');
     173            if ~isempty(uid_kappa1)&& ~isempty(focal)
     174                kappa1=str2num(get(subt,children(subt,uid_kappa1),'value'));
     175                tsai.kc=-kappa1*focal*focal;
     176            end
     177        end
    151178        uid_Tx_Ty_Tz=find(subt,'/GeometryCalib/Tx_Ty_Tz');
     179        if ~isempty(uid_Tx_Ty_Tz)
     180            tsai.Tx_Ty_Tz=str2num(get(subt,children(subt,uid_Tx_Ty_Tz),'value'));
     181        end
    152182        uid_R=find(subt,'/GeometryCalib/R');
    153         if ~isempty(uid_focal) && ~isempty(uid_dpx_dpy) && ~isempty(uid_Cx_Cy)
    154             tsai.f=str2num(get(subt,children(subt,uid_focal),'value'));
    155             dpx_dpy=str2num(get(subt,children(subt,uid_dpx_dpy),'value'));
    156             tsai.dpx=dpx_dpy(1);
    157             tsai.dpy=dpx_dpy(2);
    158             if ~isempty(uid_sx)
    159                tsai.sx=str2num(get(subt,children(subt,uid_sx),'value'));
    160             end
    161             Cx_Cy=str2num(get(subt,children(subt,uid_Cx_Cy),'value'));
    162             tsai.Cx=Cx_Cy(1);
    163             tsai.Cy=Cx_Cy(2);
    164         end
    165         if ~isempty(uid_Tx_Ty_Tz)
    166             Tx_Ty_T_char=get(subt,children(subt,uid_Tx_Ty_Tz),'value');
    167             Tx_Ty_Tz=str2num(Tx_Ty_T_char);
    168             tsai.Tx=Tx_Ty_Tz(1);
    169             tsai.Ty=Tx_Ty_Tz(2);
    170             tsai.Tz=Tx_Ty_Tz(3);
    171         end
    172183        if ~isempty(uid_R)
    173184            RR=get(subt,children(subt,uid_R),'value');
     
    176187            end
    177188        end
    178         if ~isempty(uid_kappa1)     
    179             tsai.kappa1=str2num(get(subt,children(subt,uid_kappa1),'value'));
    180         end
     189       
    181190        %look for laser plane definitions   
    182191        uid_Angle=find(subt,'/GeometryCalib/PlaneAngle');
     
    203212                    tsai.NbSlice=str2double(NbSlice);
    204213                end
    205                 tsai.SliceCoord=ones(NbSlice,1)*tsai.SliceCoord+DZ*[0:NbSlice-1]'*[0 0 1];
     214                tsai.SliceCoord=ones(NbSlice,1)*tsai.SliceCoord+DZ*(0:NbSlice-1)'*[0 0 1];
    206215            end         
    207216        end
Note: See TracChangeset for help on using the changeset viewer.