jpiv2
Class PivUtil

java.lang.Object
  extended by jpiv2.PivUtil

public final class PivUtil
extends java.lang.Object

Calculates the two dimensional cross-correlation function of two images.


Constructor Summary
PivUtil()
           
 
Method Summary
static javax.media.jai.PlanarImage correlate(javax.media.jai.PlanarImage piA, javax.media.jai.PlanarImage piB)
          Calculates the two dimensional cross-correlation function of two images.
static void createRandomParticleVolumes(java.io.BufferedWriter bwA, java.io.BufferedWriter bwB, double vx, double vy, double vz, double a, double b, double c, int np, double dp, double w)
          Creates random particle position volumes of a Poiseuille flow.
static java.lang.String[] createReferenceData(java.lang.String outputFileName, double vx, double vy, double vz, double a, double b, double c, double dp, double w, int nsp, double dsp, double scaleX, double scaleY, int x0, int y0, int hx, int hy, int nx, int ny, double topZ, boolean header)
          Creates reference vector data of a Poiseuille flow.
static float[][] divideByWeightingFunction(float[][] subCorrMat, int xOffset, int yOffset, int w, int h)
          Divides the correlation matrix by a pyramid weighting function.
static double[] gaussianPeakFit(float[][] subCorrMat, int x, int y)
          Gaussian peak fit.
static double[] gaussianPeakFit(javax.media.jai.PlanarImage subCorrMat, int i, int j)
          Gaussian peak fit.
static double[] getGaussianPeak(javax.media.jai.PlanarImage subCorrMat, int x, int y, int w, int h)
          Searches for the highest value in a correlation matrix.
static double[] getParabolicPeak(javax.media.jai.PlanarImage subCorrMat, int x, int y, int w, int h)
          Searches for the highest value in a correlation matrix.
static int[] getPeak(float[][] subCorrMat)
          Finds the highest value in a correlation matrix.
static int[] getPeak(float[][] subCorrMat, int x, int y, int w, int h)
          Finds the highest value in a correlation matrix (i=y, j=x)
static int[] getPeak(javax.media.jai.PlanarImage subCorrMat, int x, int y, int w, int h)
          Finds the highest value in a correlation matrix (i=y, j=x)
static int[] getPeak(javax.media.jai.PlanarImage subCorrMat, javax.media.jai.ROI roi)
          Finds the highest value in a correlation matrix (i=y, j=x)
static double[] parabolicPeakFit(float[][] subCorrMat, int x, int y)
          Parabolic peak fit.
static double[] parabolicPeakFit(javax.media.jai.PlanarImage subCorrMat, int i, int j)
          Parabolic peak fit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PivUtil

public PivUtil()
Method Detail

correlate

public static javax.media.jai.PlanarImage correlate(javax.media.jai.PlanarImage piA,
                                                    javax.media.jai.PlanarImage piB)
Calculates the two dimensional cross-correlation function of two images.

Parameters:
piA - The first image (e.g. interrogation area).
piB - The second image (e.g. interrogation area).
Returns:
The correlation function.

divideByWeightingFunction

public static float[][] divideByWeightingFunction(float[][] subCorrMat,
                                                  int xOffset,
                                                  int yOffset,
                                                  int w,
                                                  int h)
Divides the correlation matrix by a pyramid weighting function.

Parameters:
subCorrMat - The biased correlation function
xOffset - If this matrix is merely a search area within a larger correlation matrix, this is the offset of the search area.
yOffset - If this matrix is merely a search area within a larger correlation matrix, this is the offset of the search area.
w - Width of the original correlation matrix.
h - Height of the original correlation matrix.
Returns:
The corrected correlation function

getGaussianPeak

public static double[] getGaussianPeak(javax.media.jai.PlanarImage subCorrMat,
                                       int x,
                                       int y,
                                       int w,
                                       int h)
Searches for the highest value in a correlation matrix. A pyramid weighting function is applied prior to peak search. Gaussian Peak Fit is used for sub pixel accuracy.

Parameters:
subCorrMat - A single correlation matrix.
x - the x coordinate of the search area
y - the y coordinate of the search area
w - width of the search area
h - height of the search area
Returns:
The indices of the highest value {i,j} or {y,x} and the peak height.

getParabolicPeak

public static double[] getParabolicPeak(javax.media.jai.PlanarImage subCorrMat,
                                        int x,
                                        int y,
                                        int w,
                                        int h)
Searches for the highest value in a correlation matrix. A pyramid weighting function is applied prior to peak search. Parabolic Peak Fit is used for sub pixel accuracy.

Parameters:
subCorrMat - A single correlation matrix.
x - the x coordinate of the search area
y - the y coordinate of the search area
w - width of the search area
h - height of the search area
Returns:
The indices of the highest value {i,j} or {y,x} and the peak height.

getPeak

public static int[] getPeak(float[][] subCorrMat,
                            int x,
                            int y,
                            int w,
                            int h)
Finds the highest value in a correlation matrix (i=y, j=x)

Parameters:
subCorrMat - A single correlation matrix.
x - the x coordinate of the search area
y - the y coordinate of the search area
w - width of the search area
h - height of the search area
Returns:
The indices of the highest value {i,j} or {y,x}.

getPeak

public static int[] getPeak(float[][] subCorrMat)
Finds the highest value in a correlation matrix.

Parameters:
subCorrMat - A single correlation matrix.
Returns:
The indices of the highest value {i,j} or {y,x}.

getPeak

public static int[] getPeak(javax.media.jai.PlanarImage subCorrMat,
                            int x,
                            int y,
                            int w,
                            int h)
Finds the highest value in a correlation matrix (i=y, j=x)

