Measurements in Fluid Mechanics058: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 [email protected]
http://lcgui.net
Students are encouraged to attend the class. You may not be able to understand by just reading the lecture notes.
2
Lecture 32. Erroneous Vector Identification& Correction
3
Erroneous Vectors
Example: Air flow near a pipe wallDouble exposed PIV recording Evaluation results with 6464-pixel window
4
Identification Erroneous Vectors
Range limit validation Identify vectors larger than a threshold Remove vectors larger than the threshold
5
Median filter (3x3)
1 2 3
4 5 6
7 8 9
5S
123456789
xiS ,
396572418
xiS ,
xmS ,
1 2 3 4 5 6 7 8 9
yiS , yiS ,
3 2 8 7 5 6 9 4 1
ymS ,mS
xmS ,
ymS ,
Validation criterion: gm SSS
5
Identification Erroneous Vectors
6
Identification Erroneous Vectors
Effect of median filter Original vector map Filtered vector map
7
i-1
i
i+1
j+1
j
j-1
t+t
t
t-t
Vm
Vc
|Vc-Vm| Vg
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
Identification Erroneous Vectors
8
Reversibility of particle image pattern tracking
gyyxx SSSSS 2*2**SSValidation criterion:
Identification Erroneous Vectors
9
Correction of Erroneous Vectors
Possible particle image displacements
Evaluation function with strong noises
Local maxima
Possible displacements
10
Target vector method
gkikkp Si ||and,3,2,1|,|min||if mmm SSSSSSSS
Correction of Erroneous Vectors
Possible vectors
Sm
Target vector
11
Maximal reversibility method
gkkiikkkp Si ||and,3,2,1|,|min||if *** SSSSSSSS
Correction of Erroneous Vectors
Possible vectors Reversed vectors
12
Filtered vector map
Correction of Erroneous Vectors
Effect of target vector error correction Corrected vector map
13
Further Error Reduction
Use small search radius=31 pixels, 873 valid vectors =17 pixels, 897 valid vectors
14
Further Error Reduction
Use window shift=17 pixels, no window shift =12 pixels, xs=13 pixels, ys=0
15
Further Error Reduction
Use iterated evaluation (w. window shift)W/o iteration, 947 valid vectors Iterated evaluation, 953 valid vectors
16
Further Error Reduction
Process digital image before evaluationW/o iteration, unsharp mask (r=11) Iterated evaluation, unsharp mask (r=11)
Matlab function 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
[nx ny]=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 endend % range filtering end
17
18
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
Matlab function for erroneous vector identification
19
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
Matlab function for erroneous vector identification
20
Matlab function for local vector interpolationFile name: interpolation.mfunction[U V valid2]=interpolation(U,V, valid1)[nx ny]=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 programclear;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 heightM2=48; % final interrogation window width N2=48; % final interrogation window height sr1=15; % initial search radiussr2=6; % final search radiusNN=6; % iteration numberdU=[0 20 3]; % parameters for error detectiondV=[-5 5 3]; % parameters for error detection
[nx ny]=size(G); % determine size of the imagerow=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); % claculating corraltion function [cm vx vy]=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 errorsend % 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 endend 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 programclear;A1=imread('A001_1.bmp'); % input image file A2=imread('A001_2.bmp'); % input image file G1=img2xy(A1); % convert image to gray value distributionG2=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 heightsr1=12; % initial search radiussr2=6; % final search radiusNN=6; % iteration numberdU=[-12 12 3]; % parameters for error detectiondV=[-12 12 3]; % parameters for error detection
[nx ny]=size(G1); % determine size of the imagerow=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 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 vx vy]=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
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 endend quiver(X,Y,U,V); % plot vector map
CDIC may be used for further improvement