Presentation is loading. Please wait.

Presentation is loading. Please wait.

Measurements in Fluid Mechanics 058:180:001 (ME:5180:0001) Time & Location: 2:30P - 3:20P MWF 218 MLH Office Hours: 4:00P – 5:00P MWF 223B-5 HL Instructor:

Similar presentations


Presentation on theme: "Measurements in Fluid Mechanics 058:180:001 (ME:5180:0001) Time & Location: 2:30P - 3:20P MWF 218 MLH Office Hours: 4:00P – 5:00P MWF 223B-5 HL Instructor:"— Presentation transcript:

1 Measurements in Fluid Mechanics 058:180:001 (ME:5180:0001) Time & Location: 2:30P - 3:20P MWF 218 MLH Office Hours: 4:00P – 5:00P MWF 223B-5 HL Instructor: Lichuan Gui lichuan-gui@uiowa.edu http://lcgui.net Students are encouraged to attend the class. You may not be able to understand by just reading the lecture notes.

2 2 Lecture 29. Interrogation Window Shift

3 3 Reduced working region for correlation interrogation Interrogation Window Shift Evaluation error for ideal PIV recordings by using different algorithms with a 64x64-pixel interrogation window Original peak search radius usually  M/3 or N/3 Reduced peak search radius oo rr  r <  o

4 4 Discrete window shift (DWS) Interrogation Window Shift G 2 (x,y) o y x xmxm ymym o j i g 1 (i,j) S WS x m +x s y m +y s f 2 (i,j) o j i S’ S Cross-correlation of single exposed PIV recording pair

5 5 Discrete window shift (DWS) Interrogation Window Shift Auto correlation of double exposed PIV recording No secondary maximum detected because of noises g(i,j)

6 6 Cross-correlation of double exposed PIV recording Secondary maximum appears S ws Limited search area:  <x s &  <y s Discrete window shift (DWS) Interrogation Window Shift g(i,j)f(i,j)

7 7 Discrete window shift (DWS) Interrogation Window Shift Determine initial window shift S WS Determine g 1 (i,j) Determine f 2 (i,j) Compute  (m,n) from g 1 (i,j) and f 2 (i,j) Maximum search to determine S’, S=S WS +S’ S’ small enough? S WS =S YES NO Too many iterations? NO YES Begin By previous knowledge or set to zero Usually 3 or 4 iterations Accelerated with FFT Sub-pixel fit End S: integer number of pixels DWS Flow Chart

8 8 Continuous window shift (CWS) Interrogation Window Shift S ws ={I+x, J+y} – I,J: integer numbers – x and y: decimal numbers and 0  x<1;0  y< 1 BA DC ab cd g(i,j) I+i J+j i j f(i,j) x y Binlear interpolation Other interpolation methods available

9 9 Continuous window shift (CWS) Interrogation Window Shift Determine initial window shift S WS Determine g 1 (i,j) Determine f 2 (i,j) Compute  (m,n) from g 1 (i,j) and f 2 (i,j) Maximum search and sub-pixel fit to determine S’, S=S WS +S’ S’ small enough? S WS =S YES NO Too many iterations? NO YES Begin By previous knowledge or set to zero Usually 4 to 6 iterations Accelerated with FFT End Bilinear interpolation or other CWS Flow Chart

10 10 Evaluation error distribution of DWS and CWS Interrogation Window Shift Test of three different algorithms with synthetic PIV images  Periodical functions of particle image displacement of 1-pixel period;  DWS better than correlation tracking around integer-pixel displacements but worse around mid-pixel displacements  CWS has much lower error level than DWS and correlation-based tracking

11 11 Matlab function for CWS File name: sample3.m function[g]=sample3(G,M,N,X,Y) I=int16(X); J=int16(Y); x=double(X)-double(I); y=double(Y)-double(J); if x<0 I=I-1; x=x+1; end if y<0 J=J-1; y=y+1; end for i=1:M for j=1:N ii=i+I-int16(M/2); jj=j+J-int16(N/2); Ga=double(G(ii,jj)); Gb=double(G(ii+1,jj)); Gc=double(G(ii,jj+1)); Gd=double(G(ii+1,jj+1)); A=(1-x)*(1-y); B=x*(1-y); C=(1-x)*y; D=x*y; g(i,j)=A*Ga+B*Gb+C*Gc+D*Gd; % bilinear interpolation end %INPUT PARAMETERS % G - gray value distribution of the PIV recording % M - interrogation sample width % N - interrogation sample height % X, Y - interrogation sample coordinates % OUTPUT PARAMETERS % g - gray value distribution of the evaluation sample % I, J – integer part of evaluation sample coordinates % x,y – decimal part of evaluation sample coordinates

