PIV Particle Tracking for LabVIEW Instructions


     This program tracks motion in a set of images using the correlation method.  When given a set of N input images it will produce a matching set of N-1 vector fields.  The program first divides the images up into a grid of kernels and performs a correlation on the area surrounding each kernel.  The value is then stored into a 2D array.  These values are in turn used to calculate the displacement of the given kernel in each image, which can be used to create a vector field.  To run the program you should open the file Tracker Main.vi.  The entire program and all of its features can be run from this front panel.  Below is an image of the given panel.









Input Information:

Directory Information: This cluster contains all the information about the image files to be analyzed including the file names and location.

1.      Image Directory: The location where the image files are stored.  It is important to have a ‘\’ after the last folder name.

2.      Image Base Name: The base name for all of the images.  For example, the files Image1.bmp, Image2.bmp both have the same base name Image.

3.      Image Extension: The file extension of the image, usually either .bmp or .jpg.


      Number of Images: The number of images to be analyzed.  This field should have value at least 2.  Note that the number of vector fields produced will be N-1.

      Start at Image: The number of the image you want to start at.

      Threshold: When dealing with the correlation matrix any value less than the maximum value – threshold is ignored.


      Search Dimensions: These two inputs specify how far from the center of each kernel the program will perform the correlation.  This value should be large enough to take into account the maximum movement of a given particle, but reducing the search distance will produce faster results.

1.      X Search Distance: The distance to move both left and right in the horizontal direction.

2.      Y Search Distance: The distance to move both up and down in the vertical direction.


      Fragment Dimensions:  The program will divide the image up into a grid of kernels.  These two values specify the x and y dimensions of these kernels.  For best results these values should be an even divisor of the actual image dimensions.

1.      Fragment X: The x dimension of the kernel.

2.      Fragment Y: The y dimension of the kernel.


      Position Information: This cluster contains information about where the correlation information is to be stored.  It is mostly used by the part of the program that will draw the vector fields and save them as bitmaps.

1.      Position Location: The location where the calculated correlation locations are stored.  Note that it is necessary to have a ‘\’ after the last folder name.

2.      Position Base Name: The base name for all of the calculated positions.  The default is ‘Tracker’.

3.      Position Extension: The type of file to save the positions as.  Usually a .txt file.

4.      Original Position Base Name: Before correlation is performed the centers of all the kernels are calculated and the result is stored in the same directory as Position Location but with this base name.




Vector Information: This group contains all of the parameters needed for drawing the vectors including what type of field to draw.

1.      Vector Style: There are two different ways to realize the vector field.  They can be drawn all the same length, in which case they need to be color coded by magnitude, or they can be drawn with lengths corresponding to how far the kernel moved in the image.  All of the remaining parameters in this region relate to drawing the vectors all the same length.

2.      Vector Length: The standard length of which to draw the vectors.  Depending on the number of vectors present and the size of the kernels this value needs to be adjusted to keep kernels from overlapping, while still keeping them large enough to see.

3.      Color Cutoff Values: An array consisting of vector magnitudes, which are used to determine the different colors of the vectors.  Note that if there are N elements in the array, then you need N+1 different colors.  The first color goes to all vectors of magnitude < a[0].  The second color goes to vectors where a[0] £ magnitude < a[1].  The remaining colors are divided up similarly.

4.      Vector Color Table: An array of colors specifying which colors to use for the different categories specified by the color cutoff values.  Note that if the vectors are drawn with their original length, then the program merely chooses the first element of this array and draws all the vectors that color.


     Below are examples of the two different types of vector fields.  On the left the vectors are drawn all the same length.  Red is used for the largest magnitude category and the colors become cooler as the magnitude decreases.  On the right they are drawn their original length and consequently are all the same color.











The following is a list of the non-library sub vi’s used in this program.  All except

Picture to Pixmap.vi were written specifically for this application.


Complex Tracker.vi

Draw Vectors.vi

Get Bounding Rectangle.vi

Fragment Image.vi

Get Kernel Center.vi

Draw Vectors Real Length.vi

Draw Vectors Same Length.vi

Picture to Pixmap.vi

Get Array X-Y.vi

Get Vector Tip.vi

Get Vector Color.vi

Get Magnitude and Angle.vi


Any questions or comments should be directed to the programmer, Andrew Crites, at: acrites@u.arizona.edu