Changeset 370 for trunk/src/civ_matlab.m
- Timestamp:
- Jan 13, 2012, 10:51:16 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ_matlab.m
r369 r370 215 215 [GridX,GridY]=meshgrid(minix:par_civ2.Dx:maxix,miniy:par_civ2.Dy:maxiy); 216 216 GridX=reshape(GridX,[],1); 217 GridY=reshape(GridY,[],1); 217 GridY=reshape(GridY,[],1); 218 218 Shiftx=zeros(size(GridX));% shift expected from civ1 data 219 219 Shifty=zeros(size(GridX)); … … 254 254 par_civ2.Grid=[GridX(nbval>=1)-par_civ2.Shiftx/2 GridY(nbval>=1)-par_civ2.Shifty/2];% grid taken at the extrapolated origin of the displacement vectors 255 255 if par_civ2.CheckDeformation 256 DUDX=DUDX./nbval;257 DUDY=DUDY./nbval;258 DVDX=DVDX./nbval;259 DVDY=DVDY./nbval;256 par_civ2.DUDX=DUDX./nbval; 257 par_civ2.DUDY=DUDY./nbval; 258 par_civ2.DVDX=DVDX./nbval; 259 par_civ2.DVDY=DVDY./nbval; 260 260 end 261 261 % caluclate velocity data (y and v in indices, reverse to y component) … … 494 494 if CheckDecimal 495 495 mesh=0.2;%mesh in pixels for subpixel image interpolation 496 CheckDeformation=isfield(par_civ,'CheckDeformation')&& par_civ.CheckDeformation==1; 496 497 end 497 498 % vector=[0 0];%default 498 499 for ivec=1:nbvec 499 iref= par_civ.Grid(ivec,1);% xindex on the image A for the middle of the correlation box500 jref= par_civ.Grid(ivec,2);% yindex on the image B for the middle of the correlation box500 iref=round(par_civ.Grid(ivec,1)+0.5);% xindex on the image A for the middle of the correlation box 501 jref=round(par_civ.ImageHeight-par_civ.Grid(ivec,2)+0.5);% yindex on the image B for the middle of the correlation box 501 502 if ~(checkmask && par_civ.Mask(jref,iref)<=20) %velocity not set to zero by the black mask 502 503 if jref-iby2<1 || jref+iby2>par_civ.ImageHeight|| iref-ibx2<1 || iref+ibx2>par_civ.ImageWidth||... … … 520 521 image1_crop=image1_crop-image1_mean;%substract the mean 521 522 image2_crop=image2_crop-image2_mean; 522 if isfield(par_civ,'CheckDecimal')&& par_civ.CheckDecimal==1523 if CheckDecimal 523 524 xi=(1:mesh:size(image1_crop,2)); 524 525 yi=(1:mesh:size(image1_crop,1))'; 525 image1_crop=interp2(image1_crop,xi,yi); 526 if CheckDeformation 527 [XI,YI]=meshgrid(xi-ceil(size(image1_crop,2)/2),yi-ceil(size(image1_crop,1)/2)); 528 XIant=XI-par_civ.DUDX(ivec)*XI-par_civ.DUDY(ivec)*YI+ceil(size(image1_crop,2)/2); 529 YIant=YI-par_civ.DVDX(ivec)*XI-par_civ.DVDY(ivec)*YI+ceil(size(image1_crop,1)/2); 530 image1_crop=interp2(image1_crop,XIant,YIant); 531 else 532 image1_crop=interp2(image1_crop,xi,yi); 533 end 526 534 xi=(1:mesh:size(image2_crop,2)); 527 535 yi=(1:mesh:size(image2_crop,1))'; … … 544 552 utable(ivec)=vector(1)*mesh+shiftx(ivec); 545 553 vtable(ivec)=vector(2)*mesh+shifty(ivec); 546 xtable(ivec)=iref+utable(ivec)/2 ;% convec flow (velocity taken at the point middle from imgae1 and 2)547 ytable(ivec)=jref+vtable(ivec)/2 ;554 xtable(ivec)=iref+utable(ivec)/2-0.5;% convec flow (velocity taken at the point middle from imgae 1 and 2) 555 ytable(ivec)=jref+vtable(ivec)/2-0.5;% and position of pixel 1=0.5 (convention for image coordinates=0 at the edge) 548 556 iref=round(xtable(ivec));% image index for the middle of the vector 549 557 jref=round(ytable(ivec));
Note: See TracChangeset
for help on using the changeset viewer.