Flow Field Generation From PIV Recordings

This article gives a brief introduction to PIV (Particle Image Velcoimetry) and principles associated with it. Also presents detailed explanation for generating flow field from PIV double frame single pulse recordings in MATLAB (codes and results are provided).


Particle Image Velocimetry (PIV) is a non-intrusive laser optical method of flow visualization, used to obtain whole field instantaneous velocity and related flow properties. The fluid is seeded with tracer particles that are generally assumed to follow the flow dynamics. It is the motion of these seeding particles that is used to calculate the velocity field. PIV measures velocity fields by taking two images shortly after each other and calculating the distance individual particles traveled with in this time. From the known time difference and the measured displacement the velocity is calculated. Since the flow can be quite fast one has to avoid blurred images and that’s one reason to use laser pulses. They are only 6-10 nano seconds long and freezes any motion. The other reason is that only laser light can be focused into a thin enough sheet so that only particles in that plane can be captured.

Experimental Setup and Operation

Tracer particles are added to the flow, these particles have to be illuminated at least twice in a plane of flow within a short time interval. The scattered light by the particles has to be recorded either in single frame or sequence of frames. This report essentially presents the determination of velocity field through evaluation of PIV reading (images obtained).2D PIV recordings. A plane of interest is illuminated twice by means of laser. Light scattered from the tracer particles is recorded using high resolution camera either on a single frame or two different frames. After development the photo-graphical PIV recordings is digitized by means of scanner. The output of the digital sensor is transferred directly to the memory of computer.

Processing the Images

Since the popularity of PIV, many image processing algorithms have been proposed. Amongst them, fast Fourier transform (FFT) Cross Correlation, Discrete Window Offset Cross Correlation, Iterative Multi-grid Cross Correlation, Iterative Image Deformation Cross. Correlation and cross correlation based particle tracking methods are widely used algorithms and have been extensively studied by researchers.

PIV images are analyzed by subdividing the image into small interrogation regions. The local displacement vectors for the images of the tracer particles of first and second illumination is determined for each interrogation area by computing the spatial auto-correlation, or preferably the spatial cross-correlation of the particle images. It is assumed that all particles in one interrogation region have moved homogeneously between two illuminations.


Auto-correlation is performed when images from both laser pulses are recorded on the same frame i.e. the camera shutter stays open during the time that both laser pulses are send. Such a recording is called single-frame double-exposure. The auto-correlation R(S), of the intensity pattern, I(S), of the interrogation region (spot) is

𝑅(𝑆) = ∫ 𝐼(𝑋)𝐼(𝑋 + 𝑆)𝑑𝑋

By computing spatial auto-correlation for a double exposure images, the correlation domain contains three dominant peaks (provided that a sufficient number of particle images is present with in the interrogation region, and that the displacement is uniform almost throughout the interrogation region): a central self-correlation peak, and two displacement correlation peaks on the either side of the self-correlation peak. The location of displacement-correlation peaks yield the particle-image displacement. A 180o directional ambiguity occurs due to the rotational symmetry of the auto-correlation function.

A suitable time separation (Ξ”t) between the exposures can be roughly estimated by knowing the expected flow velocity (U) of the exposure plane, the recording magnification (M), the interrogation region size (dI) in the image plane.

π›₯𝑑 ≀ 0.25(𝑑𝐼/π‘€π‘ˆ)

One of the schemes to resolve the directional ambiguity is to translate the flow field during the recording such that translation speed exceeds the speed of any reversed flow. In this way, the entire flow field is forced to become uni-directional and then the translation speed is subtracted as the final step to resolve regions of reversed flow.


Many are drifting towards double-frame/single pulse recordings. In this shutter opens to admit the first pulse, the resultant image is stored in the buffer and after some time interval shutter opens again to admit second pulse, then both images are transferred to memory. Here, each frame contains image from either first or second pulse but not both. Because the identity of the frame containing the first pulse is known, the process of cross-correlating the first frame with second yields a unique single peak without any directional ambiguity.

The cross-correlation function C(S) of the intensity patterns I1(X) and I2(X) of the interrogation spots 1 and 2 is

𝐢(𝑆) = ∫ 𝐼1(𝑋)𝐼2(𝑋 + 𝑆) 𝑑𝑋

By computing spatial cross-correlation between intensities from two frames, the correlation domain contains single peak: a displacement peak. The location of displacement-correlation peak yield the particle-image displacement without any directional ambiguity.




Figure 1. Spatial cross-correlation of I1 and I2 a: Particle image field; b: Cross-correlation field

MATLAB Implementation

Image pairs ( A & B) from a double-frame/single pulse PIV experiment were provided. Images are decomposed into many interrogation regions, average velocity field is computed by performing cross-correlation on these interrogation regions seperatly.In this method average velocity is determined by correlation image A and image B, detecting peak from the instantaneous correlation functions.

  • Images are loaded into two different matrices A and B with the values as their intensities using imread function where indices hold the position in pixels.
  • Images are divided into interrogation spots of size nΓ—n, where n is variable, changed to obtain optimum flow field.
  • Cross-correlation matrix Ci between each interrogation spot of A and B was found out. So each interrogation spot contains one cross-correlation matrix. Detailed documentation for cross-correlation matrix is provided here.
  • Index of the maximum value of cross-correlation matrix gives the average displacement of that interrogation spot. Dividing the obtained displacement with time interval (Ξ”t) gives velocity.

Matlab Codes


This loads the images. Takes interrogation box size and overlap value as arguments and returns displacement matrix.


Takes intensity values, interrogation box size and overlap value (0≀v<1) as arguments and returns displacement matrix of each interrogation box.


Takes matrix as argument and returns indices corresponds to the maximum value.

drawPlot.m (This function calls all the above functions and results the field)

Used to draw velocity field. Takes interrogation box size and overlap value as arguments and draws the velocity field using quiver function.

Sample Results


Single Vortex field generated from double frame single pulse PIV recordings

For detailed explanation of results you can go through my project report here.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s