Parameters:
subCorrMat - A single correlation matrix.
x - the x coordinate of the search area
y - the y coordinate of the search area
w - width of the search area
h - height of the search area
Returns:
The indices of the highest value {i,j} or {y,x}.

getPeak

public static int[] getPeak(javax.media.jai.PlanarImage subCorrMat,
                            javax.media.jai.ROI roi)
Finds the highest value in a correlation matrix (i=y, j=x)

Parameters:
subCorrMat - A single correlation matrix.
roi - Limit the search area to a region of interest.
Returns:
The indices of the highest value {i,j} or {y,x}.

gaussianPeakFit

public static double[] gaussianPeakFit(float[][] subCorrMat,
                                       int x,
                                       int y)
Gaussian peak fit. See Raffel, Willert, Kompenhans; Particle Image Velocimetry; 3rd printing; S. 131 for details

Parameters:
subCorrMat - some two dimensional data containing a correlation peak
x - the horizontal peak position
y - the vertical peak position
Returns:
a double array containing the peak position with sub pixel accuracy

gaussianPeakFit

public static double[] gaussianPeakFit(javax.media.jai.PlanarImage subCorrMat,
                                       int i,
                                       int j)
Gaussian peak fit. See Raffel, Willert, Kompenhans; Particle Image Velocimetry; 3rd printing; S. 131 for details A pyramid weighting function is applied to the fife values that are used for the peak fit.

Parameters:
subCorrMat - some two dimensional data containing a correlation peak
i - the horizontal peak position
j - the vertical peak position
Returns:
a double array containing the peak position with sub pixel accuracy

parabolicPeakFit

public static double[] parabolicPeakFit(float[][] subCorrMat,
                                        int x,
                                        int y)
Parabolic peak fit. See Raffel, Willert, Kompenhans; Particle Image Velocimetry; 3rd printing; S. 131 for details

Parameters:
subCorrMat - some two dimensional data containg a correlation peak
x - the horizontal position of the correlation peak
y - the vertical position of the correlation peak
Returns:
a double array containing the peak position with sub-pixel accuracy

parabolicPeakFit

public static double[] parabolicPeakFit(javax.media.jai.PlanarImage subCorrMat,
                                        int i,
                                        int j)
Parabolic peak fit. See Raffel, Willert, Kompenhans; Particle Image Velocimetry; 3rd printing; S. 131 for details A pyramid weighting function is applied to the fife values that are used for the peak fit.

Parameters:
subCorrMat - some two dimensional data containg a correlation peak
i - the horizontal position of the correlation peak
j - the vertical position of the correlation peak
Returns:
a double array containing the peak position with sub-pixel accuracy

createRandomParticleVolumes

public static void createRandomParticleVolumes(java.io.BufferedWriter bwA,
                                               java.io.BufferedWriter bwB,
                                               double vx,
                                               double vy,
                                               double vz,
                                               double a,
                                               double b,
                                               double c,
                                               int np,
                                               double dp,
                                               double w)
Creates random particle position volumes of a Poiseuille flow. The output files of this method might be used by the synthetic image generation program of the EUROPIV II Project "Synthetic Image Generator" (SIG), Feb. 2001, by Bertrand Lecordier: Bertrand.Lecordier@coria.fr, Jose Nogueira: goriba@ing.uc3m.es, and Jerry Westerweel: j.westerweel@wbmt.tudelft.nl.

Parameters:
bwA - A buffered writer for the random particle positions.
bwB - A buffered writer for the diplaced particle positions.
vx - The x dimension of the particle volume (real units).
vy - The y dimension of the particle volume (real units).
vz - The z dimension of the particle volume (real units).
a - Eularian nutation angle of the particle volume (rad).
b - Eularian rotation angle of the particle volume (rad).
c - Eularian precession angle of the particle volume (rad).
np - Number of particles.
dp - Maximum displacement (real units).
w - With of flow domain (fraction of vx, vy).

createReferenceData

public static java.lang.String[] createReferenceData(java.lang.String outputFileName,
                                                     double vx,
                                                     double vy,
                                                     double vz,
                                                     double a,
                                                     double b,
                                                     double c,
                                                     double dp,
                                                     double w,
                                                     int nsp,
                                                     double dsp,
                                                     double scaleX,
                                                     double scaleY,
                                                     int x0,
                                                     int y0,
                                                     int hx,
                                                     int hy,
                                                     int nx,
                                                     int ny,
                                                     double topZ,
                                                     boolean header)
Creates reference vector data of a Poiseuille flow. The flow direction will be tilted by the specified angles. The output data represents a number of parallel cuts through the flow (scan).

Parameters:
outputFileName - A file name for the output data, will be numbered automatically.
vx - The x dimension of the particle volume (real units).
vy - The y dimension of the particle volume (real units).
vz - The z dimension of the particle volume (real units).
a - Eularian nutation angle of the particle volume (rad).
b - Eularian rotation angle of the particle volume (rad).
c - Eularian precession angle of the particle volume (rad).
dp - Maximum displacement (real units).
w - Width of flow domain (fraction of vx, vy).
nsp - Number of scan planes.
dsp - distance between scan planes (unit: real).
scaleX - horizontal scaling (pixel/real units).
scaleY - vertical scaling (pixel/real units).(This parameter is just added for future compatibility. For the moment, pixels are assumed to be square: scaleX = scaleY = scaleZ)
x0 - x-position of first vector.
y0 - y-position of first vector.
hx - horizontal vector spacing.
hy - vertical vector spacing.
nx - number of horizontal nodes.
ny - number of vertical nodes.
topZ - position of first (top) scan plane.
header - creates a tecplot header if true.
Returns:
An array that contains the names of the generated files.