Stereo-PIV (2D3C)

With two cameras that look at the light sheet from different angles, PIVlab measures all three velocity components in the sheet: U and V in the sheet plane and W through it. Most of the work is the same as in normal 2D PIV — you only learn two new things: the camera switch and the Stereo-PIV panel.

How it works

Overview of the involved steps

  1. Import the images of both cameras.
  2. Perform a lens calibration for each camera (or load a previously saved calibration).
  3. Record an image of the calibration target in the light sheet with both cameras.
  4. Perform the stereo calibration (calculates the positions of the cameras).
  5. Perform the disparity correction (accounts for the misalignment between the calibration target and the light sheet).
  6. Perform the PIV analysis of the images and derive the W component from the results.

Each camera sees the particles in the light sheet in perspective. After the stereo calibration, PIVlab maps the images of both cameras onto one common grid in the light sheet, so a point of the sheet lies at the same pixel in both images. Each camera is then analysed with normal 2D PIV. The two 2D results differ only because the cameras see the out-of-plane motion from different angles, and from this difference PIVlab computes U, V and W.

The board is never placed exactly in the light sheet, so the two images do not match perfectly at first. The remaining shift between them, the disparity, is measured by correlating the particle images of camera 1 with those of camera 2 at the same time. PIVlab fits a smooth map to it, corrects both cameras with it, and from it also knows where the light sheet really is.

Where to put the cameras

W is measured because the two cameras look at the sheet from different directions. How they are placed does not matter otherwise:

ArrangementNotes
Side by side, above each other or diagonal, on the same side of the sheet The usual set-up. Any direction between the cameras works: PIVlab takes W from the direction in which the two views differ.
On opposite sides of the light sheet The camera behind the board sees it from its back. Use a transparent board (pattern printed on film or glass) or a thin board printed on both sides, with the back side as the exact mirror image of the front. PIVlab finds the mirrored board automatically.

The angle between the two lines of sight counts, not the side of the sheet: 30° to 90° is good. Two cameras on opposite sides that look at each other along one line can not measure W. Coordinates and the sign of W are defined as seen from camera 1 (x to the right, y down, W positive away from camera 1). With both cameras on the same side, W is therefore positive away from the cameras. U, V and W are given in the axes of the marker board (x and y in the board plane, W normal to it), so the result is aligned with your model or test section exactly as you placed the board, even if the light sheet is slightly tilted.

Particle brightness: use forward scatter The brightness depends on the angle between the laser's direction of travel and the camera, not on the side of the sheet. A camera downstream of the laser sees forward scatter, a camera on the laser's side backward scatter, roughly 10× darker. At 40–45° viewing angle, forward scatter is about 5× brighter than a 2D camera normal to the sheet (1.5 µm oil in air) and often more for large particles in water. Best: both cameras downstream of the laser at 40–45°, e.g. on opposite sides of the sheet. Behind a flat water wall the angle in the water is smaller (45° in air → 32°); a water prism avoids this.
Board thickness The camera behind a transparent board sees the pattern through the board material. A small offset of the pattern plane is removed by the disparity correction, but keep the board thin and flat.

One session, two cameras

In stereo mode PIVlab keeps two cameras in one session. All panels work on the active camera; the switch CAM 1 / CAM 2 in the Tools panel changes between them, as do Ctrl+Shift+1 and Ctrl+Shift+2. The camera that is shown is written on the image in its colour: camera 1 blue, camera 2 orange.

Tools panel of PIVlab with the blue CAM 1 button next to the frame slider
The camera switch CAM 1 / CAM 2 in the Tools panel.
KeptWhat
Separate for each cameraimages, lens calibration, board image in the light sheet, background images, masks, the 2D result of the camera
Shared by both camerasall settings (pre-processing, background subtraction, image-based validation, PIV settings, vector validation, smoothing), region of interest, spatial calibration, results (U, V, W)

Any setting you change while camera 1 is shown also applies to camera 2. Only the masks have to be drawn for each camera.

1. Importing the images

  1. In the Input data panel click Import stereo images (below Import images), or press Ctrl+Shift+O.
  2. The image import dialog has one list per camera: go to the images of camera 1 and click Add to camera 1, then the same for camera 2. The sequencing style applies to both cameras (e.g. pco double images).
  3. Both cameras must give the same number of images, recorded at the same time.

Images recorded in PIVlab with two cameras (Stereo acquisition) open in stereo mode directly, without this dialog.

Checking the images first

Right after the import you can check the particle images with a normal 2D PIV analysis: Analyze current frame or Analyze all frames analyse the camera that is shown, as in 2D PIV. Switch to the other camera to check it too; each camera keeps its own check result. The check results are removed when you compute the stereo calibration.

2. and 3. Lens calibration and board image, for each camera

