pivuq.disparity
- pivuq.disparity.ilk(image_pair, U, window_size=16, prefilter=True, window='gaussian', velocity_upsample_kind='linear', warp_direction='center', warp_order=1, warp_nsteps=1)[source]
Disparity map calculation using iterative Lucas Kanade (“ilk”).
- Parameters:
image_pair (
np.ndarray
) – Image pairs \(\mathbf{I} = (I_0, I_1)^{\top}\) of size (2 x rows x cols).U (
np.ndarray
) – Sparse or dense 2D velocity field \(\mathbf{U} = (u, v)^{\top}\) of (2 x U_rows x U_cols).window_size (
int
, default:16
) – Window size around the pixel to consider the disparity for optical flow estimator.window (
{"gaussian", "tophat"}
, default:"gaussian"
) – Windowing kernel type for integration around the pixel.prefilter (
bool
, default:True
) – Whether to prefilter the estimated optical flow before each image warp. When True, a median filter with window size 3 along each axis is applied. This helps to remove potential outliers.velocity_upsample_kind (
{"linear", "cubic", "quintic"}
, default:"linear"
) – Velocity upsampling kind for spline interpolation scipy.interpolation.interp2d.warp_direction (
{"forward", "center", "backward"}
, default:"center"
) – Warping direction.warp_order (
1-5
, default:1
) – The order of interpolation for skimage.transform.warp.warp_nsteps (
int
, default:5
) – Number of sub-steps to use for warping to improve accuracy.
- Returns:
X, Y (
np.ndarray
) – x and y coordinates of disparity map.D (
np.ndarray
) – pixel-wise 2D disparity map \(\mathbf{D} = (d_x, d_y)^\top\) of size (2 x rows x cols).
See also
skimage.registration.optical_flow_ilk
Coarse to fine optical flow estimator.
skimage.transform.warp
Warp an image according to a given coordinate transformation.
- pivuq.disparity.sws(image_pair, U, window_size=16, grid_size=4, window='gaussian', radius=1, sliding_window_subtraction=True, ROI=None, velocity_upsample_kind='linear', warp_direction='center', warp_order=1, warp_nsteps=1)[source]
Python implementation of Sciacchitano-Wieneke-Scarano algorithm of PIV Uncertainty Quantification by image matching [1].
- Parameters:
image_pair (
np.ndarray
) – Image pairs \(\mathbf{I} = (I_0, I_1)^{\top}\) of size (2 x rows x cols).U (
np.ndarray
) – Sparse or dense 2D velocity field \(\mathbf{U} = (u, v)^{\top}\) of (2 x U_rows x U_cols).window_size (
int
, default:16
) – Window size around the pixel to consider the disparity ensemble.grid_size (
int
, default:4
) – Disparity ensemble grid resolution in pixels.window (
{"gaussian", "tophat"}
, default:"gaussian"
) – Window type for the disparity statistics.radius (
int
, default:1
) – Search radius for particle peak position.sliding_window_subtraction (
bool
, default:False
) – Whether to use the sliding window subtraction before disparity vector calculation.ROI (
tuple
, default:None
) – Region of interest to use for calculating the disparity ensemble (i_min, i_max, j_min, j_max).velocity_upsample_kind (
{"linear", "cubic", "quintic"}
, default:"linear"
) – Velocity upsampling kind for spline interpolation scipy.interpolation.interp2d.warp_direction (
{"forward", "center", "backward"}
, default:"center"
) – Warping direction.warp_order (
1-5
, default:1
) – The order of interpolation for skimage.transform.warp.warp_nsteps (
int
, default:5
) – Number of sub-steps to use for warping to improve accuracy.
- Returns:
X, Y (
np.ndarray
) – x and y coordinates of disparity map.delta (
np.ndarray
) – Instantaneous error estimation map of size \(2 \times N \times M\) defined by Eq. (3) [1].N (
np.ndarray
) – Number of peaks inside the window.mu (
np.ndarray
) – Mean disparity map of size \(2 \times N \times M\) defined by Eq. (3) [1].sigma (
np.ndarray
) – Standard deviation disparity map of size \(2 \times N \times M\) defined by Eq. (3) [1].
References