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 inpiv_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:
Mask on raw image: I * mask, perform PIV
Divide mask into windows: mask_w
use mask_w to mask resulting velocity field: u[~mask_w] = np.nan
- Option 2:
Perform PIV on raw images
Divide mask into windows:mask_w
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 bycorrLib.divide_windows()
may not match the PIV results from other methods. Therefore, this method should not be used in the future. Consider to usepivLib.PIV()
together withpivLib.apply_mask()
.