Do this exactly as in Camera calibration, once with camera 1 active and once with camera 2 active (switch with the CAM 1 / CAM 2 button at the bottom left). The board definition is shared.

  1. Lens calibration (Camera calibration (undistortion)): Estimate cam parameters from board images, or Load parameters. For cameras with a Scheimpflug adapter, use the tilted sensor model. Stereo-PIV always undistorts the images. In stereo mode, the checkbox Enable camera calibration is called Show undistorted image: it only switches the display of the current camera between the raw and the undistorted image. You do not need to tick it.
  2. Board image in the light sheet (Image rectification): place the board in the light sheet, record it with both cameras, and load each camera's image with Load target image. The stereo calibration replaces the 2D rectification. After the stereo calibration, Show rectified board shows the board on the common grid of both cameras; its corners should lie at the same pixels in both cameras.
Same board position for both cameras Both board images must show the board in the same position. Ideally record them at the same time. The board should cover as much of the measurement area as possible.

4. Stereo calibration

Steps 4 and 5 are done in the Stereo-PIV panel (Analysis → Stereo-PIV, Ctrl+Shift+W). At the top, the panel shows a checklist of what is done and what is still missing; below are the stereo calibration (the common view of both cameras) and the disparity correction (the fine alignment of both cameras on the particle images).

The Stereo-PIV panel with the checklist, the stereo calibration buttons and the disparity correction settings and report
The Stereo-PIV panel after the stereo calibration and the disparity correction (real data, two cameras at 45° and 47°).

Click Compute stereo calibration. PIVlab detects the board corners in the board images of both cameras (obviously wrong corners are rejected), computes the position of each camera, and builds the common grid in the light sheet. Afterwards:

Show 3D setup draws both cameras, the board, the overlap and (after the disparity correction) the measured light sheet. Its report gives the viewing angle of each camera, the angle between them, whether the cameras are on opposite sides of the sheet and which camera sees the board from behind, the distance to the sheet, the scale (mm per pixel), the overlap of the two views, the number of board corners, the expected random error of W compared with U and V, and the direction of positive W. A small angle between the cameras makes W noisy (its error grows like 1 / tan of the half angle).

Calibrate first, then mask Masks, region of interest and background images are made on the images that are shown. The stereo calibration changes these images, so PIVlab asks before it removes masks and results that were made before.

5. Disparity correction

In the disparity correction part of the Stereo-PIV panel, click Measure disparity. PIVlab correlates frame A of camera 1 with frame A of camera 2 for several image pairs spread over the series, fits a smooth map, and corrects both cameras with it. It repeats this on the corrected images to find what remains. If you click ANALYZE! without measuring the disparity, PIVlab measures it first with the current settings.

SettingMeaning
PairsNumber of image pairs used. 0 (default) = automatic: PIVlab adds image pairs until the map is accurate to about 0.5 px; the report shows the number used and the estimated accuracy. Any other number uses exactly that many pairs.
PassesHow often the disparity is measured (default 3): each further pass measures what remains on the corrected images and adds it. It stops early when less than 0.1 px remains.
ModelSmooth model of the disparity map: 2nd-order polynomial (default), plane, or projective.
Window sizeInterrogation area of the first pass in px, 0 = automatic. Unlike regular PIV, the disparity map should be calculated with very large windows for good robustness.
Stdev / MedianValidation of the disparity vectors (defaults 6 and 3).

The report gives the number of rejected vectors, the disparity before the correction, what remains after it (measured), and the position and tilt of the light sheet relative to the board. A warning appears when more than 1 px remains in parts of the image. Then look at Remaining disparity (below): a pattern shows where the cameras still disagree. Possible causes are the lens calibrations, the board images, or a light sheet that is not flat (e.g. refracted by a wavy water surface).

With Show you can look at the result while the panel is open:

DisplayShows
Camera imageThe corrected image of the active camera.
Disparity: measured vectorsThe measured shifts between the cameras; rejected vectors are marked.
Disparity: fitted mapThe smooth map that is used for the correction.
Remaining disparityWhat the correction leaves (measured minus fitted) — should be small and random.
Overlay cam 1 / cam 2Camera 1 red, camera 2 cyan, with or without the correction. Large structures (walls, edges, particle clouds) should line up after the correction. Single particles only overlap (grey) in a thin light sheet: each camera sees particles at different depths of the sheet at slightly different places, and the correction removes only the mean shift.
Reconstruction residual (after ANALYZE)For the image pair shown: how well the 2D results of both cameras fit one 3D velocity. Large values mean that one camera's vector is probably wrong there, or that the cameras do not see the same place (see Remaining disparity).
Masks after the disparity correction The correction moves the images by up to a few pixels. Masks drawn before may have to be adapted; PIVlab warns you.

6. Analysis, validation and the result

Work in progress The analysis, validation and display of stereo results are still being developed. What is described here may change, and some parts are not available yet (see the list below).

From here on everything works as in 2D PIV: pre-processing, masks (for each camera), PIV settings, and ANALYZE!. After the stereo calibration, ANALYZE analyses camera 1 and camera 2 with the same settings and then computes U, V and W.

7. Working with W and taking the 3D result out of PIVlab

W is positive away from the cameras (cameras on opposite sides of the light sheet: away from camera 1) and has the same units as u and v (px/frame, or m/s after the spatial calibration).

Stereo-PIV also runs from a MATLAB script, with the same results as the GUI: see Command line: Stereo-PIV.