myimagelib.pivLib.PIV_masked

myimagelib.pivLib.PIV_masked(I0, I1, winsize, overlap, dt, mask)

Apply PIV analysis on masked images

Parameters
  • I0 – the first image

  • I1 – the second image

  • winsize – same as pivLib.PIV()

  • overlap – same as pivLib.PIV()

  • dt – same as pivLib.PIV()

  • mask – a binary image, that will be convert to a boolean array to mask on PIV data. False marks masked region and True marks the region of interest.

Returns

x, y, u, v – DataFrame, here x, y is wrt original image, (u, v) are in px/s

This function is rewritten based on the PIV_droplet() function in piv_droplet.py script. The intended usage is just to pass one additional mask parameter, on top of conventional parameter set.

EDIT

12142021

Initial commit.

12152021
  • After testing 2 masking procedure, option 1 is better.

  • Two procedures produce similar results, but option 1 is faster.

  • So this function temporarily uses option 1, until a better procedure comes.

01072022

Change mask threshold from 1 to 0.5, this will include more velocities.

Masking procedure

  • Option 1:
    1. Mask on raw image: I * mask, perform PIV

    2. Divide mask into windows: mask_w

    3. use mask_w to mask resulting velocity field: u[~mask_w] = np.nan

  • Option 2:
    1. Perform PIV on raw images

    2. Divide mask into windows:mask_w

    3. use mask_w to mask resulting velocity field: u[~mask_w] = np.nan

Note

This method is specific to openpiv PIV data. In other PIV methods, the x, y coordinates of windows may be different, and the shape of downsampled mask by corrLib.divide_windows() may not match the PIV results from other methods. Therefore, this method should not be used in the future. Consider to use pivLib.PIV() together with pivLib.apply_mask().