Changeset 845 for trunk/src/series/stereo_civ.m
 Timestamp:
 Dec 17, 2014, 12:32:52 PM (6 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/series/stereo_civ.m
r844 r845 39 39 40 40 function [Data,errormsg,result_conv]= stereo_civ(Param) 41 Data=[]; 41 42 errormsg=''; 42 43 43 44 %% set the input elements needed on the GUI series when the action is selected in the menu ActionName or InputTable refreshed 44 45 if isstruct(Param) && isequal(Param.Action.RUN,0)% function activated from the GUI series but not RUN 46 if size(Param.InputTable,1)<2 47 msgbox_uvmat('WARNING','two input file series must be entered') 48 return 49 end 45 50 path_series=fileparts(which('series')); 46 51 addpath(fullfile(path_series,'series')) … … 285 290 end 286 291 [A,Rangx,Rangy]=phys_ima(A,XmlData,1); 287 288 292 [Npy,Npx]=size(A{1}); 289 293 PhysImageA=fullfile_uvmat(RootPath_A,Civ1Dir,RootFile_A,'.png','_1a',i1_series_Civ1(ifield),[],1); 290 294 PhysImageB=fullfile_uvmat(RootPath_A,Civ1Dir,RootFile_A,'.png','_1a',i1_series_Civ1(ifield),[],2); … … 323 327 324 328 % set the list of variables 325 Data.ListVarName={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_F','Civ1_C' };% cell array containing the names of the fields to record326 Data.VarDimName={'nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1' };329 Data.ListVarName={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_F','Civ1_C','Xphys','Yphys','Zphys','Civ1_E'};% cell array containing the names of the fields to record 330 Data.VarDimName={'nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1'}; 327 331 Data.VarAttribute{1}.Role='coord_x'; 328 332 Data.VarAttribute{2}.Role='coord_y'; … … 334 338 % calculate velocity data (y and v in indices, reverse to y component) 335 339 [xtable ytable utable vtable ctable F result_conv errormsg] = civ (par_civ1); 336 if ~isempty(errormsg)337 disp_uvmat('ERROR',errormsg,checkrun)338 return339 end340 340 Data.Civ1_X=reshape(xtable,[],1); 341 341 Data.Civ1_Y=reshape(par_civ1.ImageHeightytable+1,[],1); 342 342 % get z from u and v (displacements) 343 343 Data.Civ1_U=reshape(utable,[],1); 344 Data.Civ1_V=reshape(vtable,[],1); 345 344 Data.Civ1_V=reshape(vtable,[],1); 346 345 Data.Civ1_C=reshape(ctable,[],1); 347 346 Data.Civ1_F=reshape(F,[],1); 347 Data.Xphys=Rangx(1)+(Rangx(2)Rangx(1))*(Data.Civ1_X0.5)/(Npx1); 348 Data.Yphys=Rangy(1)+(Rangy(2)Rangy(1))*(Data.Civ1_Y0.5)/(Npy1); 349 U=Data.Civ1_U*(Rangx(2)Rangx(1))/(Npx1); 350 V=Data.Civ1_V*(Rangy(2)Rangy(1))/(Npy1); 351 [Data.Zphys,Data.Civ1_E]=shift2z(Data.Xphys,Data.Yphys,U,V,XmlData); 352 if ~isempty(errormsg) 353 disp_uvmat('ERROR',errormsg,checkrun) 354 return 355 end 348 356 end 349 357 … … 1016 1024 end 1017 1025 1018 1019 1020 1026 %INPUT: 1027 % xmid u/2: set of apparent phys x coordinates in the ref plane, image A 1028 % ymid v/2: set of apparent phys y coordinates in the ref plane, image A 1029 % xmid+ u/2: set of apparent phys x coordinates in the ref plane, image B 1030 % ymid+ v/2: set of apparent phys y coordinates in the ref plane, image B 1031 % XmlData: content of the xml files containing geometric calibration parameters 1032 function [z,error]=shift2z(xmid, ymid, u, v,XmlData) 1033 z=0; 1034 error=0; 1035 1036 %% first image 1037 Calib_A=XmlData{1}.GeometryCalib; 1038 R=(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; 1050 Det=A_1_1.*A_2_2A_1_2.*A_2_1; 1051 Dxa=(A_1_2.*A_2_3A_2_2.*A_1_3)./Det; 1052 Dya=(A_2_1.*A_1_3A_1_1.*A_2_3)./Det; 1053 1054 %% 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_2A_1_2.*A_2_1; 1069 Dxb=(A_1_2.*A_2_3A_2_2.*A_1_3)./Det; 1070 Dyb=(A_2_1.*A_1_3A_1_1.*A_2_3)./Det; 1071 1072 %% result 1073 Den=(DxbDxa).*(DxbDxa)+(DybDya).*(DybDya); 1074 error=((DybDya).*u(DxbDxa).*v)./Den; 1075 z=((DxbDxa).*u(DybDya).*v)./Den;
Note: See TracChangeset
for help on using the changeset viewer.