Originally, Particle Image Velocimetry (PIV) is applied as non-intrusive technique to measure velocities in fluids [e.g. 1, 2, 3, 4, 5]: A laser sheet illuminates reflective particles that were added to the fluid. A camera records the motion of the particles. The displacement of small groups of particles from one image to the next image is finally quantified by image cross-correlation. Displacement per time yields the space-resolved velocity in the images. PIV has become increasingly useful in research disciplines other than fluid dynamics in the last years: PIV is applied to cell motion , granular flows , ultrasonic images  and numerous other kinds of imagery where velocities or displacements need to be quantified (the reader can get a good impression of this diversity on the Microsoft Academic profile1 or the Google Scholar profile2 of PIVlab). As PIV has become an important method in the last decades, there are many commercial software packages available (e.g. Dantec DynamicStudio, ILA PIVview, LaVision Flowmaster, TSI INSIGHT). These are often not limited to 2D PIV, but can also process planar 3D (stereo) PIV and even more advanced data like volumetric PIV. There is also free PIV software (OpenPIV , Fluere , Fluidimage , mpiv , JPIV , UVMAT ) that is extensively used in scientific research.
PIVlab is aimed at planar, 2D PIV and has been initially published in 2010; 30 updates with new features or fixes have been released, based on user feedback and personal demands. A metapaper on PIVlab has been published in the Journal of Open Research Software in 2014  which has been cited more than 1400 times to date. A more in-depth description of the algorithms and validation has also been published . PIVlab was honoured as ‘Pick of the Week’ in MATLAB®’s official File Exchange Website. It currently is MATLAB®’s most popular non-official free toolbox and app. Recently, PIVlab’s correlation algorithms have been improved and modified, and these changes and the resulting benefits are presented in this software metapaper.
PIVlab is implemented as a toolbox and app for MATLAB®. A flow chart of the main program is shown in Figure 1. A PIV analysis starts with the image input and ends with exporting data. Figure 1 also shows what files contain the individual functionalities. More details on the file content is given in the Github wiki of PIVlab. PIVlab is designed to be easy to use, therefore all settings and all processing are performed in a GUI (PIVlab_GUI.m, see Figure 2). Selecting menu items changes the contents of the panel on the left side, allowing to see or change parameters easily. If desired, PIV processing can also be done without the GUI. An example that shows command-line processing is given with PIVlab_commandline.m.
Further details on the implementation are available elsewhere  and the remaining part of this section focusses on the implementation of new and enhanced features.
Ensemble correlation has been introduced by Santiago et al. in 1998 . It is especially helpful in micron-resolution particle image velocimetry (micro-PIV, µPIV), as it can deal with exceptionally low seeding densities, where standard PIV algorithms would fail . In ensemble correlation, a series of sparsely seeded images of steady flow is analysed via cross-correlation. The resulting correlation matrices are averaged before a peak searching algorithm is used, resulting in much better signal-to-noise ratio and high vector resolution for low particles densities become possible. However, the flow needs to be steady, and must not change substantially with time. Otherwise the correlation peak would be significantly broadened, hindering the detection of the correct displacement. Ensemble correlation in PIVlab features all the advanced correlation techniques of the regular correlation (multiple passes, window deformation, suppression of auto-correlation, background subtraction etc.). The benefit of ensemble correlation vs. regular correlation with synthetic particle images and low seeding (< 1 particle per interrogation area) is presented in the section ‘Quality control’.
PIVlab can perform direct cross-correlation of the images in the spatial domain, or cross-correlate the signals in the frequency domain using discrete Fourier transform (DFT). DFT is betwenn 30 and 50% faster (depending on the implementation ). PIVlab typically uses a circular cross-correlation to perform the DFT. Circular cross-correlation assumes the signal (image data) to be periodic, which is not accurately representing reality. Hence the assumption of periodicity might introduce frequencies in the DFT spectrum that are not existent . To suppress this negative effect, the signal can be zero-padded, yielding an approximation of a linear, non-periodic cross-correlation. As typical image data includes some noisy, non-zero background signal, zero-padding introduces an edge-discontinuity, which again deteriorates the spectrum of the DFT analysis and thereby the cross-correlation signal . The effect of these ‘sharp borders’ can be attenuated by subtracting the average intensity from the input images, finally yielding a higher ‘quality’ (in terms of bias, RMS error and valid data yield) displacement estimate than circular cross-correlation. As two-dimensional zero-padding increases the size of the dataset significantly, these improvements via linear cross-correlation come at the cost of increased computing time. The effects are quantified in the section ‘Quality control’.
Another approach to enhance the robustness of the cross-correlation is ‘repeated correlation’. This concept was proposed as a non-post-interrogation method to reduce spurious vectors from PIV data . The method can enhance the data yield for images with a bad signal-to-noise ratio. Cross-correlation is not performed once for every resulting displacement estimate, but five times in total: The interrogation windows are shifted left-up, right-up, right-bottom and left-bottom by 25% of the interrogation window length. These correlation matrices are multiplied, resulting in a new matrix with less noise and a more distinctive peak: Every correlation value that is not present in each of the five correlation matrices will be eliminated from the resulting correlation matrix .
This combined peak is then processed as usual with a sub-pixel peak finder to derive the displacement. Again, this enhancement comes at the cost of increased computational time, more details are given in the section ‘Quality control’.
As PIVlab is often used by people that are just starting with PIV, or by people that cannot afford the time to look into every aspect of PIV processing, a single setting, called ‘Correlation robustness’ was introduced. The selection of this parameter is implemented as a drop-down menu and enables the user to find a suitable compromise between processing time and displacement estimation robustness (see Table 1).
|CORRELATION ROBUSTNESS||WINDOW DEFORMATION||CROSS CORRELATION||REPEATED CORRELATION||PROCESSING TIME|
Uneven illumination or stationary background objects in the input images can sometimes result in spurious displacement estimates if the correlation of the background is stronger than the correlation of the desired signal. These undesirable results can be effectively suppressed by calculating the average of a set of input images and subtracting the resulting image from every input image. This operation now can be executed directly in PIVlab.
Another supportive method of suppressing the influence of a stationary background signal in the correlation is the ‘suppression of auto-correlation’. If the background signal dominates the correlation, but only a single image pair is available, the calculation of an average background image is impossible. Usually, the cross-correlation would then lock on the background signal, reporting zero displacement. This can be resolved by disallowing near-zero displacement (auto-correlation). It is achieved by masking the central peak in the correlation matrix. The peak finder will then detect the second highest peak in the correlation matrix, which likely is the desired signal of interest. The application of ‘auto-correlation suppression’ is limited to cases where the displacement of interest is never zero.
In this section, we present the results of tests with synthetic and experimental datasets. This kind of functional testing is performed with every software addition in PIVlab to ensure reliable results. Every functionality of the software is tested with different PIV images, and errors are fixed before a release. Detailed analyses of earlier PIVlab features are presented elsewhere [15, 16]. All the data of the test cases that are presented on the following pages are available in PIVlab’s Github repository.
Ensemble correlation has been tested with 75 synthetic particle images that contain on average 0.64 ± 0.08 particles (diameter 3 ± 1 pixels) per interrogation area (64·64 pixels). These images have been analysed in PIVlab using regular cross-correlation and ensemble correlation. As expected, the regular PIV algorithm fails to detect the correct displacement. PIV can best detect a displacement for patterns formed by groups of particles (typically > 5 particles ). Averaging the calculated displacements for all 75 image pairs does not enhance the displacement estimate (see Figure 3). Using ensemble correlation on the same dataset significantly enhances the robustness of the analysis (see Figure 3), lowering bias and RMS displacement error (average of regular cross-correlation: –1.58 ± 1.42 pixels; ensemble correlation: –0.33 ± 0.57 pixels).
The accuracy of the three different correlation robustness settings was checked with synthetic particle images. The results were also compared with a 4k Euros commercial PIV software (‘CS1’). 500 image pairs (with a particle displacement ranging from 0 to 4 pixels) for 6 different particle image quality sets with increasing gaussian noise (gaussian white noise variance 0–0.025) and increasing particle pair loss (0–25%) were tested [for details on these parameters see 16]. The synthetic images contain on average 10 particles (diameter 3 ± 1 pixels) per interrogation area (24·24 pixels). The following settings were used in PIVlab:
Similar settings were used in the commercial software:
After analysing all images, the bias and RMS error for each true displacement were calculated from the true displacement and the estimated displacement [see 16, for details]. Finally, we calculated the mean absolute bias and the mean RMS error for each analysis, which serves as a measure for the accuracy of that analysis. Furthermore, we counted the amount of displacement estimates that have a deviation of more than 1 pixel with regard to the true displacement. We take the inverse of this number as a measure for the robustness of an analysis. The results show that PIVlab can achieve a very low bias error with the ‘extreme’ correlation robustness which uses repeated correlation and linear cross-correlation. Even at ‘standard’ robustness, PIVlab outperforms the commercial software (see Figure 4).
The RMS error of the commercial software is slightly lower for images with very low noise and low particle pair loss (see Figure 5). However, for images with higher noise and particle pair loss, the ‘extreme’ correlation robustness setting of PIVlab outperforms all other analyses. The ‘extreme’ robustness setting has also the lowest number of wrong vectors, followed by the commercial software (see Figure 6).
Although PIVlab yields results that are as good as or even better than the commercial software, it clearly has a much slower processing time. The ‘extreme’ robustness setting is by a factor of 30 slower than the commercial software due to the zero-padding and the repeated correlation. Even the ‘standard’ robustness is 3 times slower than the commercial software (see Figure 7).
We believe that this limitation is acceptable, when taking the enhanced robustness of PIVlab into account. Furthermore, computers have so much computing power nowadays, that the analysis of a full HD image (1920·1080 pixels) with 66·119 displacement estimates and 2 passes on a standard laptop (Intel Core i5 7200U @ 2.5 GHz) takes only 3.2 seconds with ‘standard’ correlation robustness and 22 seconds with ‘extreme’ correlation robustness (including image pre-processing).
The functionality of background elimination and auto-correlation suppression was validated with 100 experimental particle image pairs in which a synthetic background was added. The background signal is stronger than the moving particles, hence a displacement of zero is calculated in the presence of the background signal. By subtracting the average intensity from each image before analysis, the background signal is effectively removed (see Figure 8). If such a background removal cannot be performed (e.g. when only a single image pair is available), suppression of auto-correlation can do a similar job, although the difference to the data without artificial background is slightly higher (see Figure 8).
Using synthetic particle images for analysing robustness and accuracy of PIV software is comfortable and useful to determine the influence of isolated image parameters like noise, particle size, particle pair loss etc. Such analyses have been performed extensively for PIVlab . Analyses of PIV accuracy are more complicated with experimental data, as the true velocity is often unknown. Here, we present a comparison with propeller anemometer measurements (Schiltknecht MC20, MiniWater20 Micro) in a water tunnel (located at the Bremen University of Applied Sciences, water temperature 23°C, seeded with 57 µm polyamide particles). The PIV system consists of a Phantom VEO 410L camera (1280·800 pixels) and a New Wave Pegasus-PIV 200 dual cavity laser running at 400 Hz. The images were analysed in PIVlab (2 passes, interrogation areas 64·64 and 32·32 pixels with 50% overlap, ‘extreme’ correlation robustness).
As can be seen in Figure 9, the anemometer has a large influence on the flow. A sphere in a moving fluid decelerates the flow in front of it (at 0°), and accelerates the flow at the sides (at 90° and 270°). We therefore chose an area at 45°, where we expect the influence from the anemometer to be minimal (lateral distance: about 40 mm). The water tunnel was running at several speeds between 0.15 and 0.6 m/s. For each speed, the anemometer reading was averaged over time. Eighteen image pairs were analysed with PIVlab for each speed. Every image pair yielded 4·7 vectors inside the red rectangle, resulting in 504 velocity measurements for each speed. The mean value of these measurements was compared to the mean anemometer reading. There is an exceptionally good agreement between the methods (see Figure 10). The linear regression has a slope of 1.0082 and an offset of 0.0002 m/s. The correlation coefficient is 0.9998, indicating a strong linear relationship between the two methods. The bias error is 0.984% and the RMS error is 2.22%. Our analysis cannot assess which of the two methods more accurately measures the true velocity. Previous tests with PIVlab  imply displacement estimates with an uncertainty below 0.01 pixels with synthetic images, which is also achieved by other PIV software . The analysis of experimental particle images via PIV inherently has a higher uncertainty of about 0.1 pixels due to particle intensity variations between consecutive images .
PIVlab is mostly used for analysing the displacement and velocity of particles suspended in fluids, but also for completely different data (see section ‘Reuse potential’ for some examples). This arises the question whether PIV is suitable for non-particle images. We therefore generated three simplified artificial textures (‘checkerboard’, ‘difference clouds’3 and ‘gaussian noise’4) and an average of the previous three textures (‘combined’, see Figure 11).
Integer displacements between 5 and 20 pixels were analysed (as we have no means of generating sub-pixel displacements with these textures). PIVlab was used with ‘high’ correlation robustness and a multi-pass window deformation analysis with interrogation areas of 128·128 and 64·64 pixels with 50% overlap and two passes.
Analysing the bias and RMS error shows that particle images work best (bias = 0.014% and RMS error = 0.01%). The other synthetic textures perform worse (‘difference clouds’ texture: bias = 5.6% and RMS error = 3.6%), the gaussian noise texture is least robust as 70% of all correlation estimates are unsuccessful (see Figures 12, 13 and 14). The displacement of a noise texture is challenging to detect by cross-correlation, as the correlation of random noise with a displaced random noise is not much stronger than the correlation with some other random noise. The ‘combined’ texture works better than the other synthetic textures, as it has a texture that is less monotonic which is less ambiguous in cross-correlation.
An explanation for the performance with these synthetic textures can be found in the peak finding algorithm that is used in PIVlab. As in most (commercial and free) PIV tools, PIVlab fits a Gaussian function to the integer peak location in the correlation matrix (see Figure 16). Only the adjacent four pixels around the integer peak location contribute to this fit. Using a Gaussian function is very appropriate for particle images, where each particle closely matches a Gaussian intensity distribution. Cross-correlating two Gaussian distributions again yields a correlation matrix with a Gaussian intensity distribution .
The artificial textures we tested do not have a Gaussian intensity distribution in the proximity of the integer peak location in the correlation matrix (see Figure 15). Therefore, the Gaussian function cannot be fitted correctly, and the peak is not located reliably, resulting in relatively high bias and RMS errors. A non-suitable sub-pixel estimator will fail even for an integer displacement as in this experiment. Therefore, users have to take care when using PIVlab for non-particle images: The accuracy of the displacement estimates will be worse. To counter this issue, PIVlab should be enhanced with an additional sub-pixel peak finder that is optimized for non-particle images. Changing the sub-pixel peak finder algorithm can also be done automatically by detecting the broadness of the peak and switching from a Gaussian fit to a more suitable algorithm if a certain threshold is exceeded. The implementation of another displacement estimation technique (e.g. optical flow) would be a feasible option. These enhancements would make PIVlab more accurate for the analysis of non-particle images.
Based on MATLAB® 7.10.0 (R2010a): Windows, UNIX/Linux, Macintosh
MATLAB® 7.10.0 (R2010a), upward compatible
MATLAB® 7.10.0 (R2010a): 1 GB disk space, 1 GB RAM
MATLAB®’s Image Processing Toolbox is required
William Thielicke, OPTOLUTION GmbH: Programming, maintenance, and support, writing this paper.
René Sonntag, Bremen University of Applied sciences: Testing, feedback on PIVlab, writing this paper, experiments
Eize J. Stamhuis, University of Groningen: Initial design of the tool, tips, and discussions on the functionality
The authors try to make PIVlab accessible to researchers with and without programming skills. The programming environment MATLAB® was chosen, as this software is available in many universities, with many students and researchers having access to it. The required ‘Image Processing Toolbox’ is highly likely available in most MATLAB® installations. MATLAB® has a hurdle free, flat learning curve, and many researchers are already used to the workflow. The download link of PIVlab is easy to locate on MATLAB®’s File Exchange server and the toolbox and app installs easily. No programming skills at all are required to use PIVlab.
After installation, users can quickly validate that PIVlab is working correctly by running the provided script ‘Accuracy.m’. This script generates random synthetic images, pre-processes, and analyses these images, and performs a comparison between true displacements and measured displacements. The resulting accuracy is reported to the user.
Furthermore, users can easily perform an analysis themselves using one of the provided example datasets and following one of the quick start videos.5 The default settings of PIVlab are carefully chosen to provide reasonable results for almost any dataset. Should the defaults fail, PIVlab can also suggest suitable settings for the user-specific dataset via image analysis by clicking a button.
PIVlab checks for required toolboxes and dependencies during start-up and reports the result. When a new version of PIVlab is released, a message during start-up of the GUI is displayed to notify the user of the update (internet connection required). This ensures that users keep their copy up to date and they do not miss enhancements, fixes, or new features.
Support is available via a Google Groups forum6 with currently about 50 posts per month. Here, users can suggest new features or ask for assistance with analyses. PIVlab’s wiki page on Github gives information on installation, tutorials, support and how users can contribute.7 As mentioned in the introduction, PIVlab has been widely used for image analysis in quite different fields. It has also been reused to develop new software [see 15]. Particle Image Velocimetry with PIVlab has shown to have potential to help researchers not only in flow analyses [e.g. 23], but also in cell motion [e.g. 24], sand deformation during extraterrestrial-life exploration missions [e.g. 25], avalanche research [e.g. 26], inkjet printing related studies [e.g. 27], blood spray analyses [e.g. 28] and faeces disintegration research [e.g. 29]. On average a new study is published every day that uses PIVlab in an exciting new way. Due to the diversity, the term ‘Particle image Velocimetry’ is increasingly misleading, and ‘Texture Image Velocimetry’ might be more appropriate in the future.
WT’s personal MATLAB® license was crowd-funded by PIVlab users.
The authors have no competing interests to declare.
Adrian RJ. Scattering particle characteristics and their effect on pulsed laser measurements of fluid flow: Speckle velocimetry vs particle image velocimetry. Applied Optics. 1984; 23: 1690–1691. DOI: https://doi.org/10.1364/AO.23.001690
Willert CE, Gharib M. Digital particle image velocimetry. Experiments in Fluids. 1991; 10: 181–193. DOI: https://doi.org/10.1007/BF00190388
Keane R, Adrian R. Theory of cross-correlation analysis of piv images. Applied Scientific Research. 1992; 49: 191–215. DOI: https://doi.org/10.1007/978-94-011-2690-8
Stamhuis EJ, Videler JJ. Quantitative flow analysis around aquatic animals using laser sheet particle image velocimetry. Journal of Experimental Biology. 1995; 198: 283–294. DOI: https://doi.org/10.1242/jeb.198.2.283
Raffel M, Willert C, Wereley S, Kompenhans J. Particle Image Velocimetry. Springer 2 edn. 2007. DOI: https://doi.org/10.1007/978-3-540-72308-0
Booth-Gauthier E, Alcoser T, Yang G, Dahl K. Force-induced changes in subnuclear movement and rheology. Biophysical Journal. 2012; 103: 2423–2431. DOI: https://doi.org/10.1016/j.bpj.2012.10.039
Sarno L, Carravetta A, Tai Y-C, Martino R, Papa MN, Kuo CY. Measuring the velocity fields of granular flows – employment of a multipass two-dimensional particle image velocimetry (2d-piv) approach. Advanced Powder Technology. 2018; 29: 3107–3123. DOI: https://doi.org/10.1016/j.apt.2018.08.014
Voorneveld J, Kruizinga P, Vos HJ, Gijsen FJ, Jebbink EG, van der Steen AF, de Jong N, Bosch JG. Native blood speckle vs ultrasound contrast agent for particle image velocimetry with ultrafast ultrasound – in vitro experiments in 2016. IEEE International Ultrasonics Symposium (IUS). 2016; 1–4. DOI: https://doi.org/10.1109/ULTSYM.2016.7728614
Thielicke W, Stamhuis E. Pivlab – towards user-friendly, affordable and accurate digital particle image velocimetry in matlab Journal of Open Research Software. 2014; 2. DOI: https://doi.org/10.5334/jors.bl
Thielicke W. The Flapping Flight of Birds – Analysis and Application Ph.D. thesis Rijksuniversiteit Groningen. 2014. DOI: https://doi.org/10.13140/RG.2.2.18656.94728
Santiago JG, Wereley ST, Meinhart CD, Beebe DJ, Adrian RJ. A particle image velocimetry system for microfluidics. Experiments in Fluids. 1998; 25: 316–319. DOI: https://doi.org/10.1007/s003480050235
Delnoij E, Westerweel J, Deen NN, Kuipers JH, van Wpm Wim Swaaij. Ensemble correlation piv applied to bubble plumes rising in a bubble column. Chemical Engineering Science. 1999; 54: 5159–5171. DOI: https://doi.org/10.1016/S0009-2509(99)00233-X
Hart DP. Piv error correction. Experiments in Fluids. 2000; 29: 13–22. DOI: https://doi.org/10.1007/978-3-642-56963-0
Nobach H, Damaschke N, Tropea C. High-precision sub-pixel interpolation in particle image velocimetry image processing. Experiments in Fluids. 2005; 39: 299–304. DOI: https://doi.org/10.1007/s00348-005-0999-z
Nobach H, Bodenschatz E. Limitations of accuracy in piv due to individual variations of particle image intensities. Experiments in Fluids. 2009; 47: 27–38. DOI: https://doi.org/10.1007/s00348-009-0627-4
Lourenco L, Krothapalli A. On the accuracy of velocity and vorticity measurements with piv. Experiments in Fluids. 1995; 18: 421–428. DOI: https://doi.org/10.1007/BF00208464
Wu K-T, Hishamunda JB, Chen DTN, DeCamp SJ, Chang Y-W, Fernández-Nieves A, Fraden S, Dogic Z. Transition from turbulent to coherent flows in confined three-dimensional active fluids. Science. 2017; 355. DOI: https://doi.org/10.1126/science.aal1979
Saw TB, Doostmohammadi A, Nier V, Kocgozlu L, Thampi S, Toyama Y, Marcq P, Lim CT, Yeomans JM, Ladoux B. Topological defects in epithelia govern cell death and extrusion. Nature. 2017; 544: 212–216. DOI: https://doi.org/10.1038/nature21718
Mori D, Ishigami G. Excavation model of soil sampling device based on particle image velocimetry. Journal of Terramechanics. 2015; 62: 19–29. DOI: https://doi.org/10.1016/j.jterra.2015.02.001
Gaudel N, de Richter SK, Louvet N, Jenny M, Skali-Lami S. Granular avalanches down inclined and vibrated planes. Physical Review E. 2016; 94: 32904. DOI: https://doi.org/10.1103/PhysRevE.94.032904
Shimobayashi SF, Tsudome M, Kurimura T. Suppression of the coffee-ring effect by sugar-assisted depinning of contact line. Scientific Reports. 2018; 8: 17769. DOI: https://doi.org/10.1038/s41598-018-35998-w
Comiskey PM, Yarin A, Attinger D. High-speed video analysis of forward and backward spattered blood droplets. Forensic Science International. 2017; 276: 134–141. DOI: https://doi.org/10.1016/j.forsciint.2017.04.016
Penn R, Maurer M, Michalec F-G, Scheidegger A, Zhou J, Holzner M. Quantifying physical disintegration of faeces in sewers: Stochastic model and flow reactor experiments. Water Research. 2019; 152: 159–170. DOI: https://doi.org/10.1016/j.watres.2018.12.037