Download presentation
Presentation is loading. Please wait.
Published byRaymond Stephen Wilkerson Modified over 9 years ago
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
2
2 Lecture 26. Sub-pixel Displacement
3
3 Correlation Interrogation & FFT Acceleration Evaluation function Auto-correlation function g(i,j) (m*=10, n*=-5) (m*=-10, n*=5) -One double exposed evaluation sample, i.e. g(i,j)=g 2 (i,j)=g 1 (i,j) -Displacement determined by positions of the secondary maxima -Two possible velocity directions
4
4 Correlation Interrogation & FFT Acceleration Evaluation function Cross-correlation function -Two single exposed evaluation samples, i.e. g 2 (i,j) & g 1 (i,j) (m*=3, n*=5) g 1 (i,j) g 2 (i,j) -Velocity direction clear -Displacement determined by position of the maximum
5
5 Sub-pixel Displacement Local surface fit of evaluation function Discrete correlation function around point of maximum (m*,n*)
6
6 Sub-pixel Displacement Local surface fit of evaluation function Discrete distribution fitted with continuous surface z(x,y)
7
7 Sub-pixel Displacement Local surface fit of evaluation function Sub-pixel displacement (x*,y*) determined with position of the maximum of z(x,y)
8
8 Sub-pixel Displacement Local surface fit of evaluation function 5-point fit most commonly used
9
9 Sub-pixel Displacement Local surface fit of evaluation function 5-point parabolic fit Fit function Linear equation system for determining constants Position of the maximum
10
10 Sub-pixel Displacement Local surface fit of evaluation function 5-point exponential fit (3-point Guassian curve fit) Position of the maximum Fit function Linear equation system for determining constants
11
11 Arbitrarily sized interrogation window Performance of FFT-based correlation - Effective correlation region A : Effective correlation region B,C,D: Periodically Padded regions
12
12 Arbitrarily sized interrogation window Performance of FFT-based correlation - Reliability & RMS error dependent on particle image displacement - Reliability & RMS error dependent on interrogation window size - Impossible to determine displacement components not less than half of window side length Reliability: RMS error: S : measured value S’: real value Some test results with synthetic images f: interrogation window size S S
13
13 Arbitrarily sized interrogation window Average padding to next power of 2 Test results with synthetic images (f=32x32) 1 original 2 padded to f=64x64 SS
14
14 More about Correlation Interrogation Fast computation of evaluation function Acceleration with radix-2 based FFT algorithm - Computation time test
15
15 Effect of linear transformation of evaluation samples More about Correlation Interrogation on the correlation function - no influence
16
16 Effect of linear transformation of evaluation samples More about Correlation Interrogation on the sub-pixel displacement determination with Parabolic surface/curve fit - no influence
17
17 Effect of linear transformation of evaluation samples More about Correlation Interrogation on the sub-pixel displacement determination with exponential surface/curve fit - obvious influence - no zero and negative values allowed - normalization suggested before sub-pixel fit
18
Class project: example of Matlab functions for PIV recording evaluation 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-1; n(i,j)=j-N2/2-1; end % determine coordinates in correlation plane - end % periodical reconstruction of correlation function - begin 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
19
19 Class project: example of Matlab functions for PIV recording evaluation File name: peaksearch.m function [cm vx vy]=peaksearch(C,m,n,sr,mode,direction) % INPUT PARAMETERS % C - correlation function % m - horizontal coordinate % n - vertical coordinate % sr - search radius % mode - (=0) cross-correlation, (=1) auto-correlation % direction - 1. to right, 2. to left, 3. upwards, 4. downwards % OUTPUT PARAMETERS % cm - high correlation peak value % (vx,vy) – particle image displacement [M N]=size(C); % high peak search - begin ix=0; jy=0; cm=0; for i=M/2+1-sr:M/2+1+sr for j=N/2+1-sr:N/2+1+sr if mode==1 & direction==1 & i<=M/2+1 continue; end if mode==1 & direction==2 & i>=M/2+1 continue; end if mode==1 & direction==3 & j>=N/2+1 continue; end if mode==1 & direction==4 & j<=N/2+1 continue; end max=0; for i1=i-1:i+1 for j1=j-1:j+1 if max<C(i1,j1) max=C(i1,j1); end if C(i,j)>=max & C(i,j)>cm ix=i; jy=j; cm=C(i,j); end mm=m(ix,jy); nn=n(ix,jy); % high peak search -end ( continued to next page )
20
20 Class project: example of Matlab functions for PIV recording evaluation File name: peaksearch.m ( continued ) % SUB-PIXEL FIT dx=(log(C(ix+1,jy))-log(C(ix-1,jy)))/(4*log(C(ix,jy))-2*log(C(ix+1,jy))-2*log(C(ix-1,jy))); dy=(log(C(ix,jy+1))-log(C(ix,jy-1)))/(4*log(C(ix,jy))-2*log(C(ix,jy+1))-2*log(C(ix,jy-1))); %Displacement vx=mm+dx; vy=nn+dy; File name: sample.m function[g]=sample(G,M,N,x,y) %INPUT PARAMETERS % G - gray value distribution of the PIV recording % M - interrogation window width % N - interrogation window height % x - horizontal position of interrogation window % y - vertical position of the interrogation window % OUTPUT PARAMETERS % g - gray value distribution of the evaluation sample for i=1:M for j=1:N g(i,j)=G(i+x-int16(M/2),j+y-int16(N/2)); end
21
21 Class project: example of Matlab functions for PIV recording evaluation File name: img2xy.m function [G]=img2xy(A) % A - image % G - gray value distribution [ny nx]=size(A); for x=1:nx for y=1:ny G(x,y)=A(ny-y+1,x); end File name: xy2img.m function [A]=xy2img(G) % A - image % G - gray value distribution [nx ny]=size(G); Gmax=max(max(G)); Gmin=min(min(G)); for x=1:nx for y=1:ny A(ny-y+1,x)=int8(double(G(x,y)-Gmin)/double(Gmax- Gmin)*245+5); end
22
22 Class project: example of Matlab functions for PIV recording evaluation File name: main.m clear; A=imread('image01.bmp'); % input image file G=img2xy(A); % conver image to gray value distribution % evaluation point x=62; y=62; % interrogation window size M=64; N=64; % evaluation samples g1=sample(G,M,N,x,y); g2=g1; % correlation function [C m n]=correlation(g1,g2); sr=20; % search radius mode=1; % PIV recording mode direction=1; % main flow direction [cm vx vy]=peaksearch(C,m,n,sr,mode,direction) % particle image displacement D=xy2img(C); % convert correlation function to image imshow(D); % display correlation function
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.