Ignore:
Timestamp:
Jan 21, 2015, 7:02:04 PM (9 years ago)
Author:
sommeria
Message:

bugrepair

File:
1 edited

Legend:

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

    r851 r854  
    327327       
    328328        % set the list of variables
    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'};
     329        Data.ListVarName={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_F','Civ1_C'};%  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'};
    331331        Data.VarAttribute{1}.Role='coord_x';
    332332        Data.VarAttribute{2}.Role='coord_y';
     
    345345        Data.Civ1_C=reshape(ctable,[],1);
    346346        Data.Civ1_F=reshape(F,[],1);
    347         Data.Xphys=Rangx(1)+(Rangx(2)-Rangx(1))*(Data.Civ1_X-0.5)/(Npx-1);
    348         Data.Yphys=Rangy(1)+(Rangy(2)-Rangy(1))*(Data.Civ1_Y-0.5)/(Npy-1);
    349         U=Data.Civ1_U*(Rangx(2)-Rangx(1))/(Npx-1);
    350         V=Data.Civ1_V*(Rangy(2)-Rangy(1))/(Npy-1);
    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
     347%         Data.Xphys=Rangx(1)+(Rangx(2)-Rangx(1))*(Data.Civ1_X-0.5)/(Npx-1);
     348%         Data.Yphys=Rangy(1)+(Rangy(2)-Rangy(1))*(Data.Civ1_Y-0.5)/(Npy-1);
     349%         
     350%         U=Data.Civ1_U*(Rangx(2)-Rangx(1))/(Npx-1);
     351%         V=Data.Civ1_V*(Rangy(2)-Rangy(1))/(Npy-1);
     352%         [Data.Zphys,Data.Civ1_E]=shift2z(Data.Xphys,Data.Yphys,U,V,XmlData);
     353%         if ~isempty(errormsg)
     354%             disp_uvmat('ERROR',errormsg,checkrun)
     355%             return
     356%         end
    356357    end
    357358   
     
    444445            j2=j2_series_Civ2(ifield);
    445446        end
    446         par_civ2.ImageWidth=FileInfo_A.Width;
    447         par_civ2.ImageHeight=FileInfo_A.Height;
    448        
     447        par_civ2.ImageWidth=size(par_civ2.ImageA,2);%FileInfo_A.Width;
     448        par_civ2.ImageHeight=size(par_civ2.ImageA,1);%FileInfo_A.Height;
    449449        if isfield(par_civ2,'Grid')% grid points set as input file
    450450            if ischar(par_civ2.Grid)%read the grid file if the input is a file name
     
    522522       
    523523        nbvar=numel(Data.ListVarName);
    524         Data.ListVarName=[Data.ListVarName {'Civ2_X','Civ2_Y','Civ2_U','Civ2_V','Civ2_F','Civ2_C'}];%  cell array containing the names of the fields to record
    525         Data.VarDimName=[Data.VarDimName {'nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2'}];
     524        Data.ListVarName=[Data.ListVarName {'Civ2_X','Civ2_Y','Civ2_U','Civ2_V','Civ2_F','Civ2_C','Xphys','Yphys','Zphys','Civ2_E'}];%  cell array containing the names of the fields to record
     525        Data.VarDimName=[Data.VarDimName {'nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2'}];
    526526        Data.VarAttribute{nbvar+1}.Role='coord_x';
    527527        Data.VarAttribute{nbvar+2}.Role='coord_y';
     
    596596        Data.CivStage=Data.CivStage+1;
    597597       
    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
     598           
     599         % get z from u and v (displacements)
     600       
     601        Data.Xphys=Rangx(1)+(Rangx(2)-Rangx(1))*(Data.Civ2_X-0.5)/(Npx-1);
     602        Data.Yphys=Rangy(1)+(Rangy(2)-Rangy(1))*(Data.Civ2_Y-0.5)/(Npy-1);
     603        U=Data.Civ2_U_smooth*(Rangx(2)-Rangx(1))/(Npx-1);
     604        V=Data.Civ2_V_smooth*(Rangy(2)-Rangy(1))/(Npy-1);
     605        [Data.Zphys,Data.Civ2_E]=shift2z(Data.Xphys,Data.Yphys,U,V,XmlData);
     606        if ~isempty(errormsg)
     607            disp_uvmat('ERROR',errormsg,checkrun)
     608            return
     609        end
    611610       
    612611    end
     
    820819            image2_crop=interp2(image2_crop,xi,yi);
    821820        end
    822         sum_square=sum(sum(image1_crop.*image1_crop));
     821        sum_square=(sum(sum(image1_crop.*image1_crop))+sum(sum(image2_crop.*image2_crop)))/2;
    823822        %reference: Oliver Pust, PIV: Direct Cross-Correlation
    824823        result_conv= conv2(image2_crop,flipdim(flipdim(image1_crop,2),1),'valid');
     
    834833                    [vector,F(ivec)] = SUBPIX2DGAUSS (result_conv,x,y);
    835834                end
    836                 utable(ivec)=vector(1)*mesh+shiftx(ivec);
     835
     836%                 if isfield(par_civ,'CheckDeformation')
     837%                  utable(ivec)=shiftx(ivec);
     838%                  vtable(ivec)=shifty(ivec);
     839%                 else
     840                 utable(ivec)=vector(1)*mesh+shiftx(ivec);
    837841                vtable(ivec)=vector(2)*mesh+shifty(ivec);
     842%                 end
    838843%                 xtable(ivec)=iref+utable(ivec)/2-0.5;% convec flow (velocity taken at the point middle from imgae 1 and 2)
    839844%                 ytable(ivec)=jref+vtable(ivec)/2-0.5;% and position of pixel 1=0.5 (convention for image coordinates=0 at the edge)
     
    10531058Calib_A=XmlData{1}.GeometryCalib;
    10541059R=(Calib_A.R)';
    1055 x_a=xmid-u/2;
    1056 y_a=ymid-v/2;
     1060x_a=xmid;
     1061y_a=ymid;
    10571062z_a=R(7)*x_a+R(8)*y_a+Calib_A.Tx_Ty_Tz(1,3);
    10581063Xa=(R(1)*x_a+R(2)*y_a+Calib_A.Tx_Ty_Tz(1,1))./z_a;
     
    10721077Calib_B=XmlData{2}.GeometryCalib;
    10731078R=(Calib_B.R)';
    1074 x_b=xmid+ u/2;
    1075 y_b=ymid+ v/2;
     1079x_b=xmid+ u;
     1080y_b=ymid+ v;
    10761081z_b=R(7)*x_b+R(8)*y_b+Calib_B.Tx_Ty_Tz(1,3);
    10771082Xb=(R(1)*x_b+R(2)*y_b+Calib_B.Tx_Ty_Tz(1,1))./z_b;
Note: See TracChangeset for help on using the changeset viewer.