- Timestamp:
- Feb 24, 2016, 7:39:00 PM (9 years ago)
- Location:
- trunk/src/series
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/civ2vel_3C.m
r924 r927 34 34 35 35 %======================================================================= 36 % Copyright 2008-201 6, LEGI UMR 5519 / CNRS UGAG-INP, Grenoble, France36 % Copyright 2008-2015, LEGI UMR 5519 / CNRS UJF G-INP, Grenoble, France 37 37 % http://www.legi.grenoble-inp.fr 38 38 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr … … 52 52 53 53 function ParamOut=civ2vel_3C(Param) 54 54 disp('test') 55 55 %% set the input elements needed on the GUI series when the function is selected in the menu ActionName or InputTable refreshed 56 56 if isstruct(Param) && isequal(Param.Action.RUN,0) … … 68 68 ParamOut.OutputFileMode='NbInput';% '=NbInput': 1 output file per input file index, '=NbInput_i': 1 file per input file index i, '=NbSlice': 1 file per slice 69 69 %check the input files 70 ParamOut.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1) 70 71 first_j=[]; 71 72 if size(Param.InputTable,1)<2 … … 170 171 warning off 171 172 173 CheckOverwrite=1;%default 174 if isfield(Param,'CheckOverwrite') 175 CheckOverwrite=Param.CheckOverwrite; 176 end 172 177 for index=1:NbField 178 173 179 update_waitbar(WaitbarHandle,index/NbField) 180 181 182 183 184 %% generating the name of the merged field 185 i1=i1_series{1}(index); 186 if ~isempty(i2_series{end}) 187 i2=i2_series{end}(index); 188 else 189 i2=i1; 190 end 191 j1=1; 192 j2=1; 193 if ~isempty(j1_series{1}) 194 j1=j1_series{1}(index); 195 if ~isempty(j2_series{end}) 196 j2=j2_series{end}(index); 197 else 198 j2=j1; 199 end 200 end 201 OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},'.nc','_1-2',i1,i2,j1,j2); 202 203 %% 204 205 174 206 if ~isempty(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue') 175 207 disp('program stopped by user') … … 177 209 end 178 210 211 if (~CheckOverwrite && exist(OutputFile,'file')) 212 disp('existing output file already exists, skip to next field') 213 continue% skip iteration if the mode overwrite is desactivated and the result file already exists 214 end 215 179 216 %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%% 180 217 Data=cell(1,NbView);%initiate the set Data … … 185 222 clear ZItemp 186 223 ZItemp=zeros(size(XI,1),size(XI,2),2); 224 225 if index==1 226 first_img=i1_series{1,1}(1,1); %id of the first image of the series 227 end 228 229 idtemp=0; 187 230 for indextemp=index:index+1; 231 idtemp=idtemp+1; 188 232 if NbView==3 % if there is only 1 stereo folder, extract directly Xphys,Yphys and Zphys 189 190 [Data{3},tild,errormsg] = nc2struct([Param.InputTable{3,1},'/',Param.InputTable{3,2},'/',Param.InputTable{3,3},'_',int2str(indextemp),'.nc']); 191 233 234 235 236 [Data{3},tild,errormsg] = nc2struct([Param.InputTable{3,1},'/',Param.InputTable{3,2},'/',Param.InputTable{3,3},'_',int2str(first_img+indextemp-1),'.nc']); 192 237 193 238 if exist('Data{3}.Civ3_FF','var') % FF is present, remove wrong vector … … 219 264 end 220 265 221 [Data{3},tild,errormsg] = nc2struct([Param.InputTable{3,1},'/',Param.InputTable{3,2},'/',Param.InputTable{3,3},'_',int2str(indextemp),'.nc']); 266 267 268 [Data{3},tild,errormsg] = nc2struct([Param.InputTable{3,1},'/',Param.InputTable{3,2},'/',Param.InputTable{3,3},'_',int2str(first_img+indextemp-1),'.nc']); 269 222 270 if exist('Data{3}.Civ3_FF','var') % if FF is present, remove wrong vector 223 271 temp=find(Data{3}.Civ3_FF==0); … … 241 289 242 290 243 [Data{4},tild,errormsg] = nc2struct([Param.InputTable{4,1},'/',Param.InputTable{4,2},'/',Param.InputTable{4,3},'_',int2str(indextemp),'.nc']); 291 292 [Data{4},tild,errormsg] = nc2struct([Param.InputTable{4,1},'/',Param.InputTable{4,2},'/',Param.InputTable{4,3},'_',int2str(first_img+indextemp-1),'.nc']); 244 293 if exist('Data{4}.Civ3_FF','var') % if FF is present, remove wrong vector 245 294 temp=find(Data{4}.Civ3_FF==0); … … 279 328 280 329 281 ZItemp(:,:,i ndextemp)=griddata(Xphys,Yphys,Zphys,XI,YI); %interpolation on the choosen gridd330 ZItemp(:,:,idtemp)=griddata(Xphys,Yphys,Zphys,XI,YI); %interpolation on the choosen gridd 282 331 283 332 end … … 320 369 Va=griddata(X1,Y1,V1,Xa,Ya); 321 370 322 [Ua,Va,Xa,Ya]=Ud2U(XmlData{1}.GeometryCalib,Xa,Ya,Ua,Va); % convert Xd data to X371 % [Ua,Va,Xa,Ya]=Ud2U(XmlData{1}.GeometryCalib,Xa,Ya,Ua,Va); % convert Xd data to X 323 372 [A]=get_coeff(XmlData{1}.GeometryCalib,Xa,Ya,XI,YI,ZI); %get coef A~ 324 373 … … 332 381 Vb=griddata(X2,Y2,V2,Xb,Yb); 333 382 334 [Ub,Vb,Xb,Yb]=Ud2U(XmlData{2}.GeometryCalib,Xb,Yb,Ub,Vb); % convert Xd data to X383 % [Ub,Vb,Xb,Yb]=Ud2U(XmlData{2}.GeometryCalib,Xb,Yb,Ub,Vb); % convert Xd data to X 335 384 [B]=get_coeff(XmlData{2}.GeometryCalib,Xb,Yb,XI,YI,ZI); %get coef B~ 336 385 … … 369 418 370 419 371 %% generating the name of the merged field 372 i1=i1_series{1}(index); 373 if ~isempty(i2_series{end}) 374 i2=i2_series{end}(index); 375 else 376 i2=i1; 377 end 378 j1=1; 379 j2=1; 380 if ~isempty(j1_series{1}) 381 j1=j1_series{1}(index); 382 if ~isempty(j2_series{end}) 383 j2=j2_series{end}(index); 384 else 385 j2=j1; 386 end 387 end 388 OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},'.nc','_1-2',i1,i2,j1,j2); 420 389 421 390 422 %% recording the merged field … … 399 431 MergeData.coord_x=xI; 400 432 MergeData.coord_y=yI; 401 MergeData.Z=ZI;402 433 end 403 434 MergeData.U=U/Dt; 404 435 MergeData.V=V/Dt; 405 436 MergeData.W=W/Dt; 406 407 mfx=(XmlData{1}.GeometryCalib.fx_fy(1)+XmlData{2}.GeometryCalib.fx_fy(1))/2; 408 mfy=(XmlData{1}.GeometryCalib.fx_fy(2)+XmlData{2}.GeometryCalib.fx_fy(2))/2; 409 MergeData.Error=(sqrt(mfx^2+mfy^2)/4).*sqrt(sum(Error.*Error,3)); 437 MergeData.Z=ZI; 438 439 % mfx=(XmlData{1}.GeometryCalib.fx_fy(1)+XmlData{2}.GeometryCalib.fx_fy(1))/2; 440 % mfy=(XmlData{1}.GeometryCalib.fx_fy(2)+XmlData{2}.GeometryCalib.fx_fy(2))/2; 441 MergeData.Error=0.5*sqrt(sum(Error.^2,3)); 410 442 errormsg=struct2nc(OutputFile,MergeData);%save result file 411 443 if isempty(errormsg) … … 496 528 %% result 497 529 Den=(Dxb-Dxa).*(Dxb-Dxa)+(Dyb-Dya).*(Dyb-Dya); 498 error= ((Dyb-Dya).*(-u)-(Dxb-Dxa).*(-v))./Den;530 error=abs(((Dyb-Dya).*(-u)-(Dxb-Dxa).*(-v)))./Den; 499 531 % ex=-error.*(Dyb-Dya); 500 532 % ey=-error.*(Dxb-Dxa); -
trunk/src/series/stereo_civ.m
r924 r927 21 21 % .Patch2: 22 22 % ncfile: name of a netcdf file to be created for the result (extension .nc) 23 24 %=======================================================================25 % Copyright 2008-2016, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France26 % http://www.legi.grenoble-inp.fr27 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr28 23 % 29 % This file is part of the toolbox UVMAT. 30 % 24 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 25 % Copyright 2011-2015, LEGI / CNRS UJF G-INP, Joel.Sommeria@legi.grenoble-inp.fr 26 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 27 % This is part of the toolbox UVMAT. 28 % 31 29 % UVMAT is free software; you can redistribute it and/or modify 32 % it under the terms of the GNU General Public License as published 33 % by the Free Software Foundation; either version 2 of the license,34 % or(at your option) any later version.35 % 30 % it under the terms of the GNU General Public License as published by 31 % the Free Software Foundation; either version 2 of the License, or 32 % (at your option) any later version. 33 % 36 34 % UVMAT is distributed in the hope that it will be useful, 37 35 % but WITHOUT ANY WARRANTY; without even the implied warranty of 38 36 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 39 % GNU General Public License ( see LICENSE.txt) for more details.40 % =======================================================================37 % GNU General Public License (open UVMAT/COPYING.txt) for more details. 38 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 41 39 42 40 function [Data,errormsg,result_conv]= stereo_civ(Param) … … 67 65 Data.OutputSubDirMode='auto'; %select the last subDir in the input table as root of the output subdir name (option 'all'/'first'/'last', 'all' by default) 68 66 Data.OutputFileMode='NbInput_i';% one output file expected per value of i index (used for waitbar) 67 Data.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1) 68 69 69 return 70 70 end … … 168 168 end 169 169 if isempty(i1_series_Civ1)||(~isempty(PairCiv2) && isempty(i1_series_Civ2)) 170 disp_uvmat('ERROR','no image pair fo civ in the input file index range',checkrun)170 disp_uvmat('ERROR','no image pair for civ in the input file index range',checkrun) 171 171 return 172 172 end … … 265 265 tic 266 266 %%%%% MAIN LOOP %%%%%% 267 CheckOverwrite=1;%default 268 if isfield(Param,'CheckOverwrite') 269 CheckOverwrite=Param.CheckOverwrite; 270 end 271 267 272 for ifield=1:NbField 268 273 update_waitbar(WaitbarHandle,ifield/NbField) … … 282 287 ncfile2=fullfile_uvmat(RootPath_A,Civ1Dir,[RootFile_A,'_Light'],'.nc',NomTypeNc,i2_series_Civ1(ifield),[],... 283 288 j1_series_Civ1(ifield),j2_series_Civ1(ifield)); 289 290 if (~CheckOverwrite && exist(ncfile,'file')) || (~CheckOverwrite && exist(ncfile2,'file')) 291 disp('existing output file already exists, skip to next field') 292 result_conv=0; 293 continue% skip iteration if the mode overwrite is desactivated and the result file already exists 294 end 295 284 296 285 297 %% Civ1 … … 845 857 846 858 end 847 end 848 849 disp(['ellapsed time for the loop ' num2str(toc) ' s']) 859 end 860 disp(['ellapsed time for the loop ' num2str(toc) ' s']) 861 tic 862 while toc < rand(1)*10 863 for i = 1:100000, sqrt(1237); end 864 end 850 865 851 866 … … 1099 1114 [npy,npx]=size(result_conv); 1100 1115 result_conv(result_conv<1)=1; %set to 1 correlation values smaller than 1 (to avoid divergence in the log) 1101 %the following 8 lines are copyright (c) 1998, Uri Shavit, Roi Gurka, Alex Liberzon, Technion ï¿œIsrael Institute of Technology1116 %the following 8 lines are copyright (c) 1998, Uri Shavit, Roi Gurka, Alex Liberzon, Technion ??? Israel Institute of Technology 1102 1117 %http://urapiv.wordpress.com 1103 1118 peaky = y; … … 1136 1151 for j=-1:1 1137 1152 %following 15 lines based on 1138 %H. Nobach ï¿œM. Honkanen (2005)1153 %H. Nobach ??? M. Honkanen (2005) 1139 1154 %Two-dimensional Gaussian regression for sub-pixel displacement 1140 1155 %estimation in particle image velocimetry or particle position 1141 1156 %estimation in particle tracking velocimetry 1142 %Experiments in Fluids (2005) 38: 511 ï¿œ5151157 %Experiments in Fluids (2005) 38: 511???515 1143 1158 c10(j+2,i+2)=i*log(result_conv(y+j, x+i)); 1144 1159 c01(j+2,i+2)=j*log(result_conv(y+j, x+i));
Note: See TracChangeset
for help on using the changeset viewer.