PIV (Particle Image Velocimetry) --- ImageJ plugin



This ImageJ plugin performs iterative particle image velocimetry (PIV) analysis. Basically, a pair of images is divided into smaller regions (interrogation windows). The cross-correlation between these image subregions measures the optic flow (displacement or velocity of the objects) within the image pair. By progressively decreasing the interrogation window size, a better PIV resolution can be achieved.

Two image correlation methods were implemented for the optic flow measurement. One can either use the conventional cross-correlation method, which compares two interrogation windows with the same size; or one can use the template matching method with normalized correlation coefficient algorithm, where the interrogation window is compared against a larger searching window.

The result of the PIV analysis will be displayed as a vectorial plot, and saved in plain text tabular format containing all the analysis result. This plugin also provide a plot function to visualize the vectorial data with selected color coding.

This plugin was originally developed for measuring the displacement field of Traction Force Microscopy (TFM). It might be somehow rudimentary compared with other specialized PIV program (such as JPIV, mpiv, openPIV....etc.). Nevertheless, the implementation as ImageJ plugin makes it more available to general public and easier to combine with other image processing tasks. Compared with the plugin PIV analyser, this plugin provides more flexibility in terms of multiple PIV iteration, different correlation algorithm, as well as data retrieval and processing.

A synthetic image from the PIV challenge
The PIV analysis result displayed as vector plot overlaid with color coded magnitude map
An experimental fluorescent bead image for traction force microscopy (TFM)
The bead displacement field displayed as color coded vector plot

You can download this iterativePIV plugin (PIV_.jar) here
System independent javacv library files: javacv.jar, javacpp.jar , opencv.jar
System-dependent library files: 32-bit Windows , 64-bit Windows, 64-bit Mac, 32-bit Linux or 64-bit Linux
are also required for full functionality#.

There are also test image stack, and sample result data for testing the plot function.


If you want to do PIV with different interrogation and search window size, which is more robust, you will need the OpenCV / javacv library files.
Please see Installation for more details.
Otherwise, only use the "PIV>iterative PIV(Cross-correlation)..." function.

Source code is available here.

System Requirement

ImageJ 1.48 or later, running on Java 1.6


Just put the downloaded PIV_.jar to your ImageJ plugins folder, and restart ImageJ. You will find this plugin under the ImageJ menu Plugins>PIV.

However, if you want to do  PIV with the template matching method (window size unlimited by the power of 2, and interrogation window compared with a larger searching window), you will also need the OpenCV / javacv library files. Put the system-independent javacv library files: javacv.jar, javacpp.jar , opencv.jar into your ImageJ's plugins folder.
Depending on your system architecture, put one of the following files: 32-bit Windows , 64-bit Windows, 64-bit Mac, 32-bit Linux or 64-bit Linux into your ImageJ's plugins folder.

Detailed steps:

-Determine your system architecture: for windows 7 or 8, you might run ImageJ under 32bit or 64bit. If your ImageJ.exe is under Program files(x86), then you are using 32bit.
-Download the PIV_.jar  and put it into your ImageJ's plugins folder
-Download javacv library files javacv.jar, javacpp.jar , opencv.jar into your ImageJ's plugins folder
-Depending on your system architecture, put one of the following files: 32-bit Windows , 64-bit Windows, 64-bit Mac, 32-bit Linux or 64-bit Linux into your ImageJ's plugins folder.
-Restart ImageJ, you will find a new entry under the plugins menu (Plugins>PIV)
-Try with the sample image to see if everything worked correctly.

Detailed tutorial

Detailed description and tutorial can be find here (might be lengthy......)


#2015/02/07: Updated to use the latest javacv version 0.10

#2014/07/23: Updated to match more recent javacv/opencv library files (support win32, win64, mac64, linux32, linux64 now)

#2012/12/17: Fixed a bug causing the wrong magnitude in the Cross-correlation version.

#2012/11/16: Added macro script examples for analyzing stacks with more than 2 slices.

#2012/09/03: Fixed a bug when no correlation peak was found at first round. (Which will cause the error: java.lang.ArrayIndexOutOfBoundsException: -61938........)

#2011/11/18: Force the output number format to override the system locale setting to avoid the error interpretation of comma for different locale (ex: French / US). 

#2011/7/24: Fixed a bug related to the subpixel interpolation.

#2011/7/13: Fixed a bug caused by the completely blank image region.

#2011/5/30: Fixed the memory leak issue cause by the OpenCV interface.


#Q:The plugin launched correctly, but after entering the parameters in the dialog window I got a error message saying  "java.lang.ArrayIndexOutOfBoundsException:  ................... at ij.process.FloatProcessor.getf(FloatProcessor.java:271)......
  A: Are you using an old version of ImageJ ? Try to update it to at least version 1.44 or later.

I would like to use this PIV plugin to analyze stacks with more than 2 slices, is it possible ? 
  A: The plugin itself only handle 2 slices at this moment. But since multiple slice analysis is a repetitive task, it can be easily done by using a macro script which automatically split the whole stack pair-wise (1-2, 2-3, 3-4.....) and do the PIV. You can find the example macro script here.

#Q:How to plot the results obtained from above multi-slice PIV macro ? 
  A: Please check this macro script example for batch ploting PIV result macro Here is


1. Tseng, Q. et al. Spatial Organization of the Extracellular Matrix Regulates Cell–cell Junction Positioning. PNAS (2012).doi:10.1073/pnas.1106377109
2. Tseng, Qingzong. 2011. “Study of multicellular architecture with controlled microenvironment”. Ph.D. dissertation, Université de Grenoble. http://tel.archives-ouvertes.fr/tel-00622264.


This plugin is largely inspired by the JPIV from Peter Vennemann. For the vector interpolation between each PIV iteration, I used the library from the Open Source Physics.

Thanks to Samual Audit and his javacv library which allows me to use the very powerful OpenCV library from java.

If you find this plugin useful or have questions or comment, feel free to contact me (qztseng at gmail dot com). Or through my Linkedin tw.linkedin.com/pub/qingzong-tseng/58/807/b41/

Back to the main plugin page