Ignore:
Timestamp:
Jan 19, 2015, 9:29:28 PM (9 years ago)
Author:
sommeria
Message:

various

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series/stereo_civ.m

    r846 r851  
    595595        Data.Civ2_FF(ind_good)=FFres;
    596596        Data.CivStage=Data.CivStage+1;
     597       
     598       
     599% %         
     600% %          % get z from u and v (displacements)
     601% %       
     602%         Data.Xphys=Rangx(1)+(Rangx(2)-Rangx(1))*(Data.Civ2_X-0.5)/(Npx-1);
     603%         Data.Yphys=Rangy(1)+(Rangy(2)-Rangy(1))*(Data.Civ2_Y-0.5)/(Npy-1);
     604%         U=Data.Civ2_U_smooth*(Rangx(2)-Rangx(1))/(Npx-1);
     605%         V=Data.Civ2_V_smooth*(Rangy(2)-Rangy(1))/(Npy-1);
     606%         [Data.Zphys,Data.Civ1_E]=shift2z(Data.Xphys,Data.Yphys,U,V,XmlData);
     607% %         if ~isempty(errormsg)
     608% %             disp_uvmat('ERROR',errormsg,checkrun)
     609% %             return
     610% %         end
     611       
    597612    end
    598613   
     
    821836                utable(ivec)=vector(1)*mesh+shiftx(ivec);
    822837                vtable(ivec)=vector(2)*mesh+shifty(ivec);
    823                 xtable(ivec)=iref+utable(ivec)/2-0.5;% convec flow (velocity taken at the point middle from imgae 1 and 2)
    824                 ytable(ivec)=jref+vtable(ivec)/2-0.5;% and position of pixel 1=0.5 (convention for image coordinates=0 at the edge)
     838%                 xtable(ivec)=iref+utable(ivec)/2-0.5;% convec flow (velocity taken at the point middle from imgae 1 and 2)
     839%                 ytable(ivec)=jref+vtable(ivec)/2-0.5;% and position of pixel 1=0.5 (convention for image coordinates=0 at the edge)
    825840                iref=round(xtable(ivec));% image index for the middle of the vector
    826841                jref=round(ytable(ivec));
     
    10341049error=0;
    10351050
     1051
    10361052%% first image
    10371053Calib_A=XmlData{1}.GeometryCalib;
    10381054R=(Calib_A.R)';
    1039 x_a=xmid- u/2;
    1040 y_a=ymid- v/2;
    1041 z_a=R(7)*x_a+R(8)*y_a+R(9)*Calib_A.SliceCoord(1,3);
    1042 X=(R(1)*x_a+R(2)*y_a+R(3)*Calib_A.SliceCoord(1,3))./z_a;
    1043 Y=(R(4)*x_a+R(5)*y_a+R(6)*Calib_A.SliceCoord(1,3))./z_a;
    1044 A_1_1=R(1)-R(7)*x_a;
    1045 A_1_2=R(2)-R(8)*x_a;
    1046 A_1_3=R(3)-R(9)*x_a;
    1047 A_2_1=R(4)-R(7)*y_a;
    1048 A_2_2=R(5)-R(8)*y_a;
    1049 A_2_3=R(6)-R(9)*y_a;
     1055x_a=xmid-u/2;
     1056y_a=ymid-v/2;
     1057z_a=R(7)*x_a+R(8)*y_a+Calib_A.Tx_Ty_Tz(1,3);
     1058Xa=(R(1)*x_a+R(2)*y_a+Calib_A.Tx_Ty_Tz(1,1))./z_a;
     1059Ya=(R(4)*x_a+R(5)*y_a+Calib_A.Tx_Ty_Tz(1,2))./z_a;
     1060
     1061A_1_1=R(1)-R(7)*Xa;
     1062A_1_2=R(2)-R(8)*Xa;
     1063A_1_3=R(3)-R(9)*Xa;
     1064A_2_1=R(4)-R(7)*Ya;
     1065A_2_2=R(5)-R(8)*Ya;
     1066A_2_3=R(6)-R(9)*Ya;
    10501067Det=A_1_1.*A_2_2-A_1_2.*A_2_1;
    10511068Dxa=(A_1_2.*A_2_3-A_2_2.*A_1_3)./Det;
     
    10531070
    10541071%% second image
    1055 Calib_A=XmlData{1}.GeometryCalib;
    1056 R=(Calib_A.R)';
    1057 x_a=xmid+ u/2;
    1058 y_a=ymid+ v/2;
    1059 z_a=R(7)*x_a+R(8)*y_a+R(9)*Calib_A.SliceCoord(1,3);
    1060 X=(R(1)*x_a+R(2)*y_a+R(3)*Calib_A.SliceCoord(1,3))./z_a;
    1061 Y=(R(4)*x_a+R(5)*y_a+R(6)*Calib_A.SliceCoord(1,3))./z_a;
    1062 A_1_1=R(1)-R(7)*x_a;
    1063 A_1_2=R(2)-R(8)*x_a;
    1064 A_1_3=R(3)-R(9)*x_a;
    1065 A_2_1=R(4)-R(7)*y_a;
    1066 A_2_2=R(5)-R(8)*y_a;
    1067 A_2_3=R(6)-R(9)*y_a;
    1068 Det=A_1_1.*A_2_2-A_1_2.*A_2_1;
    1069 Dxb=(A_1_2.*A_2_3-A_2_2.*A_1_3)./Det;
    1070 Dyb=(A_2_1.*A_1_3-A_1_1.*A_2_3)./Det;
     1072Calib_B=XmlData{2}.GeometryCalib;
     1073R=(Calib_B.R)';
     1074x_b=xmid+ u/2;
     1075y_b=ymid+ v/2;
     1076z_b=R(7)*x_b+R(8)*y_b+Calib_B.Tx_Ty_Tz(1,3);
     1077Xb=(R(1)*x_b+R(2)*y_b+Calib_B.Tx_Ty_Tz(1,1))./z_b;
     1078Yb=(R(4)*x_b+R(5)*y_b+Calib_B.Tx_Ty_Tz(1,2))./z_b;
     1079B_1_1=R(1)-R(7)*Xb;
     1080B_1_2=R(2)-R(8)*Xb;
     1081B_1_3=R(3)-R(9)*Xb;
     1082B_2_1=R(4)-R(7)*Yb;
     1083B_2_2=R(5)-R(8)*Yb;
     1084B_2_3=R(6)-R(9)*Yb;
     1085Det=B_1_1.*B_2_2-B_1_2.*B_2_1;
     1086Dxb=(B_1_2.*B_2_3-B_2_2.*B_1_3)./Det;
     1087Dyb=(B_2_1.*B_1_3-B_1_1.*B_2_3)./Det;
    10711088
    10721089%% result
     
    10741091error=((Dyb-Dya).*u-(Dxb-Dxa).*v)./Den;
    10751092z=((Dxb-Dxa).*u-(Dyb-Dya).*v)./Den;
     1093
Note: See TracChangeset for help on using the changeset viewer.