properties of 2d discrete fft fixed sample size size of window has to be a base-2 dimension, 32x32,...
Post on 19-Dec-2015
222 views
TRANSCRIPT
![Page 1: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/1.jpg)
Properties of 2D discrete FFT
Fixed sample size Size of window has to be a base-2 dimension, 32x32, or
64x64
Periodicity assumption Particle image is assumed to be periodic
Aliasing Correlation data is periodic, peak located at area outside
of IC window will be found on the opposite side
Bias error Large shift (less overlapping pattern) leads to smaller
and biased peak
![Page 2: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/2.jpg)
Periodicity assumption
Applying FFT to a domain assumes the domain is periodic.
![Page 3: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/3.jpg)
Periodicity assumption
Applying FFT to a domain assumes the domain is periodic.
Periodic condition for the domain
![Page 4: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/4.jpg)
Periodicity assumption
Applying FFT to a domain assumes the domain is periodic.
Periodic condition for the domain
Particle image does not satisfy this condition
![Page 5: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/5.jpg)
Periodicity assumption
Applying FFT to a domain assumes the domain is periodic.
Periodic condition for the domain
Particle image does not satisfy this condition
Bias error
Shift (s)
Cor
rela
tion
Bias error
True peakMeasured peak
1
![Page 6: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/6.jpg)
Solution for the bias error
1D example:
f0
1
0 Ng
0
1
0 N
convolving
0
1
-N/2 N/20Center 0: 1; ±N/2: 1/2
Reduce bias error
Multiplying weighting factors
Adjusting correlation coefficients
Re-scale to [1/2, 1]
Image is convolved with itself
![Page 7: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/7.jpg)
Subpixel interpolation
Reason
shift
correlationCalculating in digital form
shift
correlation
Solution: subpixel interpolation-curve fitting from 3 points near peak- finding the peak in the curve
shift
correlationCurve fitting
![Page 8: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/8.jpg)
Schemes for subpixel interpolation
Remark:
-Gaussian fitting is more commonly used-Parabolic fitting has a divided-by-zero problem when Ri-1 = Ri = Ri+1
![Page 9: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/9.jpg)
Advanced techniques- multiple pass interrogation algorithm
Principle Crosscorrelating one IC window with another IC window
with known shift Determination of known shift – normal crosscorrelation
Implementation Using normal crosscorrelation method to get the velocity
map; Detecting bad vectors and replacing with interpolated
vectors; Computing crosscorrelation coefficients by shifting
another IC window with the displacement determined by the obtained velocity;
![Page 10: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/10.jpg)
Advanced techniques- multiple pass interrogation algorithm
P-I
P-II
Normal crosscorrelation
P-I
P-II
multiple pass interrogation
IC
![Page 11: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/11.jpg)
Advanced techniques- multiple pass interrogation algorithm
P-I
P-II
Normal crosscorrelation
P-I
P-II
multiple pass interrogation
IC
![Page 12: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/12.jpg)
Advanced techniques- multiple pass interrogation algorithm
P-I
P-II
Normal crosscorrelation
P-IP-II
multiple pass interrogation
IC
![Page 13: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/13.jpg)
Advanced techniques – hierarchical approach
Principle Similar to the multiple pass algorithm but the sampling
grid system is gradually refined with reducing IC size simultaneously
Advantage Able to capture complex structure;
Implementation Run multiple pass algorithms under adaptive grid
systems and correspondingly changed IC window
![Page 14: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/14.jpg)
Example of hierarchical approach
![Page 15: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/15.jpg)
Multiple peak detection
Reason The strongest peak is not always associated with the
correct shift, especially in the area of complex structure, e.g., strong vorticity, strong shear
Implementation Detecting local maximums and keeping them as “peak
candidates”; Compare velocity with surrounding velocities, ruling out
the unreasonable “peak candidates” until the searching status is not changed
![Page 16: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/16.jpg)
Example of multiple peak detection
Multiple peak detectionSingle peak detection
![Page 17: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/17.jpg)
Data validation
Reason of the occurrence of bad vectors Inhomogeneous seeding Noise Complex flow structure
Validation method Direct comparison Median Filter Mean Filter
![Page 18: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/18.jpg)
Data validation (cont’d)
U1=Ui+1,j
U2=Ui+1,j-1
U8=Ui+1,j+1
U9=Ui,j
U3=Ui,j-1
U7=Ui,j+1
U5=Ui-1,j
U4=Ui-1,j-1
U6=Ui-1,j+1Direct comparison
00;1,1,,,
jiji UU
Median Filter
jiji UUMedian ,, )(
Mean Filter
jiji UUMean ,, )(
![Page 19: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/19.jpg)
Interpolation
Linear interpolation
4
10
43
21
00
4/)1)(1(4/)1)(1(
4/)1)(1(4/)1)(1(
2/)(2/)(
iii
cc
UU
yyyxxx
x
y
x1,y1x1,y1
x3,y3 x4,y4
x0,y0xc,yc
![Page 20: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/20.jpg)
Read Tecplot data file
Format of head before data
TITLE = "Import0 in Mae513 Velocity vectors [positions in cm] [velocities in cm/s]"VARIABLES = " Position x "," Position y "," Velocity u "," Velocity v "ZONE T="Data", I=34, J=34, F=POINTDT=( SINGLE, SINGLE, SINGLE, SINGLE )-3.200000000e+001 -3.200000000e+001 0.000000000e+000 0.000000000e+0000.000000000e+000 -3.200000000e+001 0.000000000e+000 0.000000000e+000 x y u v
![Page 21: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/21.jpg)
Program list (Matlab)
FileName = 'Take_01000.dat';%% TecPlot data file which saves velocity datafid = fopen(FileName,'r');Line = fgetl( fid ); Line = fgetl( fid ); Line = fgetl( fid );Dim = sscanf( Line, 'ZONE T="Data", I=%d, J=%d, F=POINT');Line = fgetl( fid );nx = Dim(1); %% Grid number in x directionny = Dim(2); %% Grid number in y directionu = zeros(nx, ny); v = zeros(nx, ny); x = zeros(nx, 1); y = zeros(1, ny);temp = fscanf(fid, '%e');s = 1;for j = 1:ny for i = 1:nx x(i, 1) = temp(s); y(1, j) = temp(s+1); u(i,j) = temp(s+2); v(i,j) = temp(s+3); s = s + 4; endendfclose(fid);%% now you have x(1:nx, 1), y(1, 1:ny), u(1:nx, 1:ny), v(1:nx,1:ny)%% you can do further processing of x, y, u, v
![Page 22: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/22.jpg)
Program list (Fortran)
!! maximum dimension for u and vparameter (mx = 101, my = 101)real x(mx), y(my), u(mx,my), v(mx,my)character*32 FileName /'Take_01000.dat'/character*80 Lineopen(100, file=FileName, status = 'old')read(100, *); read(100, *); read(100, '(A80)') Line; read(100, *)!! The line contains the string of!! 'ZONE T="Data", I=%d, J=%d, F=POINT'ie1 = index(Line, 'I=') + 2ie2 = index(Line, ', J=') - 1ie3 = index(Line, 'J=') + 2ie4 = index(Line, ', F=POINT') - 1read(Line(ie1:ie2), '(I)') nxread(Line(ie3:ie4), '(I)') nydo j=1, nydo i=1, nx
read(100, *) x(i), y(j), u(i,j), v(i,j)enddoenddoclose(100)
![Page 23: Properties of 2D discrete FFT Fixed sample size Size of window has to be a base-2 dimension, 32x32, or 64x64 Periodicity assumption Particle image](https://reader030.vdocuments.net/reader030/viewer/2022020106/56649d395503460f94a12bea/html5/thumbnails/23.jpg)
Program list (C/C++)#include <stdio.h>#include <stdlib.h>// maximum dimension for x and y directions#define MX 101#define MY 101int main() {
char FileName[32]; int nx, ny; char Line[81];float x[MX], y[MY], u[MY][MX], v[MY][MX];strcpy(FileName, "Take_01000.dat");FILE *fp = fopen(FileName, "r"); if ( !fp ) return -1;fgets(Line, 80, fp); fgets(Line, 80, fp); fgets(Line, 80, fp);fgets(Line, 80, fp); // printf("%s", Line);sscanf(Line, "ZONE T=\"Data\", I=%d, J=%d, F=POINT\n", &nx, &ny);printf("nx=%d ny=%d\n", nx, ny);fgets(Line, 80, fp);for (int j=0; j<ny; j++)for (int i=0; i<nx; i++) { fscanf(fp, "%e %e %e %e", &x[i], &y[j], &u[j][i], &v[j][i]);}fclose(fp);
}