260 likes | 397 Views
Students are encouraged to attend the class. You may not be able to understand by just reading the lecture notes. 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
E N D
Students are encouraged to attend the class. You may not be able to understand by just reading the lecture notes. Measurements in Fluid Mechanics058:180:001 (ME:5180:0001)Time & Location: 2:30P - 3:20P MWF 218 MLHOffice Hours: 4:00P – 5:00P MWF 223B-5 HL Instructor: Lichuan Gui lichuan-gui@uiowa.edu http://lcgui.net
Evaluation results with 6464-pixel window Double exposed PIV recording Erroneous Vectors Example: Air flow near a pipe wall
Identify vectors larger than a threshold Remove vectors larger than the threshold Identification Erroneous Vectors Range limit validation
1 2 3 4 5 6 7 8 9 3 9 6 5 7 2 4 1 8 7 8 9 3 2 8 7 5 6 9 4 1 4 5 6 1 2 3 4 5 6 7 8 9 1 2 3 Validation criterion: Identification Erroneous Vectors Median filter (3x3)
Identification Erroneous Vectors Effect of median filter Original vector map Filtered vector map
Identification Erroneous Vectors 3D Median filter - Successively recorded PIV image pairs - Time interval between recording pairs t much smaller than flow variation period - Median of 27 vectors - Good for non-uniformly seeded flow |Vc-Vm| Vg
Validation criterion: Identification Erroneous Vectors Reversibility of particle image pattern tracking
Local maxima Evaluation function with strong noises Possible displacements Correction of Erroneous Vectors Possible particle image displacements
Sm Possible vectors Target vector Correction of Erroneous Vectors Target vector method
Possible vectors Reversed vectors Correction of Erroneous Vectors Maximal reversibility method
Correction of Erroneous Vectors Effect of target vector error correction Filtered vector map Corrected vector map
Further Error Reduction Use small search radius =31 pixels, 873 valid vectors =17 pixels, 897 valid vectors
Further Error Reduction Use window shift =17 pixels, no window shift =12 pixels, xs=13 pixels, ys=0
Further Error Reduction Use iterated evaluation (w. window shift) W/o iteration, 947 valid vectors Iterated evaluation, 953 valid vectors
Further Error Reduction Process digital image before evaluation W/o iteration, unsharp mask (r=11) Iterated evaluation, unsharp mask (r=11)
Matlabfunction for erroneous vector identification File name: errordetection.m function[valid]=errordetection(U,V,dU,dV) % U - horizontal particle image displacement % V - vertical particle image displacement % dU(1) - minimal horizontal particle image displacement % dU(2) - maximal horizontal particle image displacement % dU(3) - error tolerance of horizontal particle image displacement % dV(1) - minimal vertical particle image displacement % dV(2) - maximal vertical particle image displacement % dV(3) - error tolerance of vertical particle image displacement % Valid - validation index of the particle image displacement % 1 for valid vector, 0 for evaluation error [nxny]=size(U); % determine number of rows & collumns of interrogation grid for i=1:nx % range filtering begin for j=1:ny if U(i,j)>=dU(1) & U(i,j)<=dU(2) & V(i,j)>=dV(1) & V(i,j)<=dV(2) valid1(i,j)=1; else valid1(i,j)=0; end end end % range filtering end
Matlabfunction for erroneous vector identification File name: errordetection.m for i=1:nx % median filter begin for j=1:ny if valid1(i,j)==0 % skip detected errors valid(i,j)=0; continue; end % skip detected errors nr=0; % search for valid vectors in 3x3 neighborhood for p=-1:1 for q=-1:1 if i+p>=1 & i+p<=nx & j+q>=1 & j+q<=ny & valid1(i+p,j+q)==1 nr=nr+1; u(nr)=U(i+p,j+q); v(nr)=V(i+p,j+q); end end end % search for valid vectors in 3x3 neighborhood if nr<3 % skip vector without enough valid neighbors valid(i,j)=0; continue; end % skip vector without enough valid neighbors
Matlabfunction for erroneous vector identification File name: errordetection.m for p=1:nr-1 % determine median vector for q=p+1:nr if u(q)>u(p) um=u(p); u(p)=u(q); u(q)=um; end if v(q)>v(p) vm=v(p); v(p)=v(q); v(q)=vm; end end end nm=int16(nr/2); um=u(nm); vm=v(nm); % determine median vector if abs(U(i,j)-um)<=dU(3) & abs(V(i,j)-vm)<=dV(3) % detect wrong vector valid(i,j)=1; else valid(i,j)=0; end % detect wrong vector end end % median filter end
Matlabfunction for local vector interpolation File name: interpolation.m function[U V valid2]=interpolation(U,V, valid1) [nxny]=size(U); for i=1:nx for j=1:ny if valid1(i,j)==1 valid2(i,j)=1; continue; end nr=0; um=0; vm=0; for p=-1:1 for q=-1:1 if i+p>=1 & i+p<=nx & j+q>=1 & j+q<=ny & valid1(i+p,j+q)==1 nr=nr+1; um=um+U(i+p,j+q); vm=vm+V(i+p,j+q); end end end if nr>0 valid2(i,j)=1; U(i,j)=um/nr; V(i,j)=vm/nr; else valid2(i,j)=0; end end end % U - horizontal particle image displacement % V - vertical particle image displacement % valid - validation index of the particle image displacement
Example of Matlab program for evaluating double exposed recording D001_1.bmp Main program clear; A=imread('D001_1.bmp'); % input image file G=img2xy(A); % convert image to gray value distribution Mg=32; % interrogation grid width Ng=32; % interrogation grid height M1=64; % initial interrogation window width N1=64; % initial interrogation window height M2=48; % final interrogation window width N2=48; % final interrogation window height sr1=15; % initial search radius sr2=6; % final search radius NN=6; % iteration number dU=[0 20 3]; % parameters for error detection dV=[-5 5 3]; % parameters for error detection [nxny]=size(G); % determine size of the image row=ny/Mg-1; % number of grid rows col=nx/Mg-1; % number of grid columns for nn=1:NN % iteration begin M=(nn-1)*(M2-M1)/(NN-1)+M1; % determine window width N=(nn-1)*(N2-N1)/(NN-1)+N1; % determine window height sr=(nn-1)*(sr2-sr1)/(NN-1)+sr1; % determine search radius if nn>1 [U V valid]=interpolation(U,V, valid); % interpolation for window shift [U V valid]=interpolation(U,V, valid); % interpolation for window shift end
Example of Matlab program for evaluating double exposed recording D001_1.bmp for i=1:col for j=1:row if nn==1 % determine window shift wsx=sr; wsy=0; else if valid(i,j)>0 wsx=U(i,j); wsy=V(i,j); if sr>int16(wsx) % adjust search radius for double exposed recording sr=int16(wsx); end end end x=i*Mg; % determine horizontal coordinate of interrogation point y=j*Ng; % determine vertical coordinate of interrogation point g1=sample3(G,M,N,x-wsx/2,y-wsy/2); % evaluation sample with backward wondow shift g2=sample3(G,M,N,x+wsx/2,y+wsy/2); % evaluation sample with forward wondow shift [C m n]=correlation(g1,g2); % claculatingcorraltion function [cm vxvy]=peaksearch(C,m,n,sr,0,0); % determine particle image displacement U(i,j)=vx+wsx; % adjust particle image displacement with window shift V(i,j)=vy+wsy; % adjust particle image displacement with window shift X(i,j)=x; % record evaluation coordinate Y(i,j)=y; % record evaluation coordinate end end valid=errordetection(U,V,dU,dV); % detect evaluation errors end % iteration end
Example of Matlab program for evaluating double exposed recording D001_1.bmp for i=1:col % remove evaluation errors for j=1:row if valid(i,j)==0 U(i,j)=0; V(i,j)=0; end end end quiver(X,Y,U,V); Unsharp mask filter may be used for further improvement
Example of Matlab program for evaluating single exposed recording pair Main program clear; A1=imread('A001_1.bmp'); % input image file A2=imread('A001_2.bmp'); % input image file G1=img2xy(A1); % convert image to gray value distribution G2=img2xy(A2); % convert image to gray value distribution Mg=16; % interrogation grid width Ng=16; % interrogation grid height M=32; % interrogation window width N=32; % interrogation window height sr1=12; % initial search radius sr2=6; % final search radius NN=6; % iteration number dU=[-12 12 3]; % parameters for error detection dV=[-12 12 3]; % parameters for error detection [nxny]=size(G1); % determine size of the image row=ny/Mg-1; % number of grid rows col=nx/Mg-1; % number of grid columns for nn=1:NN % iteration begin sr=int16((nn-1)*(sr2-sr1)/(NN-1)+sr1); % determine search radius if nn>1 [U V valid]=interpolation(U,V, valid); % interpolation for window shift [U V valid]=interpolation(U,V, valid); % interpolation for window shift end
Example of Matlab program for evaluating single exposed recording pair for i=1:col % remove evaluation errors for j=1:row if valid(i,j)==0 U(i,j)=0; V(i,j)=0; end end end quiver(X,Y,U,V); % plot vector map for i=1:col for j=1:row if nn==1 % determine window shift wsx=0; wsy=0; else if valid(i,j)>0 wsx=U(i,j); wsy=V(i,j); end end x=i*Mg; % determine horizontal coordinate of interrogation point y=j*Ng; % determine vertical coordinate of interrogation point g1=sample3(G1,M,N,x-wsx/2,y-wsy/2); % evaluation sample with backward window shift g2=sample3(G2,M,N,x+wsx/2,y+wsy/2); % evaluation sample with forward window shift [C m n]=correlation(g1,g2); % calculating correlation function [cm vxvy]=peaksearch(C,m,n,sr,0,0); % determine particle image displacement U(i,j)=vx+wsx; % adjust particle image displacement with window shift V(i,j)=vy+wsy; % adjust particle image displacement with window shift X(i,j)=x; % record evaluation coordinate Y(i,j)=y; % record evaluation coordinate end end valid=errordetection(U,V,dU,dV); % detect evaluation errors end % iteration end