12 12 Matlab function for CWS Test with ideal window shift clear; A1=imread('lecture27-image01.bmp'); % input image files A2=imread('lecture27-image02.bmp'); G1=img2xy(A1);G2=img2xy(A2); % convert image to gray value distribution Mg=64; Ng=64; % interrogation grid width and height M=64; N=64; % interrogation window width and height [nx ny]=size(G1); row=ny/Mg-1; % grid row number col=nx/Mg-1; % grid column number sr=10; % search radius wsx=3.5; wsy=5.5;% window shift for i=1:col for j=1:row x=i*Mg; y=j*Mg; g1=sample3(G1,M,N,x,y); % evaluation samples g2=sample3(G2,M,N,x+wsx,y+wsy); [C m n]=correlation(g1,g2); [cm vx vy]=peaksearch(C,m,n,sr,0,0); U(i,j)=vx+wsx; V(i,j)=vy+wsy; X(i,j)=x; Y(i,j)=y; end quiver(X,Y,U,V); % plot vector map mean(mean(U))-3.5 % bias of x-component mean(mean(V))-5.5 % bias of y-component

13 13 Matlab function for CWS Test with iterated window shift clear; A1=imread('lecture27-image01.bmp'); A2=imread('lecture27-image02.bmp'); G1=img2xy(A1); G2=img2xy(A2); Mg=64; Ng=64; M=64; N=64; [nx ny]=size(G1); row=ny/Mg-1; col=nx/Mg-1; sr=10; for i=1:col for j=1:row U(i,j)=0; V(i,j)=0; end for iteration=1:6 % iterated 6 times for i=1:col for j=1:row wsx=U(i,j); wsy=V(i,j); x=i*Mg; y=j*Mg; g1=sample3(G1,M,N,x,y); g2=sample3(G2,M,N,x+wsx,y+wsy); [C m n]=correlation(g1,g2); [cm vx vy]=peaksearch(C,m,n,sr,0,0); U(i,j)=vx+wsx; V(i,j)=vy+wsy; X(i,j)=x; Y(i,j)=y; end End quiver(X,Y,U,V); % plot vector map mean(mean(U))-3.5 % bias of x-component mean(mean(V))-5.5 % bias of y-component

14 Class project: corrected Matlab functions File name: correlation.m function[c m n]=correlation(g1,g2) [M N]=size(g1); % determine size of evaluation sample % determine window size for FFT - begin for k=3:12 if 2^k>=M & 2^k>=N break; end M2=2^k; N2=2^k; % determine window size for FFT - end % average gray value padding - begin gm1=mean(mean(g1)); gm2=mean(mean(g2)); for i=1:M2 for j=1:N2 if i<=M & j<=N gg1(i,j)=g1(i,j); gg2(i,j)=g2(i,j); else gg1(i,j)=gm1; gg2(i,j)=gm2; end % average gray value padding - end % compute correlation function - begin gfft1=fft2(gg1); gfft2=conj(fft2(gg2)); C=real(ifft2(gfft1.*gfft2)); % compute correlation function - end % determine coordinates in correlation plane - begin for i=1:M2 for j=1:N2 m(i,j)=i-M2/2; n(i,j)=j-N2/2; end % determine coordinates in correlation plane - end % periodical reconstruction of correlation function – begin for i=1:M2 for j=1:N2/2 t=C(i,j); C(i,j)=C(i,N2-j+1); C(i,N2-j+1)=t; end for j=1:N2 for i=1:M2/2 t=C(i,j); C(i,j)=C(M2-i+1,j); C(M2-i+1,j)=t; end for i=1:M2/2 C1(i,1:N2)=C(i+M2/2,1:N2); end for i=M2/2+1:M2 C1(i,1:N2)=C(i-M2/2,1:N2); end for j=1:N2/2 c(1:M2,j)=C1(1:M2,j+N2/2); end for j=N2/2+1:N2 c(1:M2,j)=C1(1:M2,j-N2/2); end % periodical reconstruction of correlation function - end


Download ppt "Measurements in Fluid Mechanics 058:180:001 (ME:5180:0001) Time & Location: 2:30P - 3:20P MWF 218 MLH Office Hours: 4:00P – 5:00P MWF 223B-5 HL Instructor:"

Similar presentations


Ads by Google